binutils-gdb/ld/emultempl
H.J. Lu 496afd1705 elf: Add -z unique-symbol to avoid duplicated local symbol names
The symbol string table in the .symtab section is optional and cosmetic.
The contents of the .symtab section have no impact on run-time execution.
The symbol names in the symbol string table help distinguish addresses at
different locations.  Add a linker option, -z unique-symbol, to avoid
duplicated local symbol names in the symbol string table.

This feature was well received by the livepatch maintainers.  It not only
solves the duplicated local symbol name problem, but also would allow
livepatch to more precisely locate duplicate symbols in general for
patching.

bfd/

	PR ld/26391
	* elflink.c (elf_final_link_info): Add local_hash_table.
	(local_hash_entry): New.
	(local_hash_newfunc): Likewise.
	(elf_link_output_symstrtab): Append ".COUNT" to duplicated local
	symbols.
	(bfd_elf_final_link): Initialize and free local_hash_table for
	"-z unique-symbol".

include/

	PR ld/26391
	* bfdlink.h (bfd_link_info): Add unique_symbol.

ld/

	PR ld/26391
	* NEWS: Mention "-z unique-symbol".
	* emultempl/elf.em (gld${EMULATION_NAME}_handle_option): Handle
	"-z unique-symbol" and "-z nounique-symbol".
	* ld.texi: Document "-z unique-symbol" and "-z nounique-symbol".
	* lexsup.c (elf_static_list_options): Add "-z unique-symbol" and
	"-z nounique-symbol".
	* testsuite/ld-elf/elf.exp: Add PR ld/26391 tests.
	* testsuite/ld-elf/pr26391.nd: New file.
	* testsuite/ld-elf/pr26391.out: Likewise.
	* testsuite/ld-elf/pr26391a.c: Likewise.
	* testsuite/ld-elf/pr26391b.c: Likewise.
	* testsuite/ld-elf/pr26391c.c: Likewise.
	* testsuite/ld-elf/pr26391d.c: Likewise.
2020-09-12 05:37:43 -07:00
..
aarch64elf.em
aix.em
alphaelf.em
arclinux.em
armcoff.em
armelf.em
astring.sed
avrelf.em
beos.em
bfin.em
cr16elf.em
crxelf.em
cskyelf.em
elf-generic.em
elf-x86.em
elf.em elf: Add -z unique-symbol to avoid duplicated local symbol names 2020-09-12 05:37:43 -07:00
epiphanyelf_4x4.em
genelf.em
generic.em
hppaelf.em
ia64elf.em
irix.em
linux.em
m68hc1xelf.em
m68kelf.em
metagelf.em
mipself.em
mmix-elfnmmo.em
mmixelf.em
mmo.em
msp430.em MSP430: Fix alignment of __*_array_start symbols in default linker script 2020-08-28 14:01:10 +01:00
nds32elf.em
needrelax.em
netbsd.em
nios2elf.em
ostring.sed
pdp11.em
pe.em Fix a segfault when creating an import library with 0 exports. 2020-09-11 17:51:16 +01:00
pep.em Fix a segfault when creating an import library with 0 exports. 2020-09-11 17:51:16 +01:00
ppc32elf.em
ppc64elf.em PowerPC64 --no-pcrel-optimize 2020-08-13 08:10:18 +09:30
pruelf.em
README
riscvelf.em
rxelf.em
rxlinux.em
s390.em
scoreelf.em
solaris2-x86.em
solaris2.em
spu_icache.o_c
spu_icache.S
spu_ovl.o_c
spu_ovl.S
spuelf.em PR26499 UBSAN: eelf32_spu.c:537 member access null pointer 2020-08-26 23:23:45 +09:30
tic6xdsbt.em
ticoff.em
v850elf.em
vanilla.em
vms.em
vxworks.em
xtensaelf.em
z80.em

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

The files in this directory are sourced by genscripts.sh, after
setting some variables to substitute in, to produce
C source files that contain jump tables for each emulation.

Copyright (C) 2012-2020 Free Software Foundation, Inc.

Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.