214 lines · plain
1# RUN: yaml2obj --docnum=1 %s -o %t2# RUN: llvm-objdump -r %t | FileCheck %s --strict-whitespace --match-full-lines3 4# CHECK:RELOCATION RECORDS FOR [.text]:5# CHECK-NEXT:OFFSET TYPE VALUE6# CHECK-NEXT:0000000000000001 R_X86_64_32 g1+0x17# CHECK-NEXT:0000000000000002 R_X86_64_64 l1+0x28# CHECK-NEXT:0000000000000000 R_X86_64_32S g1-0x19# CHECK-NEXT:0000000000000004 R_X86_64_32S .text-0x800000000000000010#CHECK-EMPTY:11# CHECK-NEXT:RELOCATION RECORDS FOR [nonalloc]:12# CHECK-NEXT:OFFSET TYPE VALUE13# CHECK-NEXT:0000000000000010 R_X86_64_64 g1+0x114# CHECK-NEXT:0000000000000020 R_X86_64_64 g2+0x215# CHECK-NEXT:0000000000000030 R_X86_64_64 *ABS*16# CHECK-NOT:{{.}}17 18--- !ELF19FileHeader: !FileHeader20 Class: ELFCLASS6421 Data: ELFDATA2LSB22 Type: ET_REL23 Machine: EM_X86_6424 25Sections:26- Name: .text27 Type: SHT_PROGBITS28 Content: "0000000000000000"29 Flags: [SHF_ALLOC]30- Name: .crel.text31 Type: SHT_CREL32 Info: .text33 Link: .symtab34 Relocations:35 - Offset: 0x136 Symbol: g137 Type: R_X86_64_3238 Addend: 139 - Offset: 0x240 Symbol: l141 Type: R_X86_64_6442 Addend: 243 - Offset: 0x044 Symbol: g145 Type: R_X86_64_32S46 Addend: 0xffffffffffffffff47 - Offset: 0x448 Symbol: .text49 Type: R_X86_64_32S50 Addend: 0x800000000000000051- Name: nonalloc52 Type: SHT_PROGBITS53 Size: 0x3054- Name: .crelnonalloc55 Type: SHT_CREL56 Info: nonalloc57 Link: .symtab58 Relocations:59 - Offset: 0x1060 Symbol: g161 Type: R_X86_64_6462 Addend: 163 - Offset: 0x2064 Symbol: g265 Type: R_X86_64_6466 Addend: 267 - Offset: 0x3068 Symbol: 069 Type: R_X86_64_6470 71Symbols:72 - Name: .text73 Type: STT_SECTION74 Section: .text75 - Name: l176 - Name: g177 Section: .text78 Value: 0x079 Size: 480 Binding: STB_GLOBAL81 - Name: g282 Binding: STB_GLOBAL83 84## Check relocation formatting on ELFCLASS32 as well.85# RUN: yaml2obj --docnum=2 %s > %t286# RUN: llvm-objdump -r %t2 | FileCheck %s --check-prefix=ELF32 --strict-whitespace --match-full-lines87 88# ELF32:RELOCATION RECORDS FOR [.text]:89# ELF32-NEXT:OFFSET TYPE VALUE90# ELF32-NEXT:00000008 R_ARM_REL32 l1+0x191# ELF32-NEXT:00000004 R_ARM_ABS32 g192 93--- !ELF94FileHeader:95 Class: ELFCLASS3296 Data: ELFDATA2MSB97 Type: ET_REL98 Machine: EM_ARM99Sections:100- Name: .text101 Type: SHT_PROGBITS102 Size: 0x10103- Name: .crel.text104 Type: SHT_CREL105 Info: .text106 Link: .symtab107 Relocations:108 - Offset: 0x8109 Symbol: l1110 Type: R_ARM_REL32111 Addend: 1112 - Offset: 0x4113 Symbol: g1114 Type: R_ARM_ABS32115Symbols:116 - Name: l1117 - Name: g1118 Binding: STB_GLOBAL119 120## Check CREL with implicit addends.121# RUN: yaml2obj --docnum=3 %s -o %t3122# RUN: llvm-objdump -r %t3 | FileCheck %s --check-prefix=IMPLICIT --strict-whitespace --match-full-lines123# IMPLICIT:RELOCATION RECORDS FOR [.data]:124# IMPLICIT-NEXT:OFFSET TYPE VALUE125# IMPLICIT-NEXT:000000000000001f R_X86_64_32 g1126# IMPLICIT-NEXT:000000000000003f R_X86_64_64 g1127# IMPLICIT-NEXT:0000000000000000 R_X86_64_32S l1128--- !ELF129FileHeader:130 Class: ELFCLASS64131 Data: ELFDATA2LSB132 Type: ET_REL133 Machine: EM_X86_64134Sections:135 - Name: .text136 Type: SHT_PROGBITS137 - Name: .data138 Type: SHT_PROGBITS139 - Name: .crel.data140 Type: SHT_CREL141 Flags: [ SHF_INFO_LINK ]142 Link: .symtab143 Info: .data144 Content: 187f030a82017787feffffffffffffff077f0a145Symbols:146 - Name: .text147 Type: STT_SECTION148 Section: .text149 - Name: l1150 Section: .text151 - Name: g1152 Section: .text153 Binding: STB_GLOBAL154 155## Test errors.156# RUN: yaml2obj --docnum=4 %s -o %t.err157# RUN: llvm-objdump -r %t.err 2>&1 | FileCheck %s --check-prefix=ERR -DFILE=%t.err158 159# ERR:RELOCATION RECORDS FOR [.data]:160# ERR-NEXT:OFFSET TYPE VALUE161# ERR-NEXT:warning: '[[FILE]]': unable to decode LEB128 at offset 0x00000000: malformed uleb128, extends past end162# ERR-NOT:{{.}}163 164--- !ELF165FileHeader:166 Class: ELFCLASS64167 Data: ELFDATA2LSB168 Type: ET_REL169 Machine: EM_X86_64170Sections:171 - Name: .text172 Type: SHT_PROGBITS173 - Name: .data174 Type: SHT_PROGBITS175 - Name: .crel.data176 Type: SHT_CREL177 Flags: []178 Link: .symtab179 Info: .data180Symbols:181 - Name: .text182 Type: STT_SECTION183 Section: .text184 185# RUN: yaml2obj --docnum=5 %s -o %t.err2186# RUN: llvm-objdump -r %t.err2 2>&1 | FileCheck %s --check-prefix=ERR2 -DFILE=%t.err2187 188# ERR2:RELOCATION RECORDS FOR [.data]:189# ERR2-NEXT:OFFSET TYPE VALUE190# ERR2-NEXT:warning: '[[FILE]]': unexpected end of data at offset 0x1 while reading [0x1, 0x2)191# ERR2-NOT:{{.}}192 193--- !ELF194FileHeader:195 Class: ELFCLASS32196 Data: ELFDATA2MSB197 Type: ET_REL198 Machine: EM_ARM199Sections:200 - Name: .text201 Type: SHT_PROGBITS202 - Name: .data203 Type: SHT_PROGBITS204 - Name: .crel.data205 Type: SHT_CREL206 Flags: []207 Link: .symtab208 Info: .data209 Content: 08210Symbols:211 - Name: .text212 Type: STT_SECTION213 Section: .text214