1# RUN: yaml2obj %s > %t 2# RUN: llvm-objcopy %t %t2 3# RUN: llvm-readobj -relocations %t2 | FileCheck %s 4 5!ELF 6FileHeader: 7 Class: ELFCLASS64 8 Data: ELFDATA2LSB 9 Type: ET_EXEC 10 Machine: EM_X86_64 11Sections: 12 - Name: .text 13 Type: SHT_PROGBITS 14 Flags: [ SHF_ALLOC, SHF_EXECINSTR ] 15 Address: 0x1000 16 AddressAlign: 0x0000000000000010 17 Content: "0000000000000000" 18 - Name: .rel.text 19 Type: SHT_REL 20 Link: .symtab 21 Info: .text 22 Relocations: 23 - Offset: 0x1000 24 Symbol: foo 25 Type: R_X86_64_PC32 26 - Name: .data 27 Type: SHT_PROGBITS 28 Flags: [ SHF_ALLOC ] 29 Address: 0x2000 30 AddressAlign: 0x0000000000000010 31 Content: "0000000000000000" 32 - Name: .rel.data 33 Type: SHT_REL 34 Link: .symtab 35 Info: .data 36 Relocations: 37 - Offset: 0x2000 38 Symbol: bar 39 Type: R_X86_64_PC32 40 - Name: .rela.data 41 Type: SHT_RELA 42 Link: .symtab 43 Info: .data 44 Relocations: 45 - Offset: 0x2000 46 Symbol: barA 47 Type: R_X86_64_PC32 48 Addend: 0x17 49 - Name: .rela.text 50 Type: SHT_RELA 51 Link: .symtab 52 Info: .text 53 Relocations: 54 - Offset: 0x1000 55 Symbol: fooA 56 Type: R_X86_64_PC32 57 Addend: 0x13 58Symbols: 59 Global: 60 - Name: _start 61 Type: STT_FUNC 62 Section: .text 63 Value: 0x1000 64 Size: 4 65 - Name: foo 66 Type: STT_FUNC 67 Size: 4 68 - Name: fooA 69 Type: STT_FUNC 70 Size: 4 71 - Name: bar 72 Type: STT_OBJECT 73 Size: 4 74 - Name: barA 75 Type: STT_OBJECT 76 Size: 4 77 78# CHECK: Relocations [ 79# CHECK-NEXT: Section (2) .rel.text { 80# CHECK-NEXT: 0x1000 R_X86_64_PC32 foo 0x0 81# CHECK-NEXT: } 82# CHECK-NEXT: Section (4) .rel.data { 83# CHECK-NEXT: 0x2000 R_X86_64_PC32 bar 0x0 84# CHECK-NEXT: } 85# CHECK-NEXT: Section (5) .rela.data { 86# CHECK-NEXT: 0x2000 R_X86_64_PC32 barA 0x17 87# CHECK-NEXT: } 88# CHECK-NEXT: Section (6) .rela.text { 89# CHECK-NEXT: 0x1000 R_X86_64_PC32 fooA 0x13 90# CHECK-NEXT: } 91# CHECK-NEXT:] 92