xref: /llvm-project/llvm/test/tools/llvm-objcopy/ELF/dynrelocsec-remove-shinfo-reference.test (revision a657440bc695a98c54cd95bb7cc4cec5ab811d17)
1# RUN: yaml2obj %s -o %t
2# RUN: llvm-objcopy -R .got.plt %t %t2
3
4## .rela.plt is a dynamic relocation section that has a connection
5## via sh_info field with its target section .got.plt.
6## Here we check that if the target section is removed then dynamic
7## relocation section is also removed and we do not end up with a broken
8## sh_info value, for example.
9
10# RUN: llvm-readelf --sections %t2 \
11# RUN:  | FileCheck %s --implicit-check-not=".got.plt" --implicit-check-not=".rela.plt"
12
13--- !ELF
14FileHeader:
15  Class:          ELFCLASS64
16  Data:           ELFDATA2LSB
17  Type:           ET_DYN
18  Machine:        EM_X86_64
19Sections:
20  - Name:         .rela.plt
21    Type:         SHT_RELA
22    Flags:        [ SHF_ALLOC ]
23    Link:         .dynsym
24    Info:         .got.plt
25  - Name:         .got.plt
26    Type:         SHT_PROGBITS
27    Flags:        [ SHF_WRITE, SHF_ALLOC ]
28DynamicSymbols:
29  - Name:          bar
30    Binding:       STB_GLOBAL
31