brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.5 KiB · dcac50e Raw
194 lines · plain
1# RUN: yaml2obj --docnum=1 %s -o %t2# RUN: llvm-objdump --reloc %t > %t13# RUN: llvm-objdump -r      %t > %t24# RUN: cmp %t1 %t25# RUN: FileCheck %s --input-file=%t1 --strict-whitespace --match-full-lines6 7#      CHECK:RELOCATION RECORDS FOR [.text]:8# CHECK-NEXT:OFFSET           TYPE                     VALUE9# CHECK-NEXT:0000000000000001 R_X86_64_32              glob110# CHECK-NEXT:0000000000000001 R_X86_64_32S             glob211# CHECK-NEXT:0000000000000002 R_X86_64_64              loc112# CHECK-NEXT:0000000000000001 R_X86_64_32              glob1+0x113# CHECK-NEXT:0000000000000001 R_X86_64_32S             glob2+0x214# CHECK-NEXT:0000000000000002 R_X86_64_64              loc1+0x315 16--- !ELF17FileHeader: !FileHeader18  Class: ELFCLASS6419  Data: ELFDATA2LSB20  Type: ET_REL21  Machine: EM_X86_6422 23Sections:24- Name: .text25  Type: SHT_PROGBITS26  Content: "0000000000000000"27  AddressAlign: 1628  Flags: [SHF_ALLOC]29 30- Name: .rel.text31  Type: SHT_REL32  Info: .text33  AddressAlign: 434  Relocations:35    - Offset: 0x136      Symbol: glob137      Type: R_X86_64_3238    - Offset: 0x139      Symbol: glob240      Type: R_X86_64_32S41    - Offset: 0x242      Symbol: loc143      Type: R_X86_64_6444 45- Name: .rela.text46  Type: SHT_RELA47  Link: .symtab48  Info: .text49  AddressAlign: 450  Relocations:51    - Offset: 0x152      Addend: 153      Symbol: glob154      Type: R_X86_64_3255    - Offset: 0x156      Addend: 257      Symbol: glob258      Type: R_X86_64_32S59    - Offset: 0x260      Addend: 361      Symbol: loc162      Type: R_X86_64_6463 64Symbols:65  - Name: loc166  - Name: loc267  - Name:    glob168    Section: .text69    Value:   0x070    Size:    471    Binding: STB_GLOBAL72  - Name:    glob273    Binding: STB_GLOBAL74 75## Check we report an error if the relocated section identified by the76## sh_info field of a relocation section is invalid.77# RUN: yaml2obj --docnum=2 %s -o %t278# RUN: not llvm-objdump --reloc %t2 2>&1 | FileCheck %s -DFILE=%t2 --check-prefix=ERR79# ERR: error: '[[FILE]]': section (1): unable to get a relocation target: invalid section index: 25580 81--- !ELF82FileHeader:83  Class: ELFCLASS6484  Data: ELFDATA2LSB85  Type: ET_REL86  Machine: EM_X86_6487Sections:88- Name: .rela.foo89  Type: SHT_RELA90  Info: 0xFF91  Relocations:92    - Offset: 0x193      Type: R_X86_64_NONE94 95## Check ranges of addends being displayed in a dump of relocations.96# RUN: yaml2obj --docnum=3 %s -o %t397# RUN: llvm-objdump -r %t3 | FileCheck %s --check-prefix=ADDENDS98 99# ADDENDS: RELOCATION RECORDS FOR [.text]:100# ADDENDS: R_X86_64_64 glob-0x8000000000000000101# ADDENDS: R_X86_64_64 glob+0x7fffffffffffffff102# ADDENDS: R_X86_64_64 glob-0x1103# ADDENDS: R_X86_64_64 glob+0x12345678104# ADDENDS: R_X86_64_64 glob{{$}}105 106--- !ELF107FileHeader:108  Class:   ELFCLASS64109  Data:    ELFDATA2LSB110  Type:    ET_REL111  Machine: EM_X86_64112Sections:113- Name:  .text114  Type:  SHT_PROGBITS115  Size:  8116  Flags: [SHF_EXECINSTR,SHF_ALLOC]117- Name: .rela.text118  Type: SHT_RELA119  Info: .text120  Relocations:121    - Offset: 0x0122      Addend: -9223372036854775808123      Symbol: glob124      Type:   R_X86_64_64125    - Offset: 0x1126      Symbol: glob127      Type:   R_X86_64_64128      Addend: 9223372036854775807129    - Offset: 0x2130      Symbol: glob131      Type:   R_X86_64_64132      Addend: -1133    - Offset: 0x3134      Symbol: glob135      Type:   R_X86_64_64136      Addend: 0x12345678137    - Offset: 0x4138      Symbol: glob139      Type:   R_X86_64_64140      Addend: 0141Symbols:142  - Name:    glob143    Section: .text144    Value:   0x0145    Size:    0146    Binding: STB_GLOBAL147 148## Check relocation formatting on 32 bit as well to verify the formatting is correct.149# RUN: yaml2obj --docnum=4 %s > %t4150# RUN: llvm-objdump -r %t4 | FileCheck %s --check-prefix=ELF32 --strict-whitespace --match-full-lines151 152#      ELF32:RELOCATION RECORDS FOR [.text]:153# ELF32-NEXT:OFFSET   TYPE                     VALUE154# ELF32-NEXT:00000001 R_386_32                 global155# ELF32-NEXT:00000002 R_386_PC32               local156# ELF32-NEXT:00000001 R_386_NONE               global+0x1157# ELF32-NEXT:00000002 R_386_NONE               local+0x2158 159--- !ELF160FileHeader:161  Class:   ELFCLASS32162  Data:    ELFDATA2LSB163  Type:    ET_REL164  Machine: EM_386165Sections:166- Name: .text167  Type: SHT_PROGBITS168- Name: .rel.text169  Type: SHT_REL170  Info: .text171  Relocations:172    - Offset: 0x1173      Symbol: global174      Type:   R_386_32175    - Offset: 0x2176      Symbol: local177      Type:   R_386_PC32178- Name: .rela.text179  Type: SHT_RELA180  Info: .text181  Relocations:182    - Offset: 0x1183      Addend: 1184      Symbol: global185      Type:   R_386_NONE186    - Offset: 0x2187      Addend: 2188      Symbol: local189      Type:   R_386_NONE190Symbols:191  - Name:    local192  - Name:    global193    Binding: STB_GLOBAL194