mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-18 23:03:29 +08:00
7f923b7fd2
Many ELF targets arrange to emit a number of section symbols in .dynsym for use by dynamic relocations. This happens before the dynamic relocations are output, and the need for those symbols determined. In most cases they are not needed. A proper analysis of the need for dynamic section symbols is target specific and tedious, so this patch just excludes them in the obvious case when no dynamic relocations are present. The patch also runs the new pr23161 and pr23162 tests on more targets. bfd/ * elf-bfd.h (struct elf_link_hash_table): Add "dynamic_relocs". * elflink.c (_bfd_elf_init_2_index_sections): Comment fix. (_bfd_elf_add_dynamic_entry): Set "dynamic_relocs". (_bfd_elf_link_renumber_dynsyms): Exclude all section symbols when "dynamic_relocs" is not set. * elfxx-mips.c (count_section_dynsyms): Likewise. ld/ * testsuite/ld-elf/readelf.exp: Delete DUMP and selection of variant ver_def.vd. * testsuite/ld-elf/ver_def-tic6x.vd: Delete. * testsuite/ld-elf/shared.exp: Run most pr23161 and pr23162 tests for linux, nacl and gnu targets. * testsuite/ld-mips-elf/mips-elf.exp: Set base_syms to 1. * testsuite/ld-elf/pr23161a.rd: Don't check reloc type. Allow any order of __bss_start, _edata and _end. * testsuite/ld-elf/pr23161b.rd: Don't check plt and dyn relocs. Allow and order of __bss_start, _edata and _end. * testsuite/ld-elf/pr23162.rd: Fail if __bss_start, _edata or _end relocs are present rather than testing for no relocations. * testsuite/ld-aarch64/gc-plt-relocs.d, * testsuite/ld-aarch64/ifunc-1-local.d, * testsuite/ld-aarch64/ifunc-1.d, * testsuite/ld-aarch64/ifunc-2-local.d, * testsuite/ld-aarch64/ifunc-2.d, * testsuite/ld-aarch64/ifunc-21.d, * testsuite/ld-aarch64/ifunc-3a.d, * testsuite/ld-arm/farcall-mixed-lib-v4t.d, * testsuite/ld-arm/farcall-mixed-lib.d, * testsuite/ld-arm/gc-hidden-1.d, * testsuite/ld-arm/tls-gdesc-got.d, * testsuite/ld-arm/tls-lib-loc.d, * testsuite/ld-arm/tls-longplt-lib.d, * testsuite/ld-arm/tls-thumb1.d, * testsuite/ld-cris/libdso-10.d, * testsuite/ld-cris/libdso-11.d, * testsuite/ld-cris/libdso-13b.d, * testsuite/ld-cris/libdso-14.d, * testsuite/ld-cris/libdso-15.d, * testsuite/ld-cris/pic-gc-72.d, * testsuite/ld-cris/pic-gc-73.d, * testsuite/ld-cris/tls-gc-71.d, * testsuite/ld-mips-elf/mips16-pic-4a.nd, * testsuite/ld-mips-elf/pic-and-nonpic-3a.dd, * testsuite/ld-mips-elf/pie-n32.d, * testsuite/ld-mips-elf/pie-n64.d, * testsuite/ld-mips-elf/pie-o32.d: Update for removed dynamic section symbols.
48 lines
1.2 KiB
Makefile
48 lines
1.2 KiB
Makefile
#source: gc-plt1.s
|
|
#source: gc-plt-main.s
|
|
#source: gc-plt-hidden.s
|
|
#source: gc-plt2.s
|
|
#ld: --gc-sections -T aarch64.ld --shared --hash-style=sysv
|
|
#objdump: -dT
|
|
|
|
# Shared object with plt related relocs against global symbol
|
|
# and local functions gced. After gc-section removal we are
|
|
# checking that the function does not exist.
|
|
|
|
.*: file format elf64-(little|big)aarch64
|
|
|
|
DYNAMIC SYMBOL TABLE:
|
|
0+8000 g DF \.text 0+4 _start
|
|
0+0000 D \*UND\* 0+ foo
|
|
0+8008 g DF \.text 0+ bar
|
|
|
|
Disassembly of section .text:
|
|
|
|
0+8000 \<_start\>:
|
|
8000: 9400000c bl 8030 \<.*>
|
|
|
|
0+8004 \<hidfn\>:
|
|
8004: 8a000000 and x0, x0, x0
|
|
|
|
0+8008 \<bar\>:
|
|
8008: 14000001 b 800c \<foo\>
|
|
|
|
0+800c \<foo\>:
|
|
800c: 97fffffe bl 8004 \<hidfn\>
|
|
|
|
Disassembly of section .plt:
|
|
|
|
0+8010 \<\.plt\>:
|
|
8010: a9bf7bf0 stp x16, x30, \[sp, #-16\]!
|
|
8014: b0000010 adrp x16, 9000 .*
|
|
8018: f9400e11 ldr x17, \[x16, #24\]
|
|
801c: 91006210 add x16, x16, #0x18
|
|
8020: d61f0220 br x17
|
|
8024: d503201f nop
|
|
8028: d503201f nop
|
|
802c: d503201f nop
|
|
8030: b0000010 adrp x16, 9000 .*
|
|
8034: f9401211 ldr x17, \[x16, #32\]
|
|
8038: 91008210 add x16, x16, #0x20
|
|
803c: d61f0220 br x17
|