binutils-gdb/ld/testsuite
Alan Modra 7ba115508a PR26580, Size and alignment of commons vs as-needed shared lib
Two pieces to this puzzle:
1) Revert HJ's fix for PR13250 so that size and alignment isn't
   sticky, instead attack the real underlying problem that
   _bfd_generic_link_add_one_symbol does the wrong thing in making a
   common section in a shared library bfd.
2) Save and restore common u.c.p fields, which hold the section and
   alignment.

A better fix for (2) would be to throw away all of that horrible code
saving and restoring the hash table when loading as-needed library
symbols, and instead do a scan over as-needed library symbols before
adding anything.

bfd/
	PR 13250
	PR 26580
	* elflink.c (_bfd_elf_merge_symbol): Make "override" a bfd**.
	Return oldbfd in override when old common should override new
	common.
	(_bfd_elf_add_default_symbol): Adjust to suit.
	(elf_link_add_object_symbols): Likewise.  Pass "override" to
	_bfd_generic_link_add_one_symbol.  Save and restore common u.c.p
	field for --as-needed shared libraries.  Revert pr13250 changes.
ld/
	* testsuite/ld-elf/pr26580-a.s,
	* testsuite/ld-elf/pr26580-b.s,
	* testsuite/ld-elf/pr26580-1.sd,
	* testsuite/ld-elf/pr26580-2.sd: New tests
	* testsuite/ld-elf/comm-data.exp: Run new tests.
	* testsuite/ld-elf/pr26580-a.c,
	* testsuite/ld-elf/pr26580-b.c,
	* testsuite/ld-elf/pr26580-3.out,
	* testsuite/ld-elf/pr26580-4.out: New tests.
	* testsuite/ld-elf/shared.exp: Run new tests.
2020-09-08 22:30:38 +09:30
..
config ld: Change NOSANTIZE_CFLAGS to NOSANITIZE_CFLAGS 2020-09-03 17:17:19 -07:00
ld-aarch64
ld-alpha Remove commit 9fb2400ce6 2020-08-27 13:52:45 +01:00
ld-arc
ld-arm AArch64: Relax thumb-plt testcases regexpr. 2020-08-14 07:52:00 +01:00
ld-auto-import
ld-avr
ld-bootstrap
ld-bpf bpf: add missing tests from previous commits 2020-08-07 20:40:01 +02:00
ld-cdtest
ld-checks
ld-cris
ld-crx
ld-csky CSKY: Support attribute section. 2020-08-28 17:23:24 +08:00
ld-ctf binutils, ld: dequote libctf error messages 2020-08-27 13:16:39 +01:00
ld-cygwin
ld-d10v
ld-discard
ld-dynamic
ld-elf PR26580, Size and alignment of commons vs as-needed shared lib 2020-09-08 22:30:38 +09:30
ld-elfcomm ld: Change NOSANTIZE_CFLAGS to NOSANITIZE_CFLAGS 2020-09-03 17:17:19 -07:00
ld-elfvers ld: Change NOSANTIZE_CFLAGS to NOSANITIZE_CFLAGS 2020-09-03 17:17:19 -07:00
ld-elfvsb ld: Change NOSANTIZE_CFLAGS to NOSANITIZE_CFLAGS 2020-09-03 17:17:19 -07:00
ld-elfweak ld: Change NOSANTIZE_CFLAGS to NOSANITIZE_CFLAGS 2020-09-03 17:17:19 -07:00
ld-fastcall
ld-frv
ld-gc ld: Change NOSANTIZE_CFLAGS to NOSANITIZE_CFLAGS 2020-09-03 17:17:19 -07:00
ld-h8300
ld-i386
ld-ia64
ld-ifunc ld: Add -fno-lto to linker tests 2020-07-31 07:57:04 -07:00
ld-libs tic54x ld testsuite 2020-08-25 19:31:57 +09:30
ld-linkonce
ld-m68hc11
ld-m68k
ld-mep
ld-metag
ld-mips-elf MIPS: Make the IRIX naming of local section symbols consistent 2020-07-29 20:56:41 +01:00
ld-misc More just-syms changes 2020-07-28 13:09:20 +09:30
ld-mmix
ld-mn10300
ld-msp430-elf MSP430: Fix alignment of __*_array_start symbols in default linker script 2020-08-28 14:01:10 +01:00
ld-nds32
ld-nios2
ld-or1k
ld-pdp11
ld-pe Change the default characteristics of DLLs built by the linker to more secure settings. 2020-08-27 12:58:27 +01:00
ld-pie
ld-plugin Allow plugin syms to mark as-needed shared libs needed 2020-09-04 14:06:44 +09:30
ld-powerpc PowerPC TPREL_HA/LO optimisation 2020-08-24 21:15:06 +09:30
ld-pru
ld-riscv-elf RISC-V: Minor cleanup and typos when merging elf attributes. 2020-09-03 11:12:02 +08:00
ld-s12z
ld-s390
ld-scripts ld: Change NOSANTIZE_CFLAGS to NOSANITIZE_CFLAGS 2020-09-03 17:17:19 -07:00
ld-selective ld: Change NOSANTIZE_CFLAGS to NOSANITIZE_CFLAGS 2020-09-03 17:17:19 -07:00
ld-sh
ld-shared ld: Change NOSANTIZE_CFLAGS to NOSANITIZE_CFLAGS 2020-09-03 17:17:19 -07:00
ld-size ld: Change NOSANTIZE_CFLAGS to NOSANITIZE_CFLAGS 2020-09-03 17:17:19 -07:00
ld-sparc sparc testsuite fallout 2020-08-24 21:48:16 +09:30
ld-spu
ld-srec ld: Change NOSANTIZE_CFLAGS to NOSANITIZE_CFLAGS 2020-09-03 17:17:19 -07:00
ld-tic6x
ld-tilegx
ld-tilepro
ld-undefined
ld-unique
ld-v850
ld-vax-elf
ld-visium
ld-vxworks
ld-x86-64 ld: Change NOSANTIZE_CFLAGS to NOSANITIZE_CFLAGS 2020-09-03 17:17:19 -07:00
ld-xc16x
ld-xstormy16
ld-xtensa
ld-z8k
ld-z80
lib Fixes for testsuite failures introduced by the changes made for PR 19011. 2020-08-28 09:43:13 +01:00
ChangeLog-2004
ChangeLog-2005
ChangeLog-2006
ChangeLog-2007
ChangeLog-2008
ChangeLog-2009
ChangeLog-2010
ChangeLog-2011
ChangeLog-2012
ChangeLog-2013
ChangeLog-2014
ChangeLog-2015
ChangeLog-9303