brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.5 KiB · 823e573 Raw
163 lines · plain
1## Show that the value field is omitted when a relocation does not reference a symbol.2## In other cases, particularly when a symbol has a zero value or when it has an empty3## name, we print it. Test for both static and dynamic relocation printing.4 5# RUN: yaml2obj %s -o %t6# RUN: llvm-readelf --relocations --dyn-relocations %t 2>&1 | FileCheck %s -DFILE=%t7# RUN: llvm-readobj --relocations %t 2>&1 | FileCheck %s -DFILE=%t --check-prefix=LLVM8 9# CHECK:      Relocation section '.rela.text' at offset {{.*}} contains 5 entries:10# CHECK-NEXT:     Offset             Info             Type               Symbol's Value  Symbol's Name + Addend11# CHECK-NEXT: 0000000000000000  0000000000000000 R_X86_64_NONE                           112# CHECK-NEXT: 0000000000000000  0000000100000000 R_X86_64_NONE          0000000000000000 sym + 113# CHECK-NEXT: 0000000000000000  0000000200000000 R_X86_64_NONE          0000000000000123 <null> + 45614# CHECK-NEXT: warning: '[[FILE]]': unable to get section index for symbol with st_shndx = 0x0 (SHN_UNDEF)15# CHECK-NEXT: 0000000000000000  0000000300000000 R_X86_64_NONE          0000000000000000 <?> + 67816# CHECK-NEXT: 0000000000000000  0000000400000000 R_X86_64_NONE          0000000000000000 <null> + 217 18# CHECK:      Relocation section '.rela.dyn' at offset {{.*}} contains 5 entries:19# CHECK-NEXT:     Offset             Info             Type               Symbol's Value  Symbol's Name + Addend20# CHECK-NEXT: 0000000000000000  0000000000000000 R_X86_64_NONE                           121# CHECK-NEXT: 0000000000000000  0000000100000000 R_X86_64_NONE          0000000000000000 sym + 122# CHECK-NEXT: 0000000000000000  0000000200000000 R_X86_64_NONE          0000000000000123 <null> + 45623# CHECK-NEXT: 0000000000000000  0000000300000000 R_X86_64_NONE          0000000000000000 <?> + 67824# CHECK-NEXT: 0000000000000000  0000000400000000 R_X86_64_NONE          0000000000000000 <null> + 225 26# CHECK:      'RELA' relocation section at offset {{.*}} contains 120 bytes:27# CHECK-NEXT:     Offset             Info             Type               Symbol's Value  Symbol's Name + Addend28# CHECK-NEXT: 0000000000000000  0000000000000000 R_X86_64_NONE                           129# CHECK-NEXT: 0000000000000000  0000000100000000 R_X86_64_NONE          0000000000000000 sym + 130# CHECK-NEXT: 0000000000000000  0000000200000000 R_X86_64_NONE          0000000000000123 <null> + 45631# CHECK-NEXT: 0000000000000000  0000000300000000 R_X86_64_NONE          0000000000000000 <null> + 67832# CHECK-NEXT: 0000000000000000  0000000400000000 R_X86_64_NONE          0000000000000000 <null> + 233 34# LLVM:      Relocations [35# LLVM-NEXT:   Section (2) .rela.text {36# LLVM-NEXT:     0x0 R_X86_64_NONE - 0x137# LLVM-NEXT:     0x0 R_X86_64_NONE sym 0x138# LLVM-NEXT:     0x0 R_X86_64_NONE <null> 0x45639# LLVM-NEXT: warning: '[[FILE]]': unable to get section index for symbol with st_shndx = 0x0 (SHN_UNDEF)40# LLVM-NEXT:     0x0 R_X86_64_NONE <?> 0x67841# LLVM-NEXT:     0x0 R_X86_64_NONE <null> 0x242# LLVM-NEXT:   }43# LLVM-NEXT:   Section (4) .rela.dyn {44# LLVM-NEXT:     0x0 R_X86_64_NONE - 0x145# LLVM-NEXT:     0x0 R_X86_64_NONE sym 0x146# LLVM-NEXT:     0x0 R_X86_64_NONE <null> 0x45647# LLVM-NEXT:     0x0 R_X86_64_NONE <?> 0x67848# LLVM-NEXT:     0x0 R_X86_64_NONE <null> 0x249# LLVM-NEXT:   }50# LLVM-NEXT: ]51 52--- !ELF53FileHeader:54  Class:   ELFCLASS6455  Data:    ELFDATA2LSB56  Type:    ET_EXEC57  Machine: EM_X86_6458Sections:59  - Name: .text60    Type: SHT_PROGBITS61    Size: 0x1062  - Name: .rela.text63    Type: SHT_RELA64    Link: .symtab65    Info: .text66    Relocations:67      - Offset: 068        Type: R_X86_64_NONE69        Addend: 170      - Offset: 071        Type: R_X86_64_NONE72        Addend: 173        Symbol: sym74      - Offset: 075        Type: R_X86_64_NONE76        Addend: 0x45677        Symbol: 278      - Offset: 079        Addend: 0x67880        Type:   R_X86_64_NONE81        Symbol: 382## References a symbol with a zero value and an empty name.83      - Offset: 084        Type: R_X86_64_NONE85        Addend: 286        Symbol: 487  - Name: .dynamic88    Type: SHT_DYNAMIC89    Flags: [SHF_ALLOC]90    Address: 0x100091    AddressAlign: 0x100092    Entries:93      - Tag: DT_RELA94        Value: 0x110095      - Tag: DT_RELASZ96        Value: 12097      - Tag: DT_RELAENT98        Value: 2499      - Tag: DT_NULL100        Value: 0101  - Name: .rela.dyn102    Type: SHT_RELA103    Flags: [SHF_ALLOC]104    Info: .text105    Address: 0x1100106    AddressAlign: 0x100107    Relocations:108      - Offset: 0109        Type: R_X86_64_NONE110        Addend: 1111      - Offset: 0112        Type: R_X86_64_NONE113        Addend: 1114        Symbol: sym115      - Offset: 0116        Type: R_X86_64_NONE117        Addend: 0x456118        Symbol: 2119      - Offset: 0120        Addend: 0x678121        Type:   R_X86_64_NONE122        Symbol: 3123## References a symbol with a zero value and an empty name.124      - Offset: 0125        Type: R_X86_64_NONE126        Addend: 2127        Symbol: 4128Symbols:129  - Name:    sym130    Value:   0131    Section: .text132    Binding: STB_GLOBAL133  - Value:   0x123134    Section: .text135    Binding: STB_GLOBAL136  - Type:  STT_SECTION137    Index: 0138  - Value:   0x0139    Section: .text140    Binding: STB_GLOBAL141DynamicSymbols:142  - Name:    sym143    Value:   0144    Section: .text145    Binding: STB_GLOBAL146  - Value:   0x123147    Section: .text148    Binding: STB_GLOBAL149  - Type:  STT_SECTION150    Index: 0151  - Value:   0x0152    Section: .text153    Binding: STB_GLOBAL154ProgramHeaders:155  - Type:     PT_LOAD156    VAddr:    0x1000157    FirstSec: .dynamic158    LastSec:  .rela.dyn159  - Type:     PT_DYNAMIC160    VAddr:    0x1000161    FirstSec: .dynamic162    LastSec:  .dynamic163