binutils-gdb/ld/testsuite
Maciej W. Rozycki 0fcf331bb1 VAX/BFD: Do not warn about GOT addend mismatches if no GOT entry is made
Match the condition used in `elf_vax_instantiate_got_entries' for the
creation of GOT entries in the processing of R_VAX_GOT32 relocations in
`elf_vax_check_relocs', removing incorrect warnings about a GOT addend
mismatch like:

./ld-new: tmpdir/got-local-ref-off-r.o: warning: GOT addend of 1 to `bar_hidden' does not match previous GOT addend of 0
./ld-new: tmpdir/got-local-ref-off-r.o: warning: GOT addend of 2 to `bar_hidden' does not match previous GOT addend of 0

and corresponding failures with the test cases newly added here:

FAIL: GOT test (executable hidden reference with offset)
FAIL: GOT test (executable visible reference with offset)

for symbols that are considered local for reasons other than having been
forced local with a version script, which is usually the ELF visibility.
Correct code is produced regardless, but the warning breaks `-Werror'
compilation and may upset people regardless.

Interestingly this shows with executable links only, because in shared
library links code from `elf_link_add_object_symbols' triggers:

	    /* If the symbol already has a dynamic index, but
	       visibility says it should not be visible, turn it into
	       a local symbol.  */
	    switch (ELF_ST_VISIBILITY (h->other))
	      {
	      case STV_INTERNAL:
	      case STV_HIDDEN:
		(*bed->elf_backend_hide_symbol) (info, h, TRUE);
		dynsym = FALSE;
		break;
	      }

that sets `h->forced_local' like with a version script.

Add suitable test cases including disassembly to verify correct code has
been produced where no warnings have been issued, and that warnings do
get issued where necessary.  Do not verify (broken) code produced in the
latter case; we should probably make the warning an error, or preferably
actually start supporting GOT references with different addends as they
appear feasible with explicitly relocated GOT that we use.

	bfd/
	* elf32-vax.c (elf_vax_check_relocs) <R_VAX_GOT32>: Use
	SYMBOL_REFERENCES_LOCAL rather than `h->forced_local' to check
	whether the symbol referred is local or not.

	ld/
	* testsuite/ld-vax-elf/got-local-exe-off-hidden.dd: New test
	dump.
	* testsuite/ld-vax-elf/got-local-exe-off-visible.dd: New test
	dump.
	* testsuite/ld-vax-elf/got-local-lib-off-hidden.dd: New test
	dump.
	* testsuite/ld-vax-elf/got-local-lib-off-visible.ed: New test
	dump.
	* testsuite/ld-vax-elf/got-local-off-external.ed: New test dump.
	* testsuite/ld-vax-elf/got-local-exe-off.xd: New test dump.
	* testsuite/ld-vax-elf/got-local-lib-off.xd: New test dump.
	* testsuite/ld-vax-elf/got-local.ld: New test linker script.
	* testsuite/ld-vax-elf/got-local-aux-off.s: New test source.
	* testsuite/ld-vax-elf/got-local-def-off.s: New test source.
	* testsuite/ld-vax-elf/got-local-ref-off-external.s: New test
	source.
	* testsuite/ld-vax-elf/got-local-ref-off-hidden.s: New test
	source.
	* testsuite/ld-vax-elf/got-local-ref-off-visible.s: New test
	source.
	* testsuite/ld-vax-elf/vax-elf.exp: Run the new tests.
2020-12-05 11:18:14 +00:00
..
config ld: Set plug_opt only if compiler is available 2020-10-23 11:25:15 -07:00
ld-aarch64
ld-alpha
ld-arc ld: Make ARC's tls_ie-01 test more flexible 2020-11-23 12:25:44 +02:00
ld-arm
ld-auto-import
ld-avr
ld-bootstrap ld: Skip bootstrap tests for -fprofile-generate= 2020-10-22 07:03:59 -07:00
ld-bpf
ld-cdtest
ld-checks Provide dummy libraries for alpha-vms 2020-10-19 16:28:43 +10:30
ld-cris
ld-crx
ld-csky CSKY: Change default linker script for elf toolchain. 2020-10-26 17:13:21 +08:00
ld-ctf libctf, ld: properly deduplicate function types 2020-11-20 13:34:10 +00:00
ld-cygwin
ld-d10v
ld-discard
ld-dynamic
ld-elf PR26978, Inconsistency for strong foo@v1 and weak foo@@v1 2020-12-04 11:06:52 +10:30
ld-elfcomm ld: Pass -fno-lto to non LTO tests 2020-10-22 06:04:36 -07:00
ld-elfvers ld: Pass -fno-lto to non LTO tests 2020-10-22 06:04:36 -07:00
ld-elfvsb ld: Pass -fno-lto to non LTO tests 2020-10-22 06:04:36 -07:00
ld-elfweak ld: Pass -fno-lto in ld-elfweak/elfweak.exp 2020-10-26 16:45:35 -07:00
ld-fastcall
ld-frv
ld-gc ld: Pass -fno-lto to non LTO tests 2020-10-22 06:04:36 -07:00
ld-h8300
ld-i386 elf: Set rel_from_abs to 1 for __ehdr_start 2020-11-13 15:44:47 -08:00
ld-ia64
ld-ifunc
ld-libs
ld-linkonce
ld-m68hc11
ld-m68k
ld-mep
ld-metag
ld-mips-elf
ld-misc
ld-mmix
ld-mn10300
ld-msp430-elf
ld-nds32
ld-nios2
ld-or1k
ld-pdp11
ld-pe
ld-pie
ld-plugin PR26806, Suspected linker bug with LTO 2020-11-02 09:39:53 +10:30
ld-powerpc PowerPC paranioa testing of symbol merging involving comdat groups 2020-11-18 23:49:31 +10:30
ld-pru
ld-riscv-elf RISC-V: Relax PCREL to GPREL while doing other relaxations is dangerous. 2020-11-21 09:41:58 +08:00
ld-s12z
ld-s390 IBM Z: Add support for HLASM extended mnemonics 2020-12-03 16:51:12 +01:00
ld-scripts Extend ld's -Map=<dir> functionality by allowing '%' to be replaced with the output file path. 2020-11-06 14:36:45 +00:00
ld-selective ld: Pass -fno-lto to non LTO tests 2020-10-22 06:04:36 -07:00
ld-sh
ld-shared
ld-size
ld-sparc
ld-spu
ld-srec ld: Pass -fno-lto to non LTO tests 2020-10-22 06:04:36 -07:00
ld-tic6x
ld-tilegx
ld-tilepro
ld-undefined PR26882, --enable-textrel-check=warning test failures on powerpc 2020-11-17 20:59:53 +10:30
ld-unique
ld-v850
ld-vax-elf VAX/BFD: Do not warn about GOT addend mismatches if no GOT entry is made 2020-12-05 11:18:14 +00:00
ld-visium
ld-vxworks
ld-x86-64 x86-64: Convert load to mov only for GOTPCRELX relocations 2020-12-04 18:54:47 -08:00
ld-xc16x
ld-xstormy16
ld-xtensa
ld-z8k
ld-z80
lib ld: Pass -fno-lto to non LTO tests 2020-10-22 06:04:36 -07: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