1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +01:00

[yaml2obj] Support ELF x86 relocations.

llvm-svn: 208228
This commit is contained in:
Simon Atanasyan 2014-05-07 17:06:38 +00:00
parent 643c61edc3
commit a8319970e6
2 changed files with 86 additions and 0 deletions

View File

@ -570,6 +570,49 @@ void ScalarEnumerationTraits<ELFYAML::ELF_REL>::enumeration(
ECase(R_HEX_TPREL_16_X)
ECase(R_HEX_TPREL_11_X)
break;
case ELF::EM_386:
ECase(R_386_NONE)
ECase(R_386_32)
ECase(R_386_PC32)
ECase(R_386_GOT32)
ECase(R_386_PLT32)
ECase(R_386_COPY)
ECase(R_386_GLOB_DAT)
ECase(R_386_JUMP_SLOT)
ECase(R_386_RELATIVE)
ECase(R_386_GOTOFF)
ECase(R_386_GOTPC)
ECase(R_386_32PLT)
ECase(R_386_TLS_TPOFF)
ECase(R_386_TLS_IE)
ECase(R_386_TLS_GOTIE)
ECase(R_386_TLS_LE)
ECase(R_386_TLS_GD)
ECase(R_386_TLS_LDM)
ECase(R_386_16)
ECase(R_386_PC16)
ECase(R_386_8)
ECase(R_386_PC8)
ECase(R_386_TLS_GD_32)
ECase(R_386_TLS_GD_PUSH)
ECase(R_386_TLS_GD_CALL)
ECase(R_386_TLS_GD_POP)
ECase(R_386_TLS_LDM_32)
ECase(R_386_TLS_LDM_PUSH)
ECase(R_386_TLS_LDM_CALL)
ECase(R_386_TLS_LDM_POP)
ECase(R_386_TLS_LDO_32)
ECase(R_386_TLS_IE_32)
ECase(R_386_TLS_LE_32)
ECase(R_386_TLS_DTPMOD32)
ECase(R_386_TLS_DTPOFF32)
ECase(R_386_TLS_TPOFF32)
ECase(R_386_TLS_GOTDESC)
ECase(R_386_TLS_DESC_CALL)
ECase(R_386_TLS_DESC)
ECase(R_386_IRELATIVE)
ECase(R_386_NUM)
break;
default:
llvm_unreachable("Unsupported architecture");
}

View File

@ -0,0 +1,43 @@
# RUN: yaml2obj -format=elf %s > %t
# RUN: llvm-readobj -r %t | FileCheck %s
# CHECK: Relocations [
# CHECK-NEXT: Section (2) .rel.text {
# CHECK-NEXT: 0x0 R_386_32 main 0x0
# CHECK-NEXT: }
# CHECK-NEXT: ]
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_386
Sections:
- Type: SHT_PROGBITS
Name: .text
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
AddressAlign: 0x04
Content: 0000000000000000
- Type: SHT_REL
Name: .rel.text
Type: SHT_REL
Link: .symtab
Info: .text
AddressAlign: 0x04
Relocations:
- Offset: 0
Symbol: main
Type: R_386_32
Symbols:
Local:
- Name: .text
Type: STT_SECTION
Section: .text
Global:
- Name: main
Type: STT_FUNC
Section: .text
Size: 0x08