brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · a562312 Raw
39 lines · plain
1## If the section header index of a SHT_REL[A] section is smaller than the2## section header index of the relocated section, we should handle it properly.3## Normally it is not what compilers would emit, but some custom tools might4## want to use this feature, which is not restricted by ELF gABI.5## GNU ld supports this as well.6 7# RUN: yaml2obj %s -DTYPE=SHT_RELA -o %t1.o8# RUN: ld.lld -shared %t1.o -o %t19# RUN: llvm-readelf --relocs %t1 | FileCheck %s10 11# RUN: yaml2obj %s -DTYPE=SHT_REL -o %t2.o12# RUN: ld.lld -shared %t2.o -o %t213# RUN: llvm-readelf --relocs %t2 | FileCheck %s14 15## Check we handle the relocation properly.16# CHECK:      Relocation section '.rela.dyn' at offset 0x238 contains 1 entries:17# CHECK-NEXT:     Offset             Info             Type    Symbol's Value  Symbol's Name + Addend18# CHECK-NEXT: 00000000000022f0  0000000100000001 R_X86_64_64 0000000000000000 foo + 019 20--- !ELF21FileHeader:22  Class:   ELFCLASS6423  Data:    ELFDATA2LSB24  Type:    ET_REL25  Machine: EM_X86_6426Sections:27  - Name:  .relx.data28    Type:  [[TYPE]]29    Info:  .data30    Relocations:31      - Symbol: foo32        Type:   R_X86_64_6433  - Name:  .data34    Type:  SHT_PROGBITS35    Flags: [ SHF_ALLOC, SHF_WRITE ]36Symbols:37  - Name:    foo38    Binding: STB_GLOBAL39