binutils-gdb/ld/testsuite
Tamar Christina 652afeef24 AArch64: Fix LD crash on weak and undefined TLS symbols. (PR/24602).
This patch fixes a few linker crashes due to TLS code reaching an assert when it
shouldn't.

The first scenario is with weak TLS symbols that remain weak during linking.  In
this case the mid-end would not have seen a TLS symbol and so wouldn't have
allocated the TLS section.  We currently assert here and the linker crashes with
a not very useful message.

This patch changes this to return the value 0 for the TLS symbol in question
emulating what lld and gold and other BFD targets do.  However because weak TLS
is implementation defined and we don't define any behavior for it I also emit a
warning to the user to inform them of such.

Secondly when a strong TLS reference is undefined. The linker crashes even after
it correctly reported that there is an undefined reference.  This changes it so
that it gracefully exits and reports a useful error.

bfd/ChangeLog:

	PR ld/24601
	* elfnn-aarch64.c (aarch64_relocate): Handle weak TLS and undefined TLS.
	Also Pass input_bfd to _bfd_aarch64_elf_resolve_relocation.
	* elfxx-aarch64.c (_bfd_aarch64_elf_resolve_relocation): Use it.
	* elfxx-aarch64.h (_bfd_aarch64_elf_resolve_relocation): Emit warning
	for weak TLS.

ld/ChangeLog:

	PR ld/24601
	* testsuite/ld-aarch64/aarch64-elf.exp (undef-tls, weak-tls): New.
	* testsuite/ld-aarch64/undef-tls.d: New test.
	* testsuite/ld-aarch64/undef-tls.s: New test.
	* testsuite/ld-aarch64/weak-tls.d: New test.
	* testsuite/ld-aarch64/weak-tls.s: New test.
2019-08-22 11:43:15 +01:00
..
config
ld-aarch64 AArch64: Fix LD crash on weak and undefined TLS symbols. (PR/24602). 2019-08-22 11:43:15 +01:00
ld-alpha Fix alpha testsuite regression 2019-06-14 10:23:20 +09:30
ld-arc [ARC] Add linker relaxation. 2019-07-24 16:33:29 +03:00
ld-arm Arm: Fix performance issue with thumb-2 tailcalls 2019-08-20 16:35:28 +01:00
ld-auto-import
ld-avr Fix PR 24571 - Relaxation does not shorten jmp or call to target at pc-relative range boundary 2019-05-21 12:48:06 +05:30
ld-bootstrap
ld-bpf ld: use a specific linker script in BPF targets 2019-08-07 13:57:30 +02:00
ld-cdtest
ld-checks
ld-cris Dynamic TLS section symbols 2019-07-13 09:57:50 +09:30
ld-crx
ld-csky
ld-cygwin
ld-d10v
ld-discard Support tcl procedure calls in run_dump_test xfail 2019-05-30 00:52:08 +09:30
ld-elf Add support for a MIPS specific .MIPS.xhash section. 2019-08-09 11:06:37 +01:00
ld-elfcomm
ld-elfvers
ld-elfvsb
ld-elfweak
ld-fastcall
ld-frv
ld-gc
ld-h8300
ld-i386 Change the output of readelf's note display so that the "Data size" column header is left justified. 2019-08-08 17:04:31 +01:00
ld-ia64
ld-ifunc
ld-libs
ld-linkonce
ld-m68hc11
ld-m68k
ld-mep
ld-metag
ld-mips-elf Add support for a MIPS specific .MIPS.xhash section. 2019-08-09 11:06:37 +01:00
ld-misc
ld-mmix
ld-mn10300
ld-msp430-elf
ld-nds32
ld-nios2
ld-or1k
ld-pe
ld-pie
ld-plugin Ajdust lto-3r and lto-5r tests for powerpc64 2019-07-26 10:02:34 +09:30
ld-powerpc PowerPC tlsie test fix 2019-08-02 12:41:05 +09:30
ld-pru
ld-riscv-elf RISC-V: Fix lui relaxation issue with code at address 0. 2019-08-15 12:01:13 -07:00
ld-s12z
ld-s390 Dynamic TLS section symbols 2019-07-13 09:57:50 +09:30
ld-scripts Move ld-scripts size tests 2019-07-23 18:22:01 +09:30
ld-selective
ld-sh
ld-shared
ld-size
ld-sparc Dynamic TLS section symbols 2019-07-13 09:57:50 +09:30
ld-spu
ld-srec ld: use a specific linker script in BPF targets 2019-08-07 13:57:30 +02:00
ld-tic6x
ld-tilegx
ld-tilepro
ld-undefined ld: use a specific linker script in BPF targets 2019-08-07 13:57:30 +02:00
ld-unique
ld-v850
ld-vax-elf
ld-visium
ld-vxworks
ld-x86-64 x86-64: Move PIC check for PC-relative relocations back 2019-08-16 14:25:58 -07:00
ld-xc16x
ld-xstormy16
ld-xtensa
ld-z8k
lib s12z genelf.em 2019-05-30 01:01:42 +09:30
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