binutils-gdb/ld/testsuite/ld-aarch64
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
..
aarch64-elf.exp AArch64: Fix LD crash on weak and undefined TLS symbols. (PR/24602). 2019-08-22 11:43:15 +01:00
aarch64.ld
bti-pac-plt-1.d [LD, AArch64] Move ELF options behind -z 2019-06-06 12:21:14 +01:00
bti-pac-plt-2.d [LD, AArch64] Move ELF options behind -z 2019-06-06 12:21:14 +01:00
bti-plt-1.d [LD, AArch64] Move ELF options behind -z 2019-06-06 12:21:14 +01:00
bti-plt-1.s [BFD, AArch64, x86] Improve warning for --force-bti 2019-03-21 16:20:21 +00:00
bti-plt-2.d 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
bti-plt-2.s [BFD, LD, AArch64, 2/3] Add --force-bti to enable BTI and to select BTI enabled PLTs 2019-03-13 11:47:07 +00:00
bti-plt-3.d [LD, AArch64] Move ELF options behind -z 2019-06-06 12:21:14 +01:00
bti-plt-4.d 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
bti-plt-5.d [BFD, AArch64] Improve bti/pac plts. 2019-04-25 11:37:25 +01:00
bti-plt-6.d 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
bti-plt-7.d 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
bti-plt-so.s [BFD, LD, AArch64, 2/3] Add --force-bti to enable BTI and to select BTI enabled PLTs 2019-03-13 11:47:07 +00:00
bti-plt.ld [BFD, LD, AArch64, 2/3] Add --force-bti to enable BTI and to select BTI enabled PLTs 2019-03-13 11:47:07 +00:00
bti-warn.d 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
copy-reloc-2.d
copy-reloc-eliminate.d
copy-reloc-exe-2.s
copy-reloc-exe-eliminate.s
copy-reloc-exe.s
copy-reloc-so.s
copy-reloc.d
dt_textrel.d
dt_textrel.s
eh-frame-bar.s
eh-frame-foo.s
eh-frame.d
emit-relocs1.s
emit-relocs-22.d Add R_AARCH64_P32_MOVW_PREL_* ELF32 relocs 2019-06-14 12:02:19 +01:00
emit-relocs-22.s Add R_AARCH64_P32_MOVW_PREL_* ELF32 relocs 2019-06-14 12:02:19 +01:00
emit-relocs-23.d Add R_AARCH64_P32_MOVW_PREL_* ELF32 relocs 2019-06-14 12:02:19 +01:00
emit-relocs-23.s Add R_AARCH64_P32_MOVW_PREL_* ELF32 relocs 2019-06-14 12:02:19 +01:00
emit-relocs-28.d
emit-relocs-28.s
emit-relocs-86-overflow.d
emit-relocs-86-overflow.s
emit-relocs-86.d
emit-relocs-86.s
emit-relocs-87.d
emit-relocs-87.s
emit-relocs-88-overflow.d
emit-relocs-88-overflow.s
emit-relocs-88.d
emit-relocs-88.s
emit-relocs-89.d
emit-relocs-89.s
emit-relocs-90-overflow.d
emit-relocs-90-overflow.s
emit-relocs-90.d
emit-relocs-90.s
emit-relocs-92.d
emit-relocs-92.s
emit-relocs-112-overflow.d
emit-relocs-112-overflow.s
emit-relocs-112.d
emit-relocs-112.s
emit-relocs-113.d
emit-relocs-113.s
emit-relocs-114-overflow.d
emit-relocs-114-overflow.s
emit-relocs-114.d
emit-relocs-114.s
emit-relocs-115.d
emit-relocs-115.s
emit-relocs-116-overflow.d
emit-relocs-116-overflow.s
emit-relocs-116.d
emit-relocs-116.s
emit-relocs-117.d
emit-relocs-117.s
emit-relocs-118-overflow.d
emit-relocs-118-overflow.s
emit-relocs-118.d
emit-relocs-118.s
emit-relocs-119.d
emit-relocs-119.s
emit-relocs-257-be.d
emit-relocs-257.d
emit-relocs-257.s
emit-relocs-258-dyn-bad.d
emit-relocs-258.s
emit-relocs-259-dyn-bad.d
emit-relocs-259.s
emit-relocs-260-be.d
emit-relocs-260.d
emit-relocs-260.s
emit-relocs-262.d
emit-relocs-262.s
emit-relocs-263.d
emit-relocs-263.s
emit-relocs-264-bad.d
emit-relocs-264.d
emit-relocs-264.s
emit-relocs-265.d
emit-relocs-265.s
emit-relocs-266-bad.d
emit-relocs-266.d
emit-relocs-266.s
emit-relocs-267.d
emit-relocs-267.s
emit-relocs-268-bad.d
emit-relocs-268.d
emit-relocs-268.s
emit-relocs-269-bad.d
emit-relocs-269.d
emit-relocs-269.s
emit-relocs-270-bad.d
emit-relocs-270-overflow.d
emit-relocs-270-overflow.s
emit-relocs-270.d
emit-relocs-270.s
emit-relocs-271-overflow.d
emit-relocs-271-overflow.s
emit-relocs-271.d
emit-relocs-271.s
emit-relocs-272-overflow.d
emit-relocs-272-overflow.s
emit-relocs-272.d
emit-relocs-272.s
emit-relocs-273.d
emit-relocs-273.s
emit-relocs-274.d
emit-relocs-274.s
emit-relocs-275.d
emit-relocs-275.s
emit-relocs-276.d
emit-relocs-276.s
emit-relocs-277.d
emit-relocs-277.s
emit-relocs-278.d
emit-relocs-278.s
emit-relocs-279-bad.d
emit-relocs-279.d
emit-relocs-279.s
emit-relocs-280.d
emit-relocs-280.s
emit-relocs-282.d
emit-relocs-282.s
emit-relocs-283.d
emit-relocs-283.s
emit-relocs-284.d
emit-relocs-284.s
emit-relocs-285.d
emit-relocs-285.s
emit-relocs-286-bad.d
emit-relocs-286.d
emit-relocs-286.s
emit-relocs-287-overflow.d
emit-relocs-287-overflow.s
emit-relocs-287.d
emit-relocs-287.s
emit-relocs-288.d
emit-relocs-288.s
emit-relocs-289-overflow.d
emit-relocs-289-overflow.s
emit-relocs-289.d
emit-relocs-289.s
emit-relocs-290.d
emit-relocs-290.s
emit-relocs-291-overflow.d
emit-relocs-291-overflow.s
emit-relocs-291.d
emit-relocs-291.s
emit-relocs-292.d
emit-relocs-292.s
emit-relocs-293.d
emit-relocs-293.s
emit-relocs-299.d
emit-relocs-299.s
emit-relocs-301-be.d
emit-relocs-301.d
emit-relocs-301.s
emit-relocs-302-be.d
emit-relocs-302.d
emit-relocs-302.s
emit-relocs-309-low-bad.d
emit-relocs-309-low.d
emit-relocs-309-up-bad.d
emit-relocs-309-up.d
emit-relocs-309.s
emit-relocs-310-be.d
emit-relocs-310.d
emit-relocs-310.s
emit-relocs-311.d
emit-relocs-311.s
emit-relocs-312.d
emit-relocs-312.s
emit-relocs-313.d
emit-relocs-313.s
emit-relocs-515-be.d
emit-relocs-515.d
emit-relocs-515.s
emit-relocs-516-be.d
emit-relocs-516.d
emit-relocs-516.s
emit-relocs-523.d
emit-relocs-523.s
emit-relocs-524.d
emit-relocs-524.s
emit-relocs-525.d
emit-relocs-525.s
emit-relocs-526-overflow.d
emit-relocs-526-overflow.s
emit-relocs-526.d
emit-relocs-526.s
emit-relocs-527.d
emit-relocs-527.s
emit-relocs-528-overflow.d
emit-relocs-528-overflow.s
emit-relocs-528.d
emit-relocs-528.s
emit-relocs-529-overflow.d
emit-relocs-529-overflow.s
emit-relocs-529.d
emit-relocs-529.s
emit-relocs-530.d
emit-relocs-530.s
emit-relocs-531-overflow.d
emit-relocs-531-overflow.s
emit-relocs-531.d
emit-relocs-531.s
emit-relocs-532.d
emit-relocs-532.s
emit-relocs-533-overflow.d
emit-relocs-533-overflow.s
emit-relocs-533.d
emit-relocs-533.s
emit-relocs-534.d
emit-relocs-534.s
emit-relocs-535-overflow.d
emit-relocs-535-overflow.s
emit-relocs-535.d
emit-relocs-535.s
emit-relocs-536.d
emit-relocs-536.s
emit-relocs-537-overflow.d
emit-relocs-537-overflow.s
emit-relocs-537.d
emit-relocs-537.s
emit-relocs-538.d
emit-relocs-538.s
emit-relocs-552-overflow.d
emit-relocs-552-overflow.s
emit-relocs-552.d
emit-relocs-552.s
emit-relocs-553.d
emit-relocs-553.s
emit-relocs-554-overflow.d
emit-relocs-554-overflow.s
emit-relocs-554.d
emit-relocs-554.s
emit-relocs-555.d
emit-relocs-555.s
emit-relocs-556-overflow.d
emit-relocs-556-overflow.s
emit-relocs-556.d
emit-relocs-556.s
emit-relocs-557.d
emit-relocs-557.s
emit-relocs-558-overflow.d
emit-relocs-558-overflow.s
emit-relocs-558.d
emit-relocs-558.s
emit-relocs-559.d
emit-relocs-559.s
emit-relocs-local-addend-bar.s
emit-relocs-local-addend-foo.s
emit-relocs-local-addend.d
erratum835769.d
erratum835769.s
erratum843419_tls_ie.d
erratum843419_tls_ie.s
erratum843419-adr.d AArch64: Implement choice between Cortex-A53 erratum workarounds. (PR ld/24373) 2019-05-21 13:05:22 +01:00
erratum843419-adrp.d AArch64: Implement choice between Cortex-A53 erratum workarounds. (PR ld/24373) 2019-05-21 13:05:22 +01:00
erratum843419-far-adr.d AArch64: Implement choice between Cortex-A53 erratum workarounds. (PR ld/24373) 2019-05-21 13:05:22 +01:00
erratum843419-far-full.d AArch64: Implement choice between Cortex-A53 erratum workarounds. (PR ld/24373) 2019-05-21 13:05:22 +01:00
erratum843419-far.s AArch64: Implement choice between Cortex-A53 erratum workarounds. (PR ld/24373) 2019-05-21 13:05:22 +01:00
erratum843419-full.d AArch64: Implement choice between Cortex-A53 erratum workarounds. (PR ld/24373) 2019-05-21 13:05:22 +01:00
erratum843419-near.s AArch64: Implement choice between Cortex-A53 erratum workarounds. (PR ld/24373) 2019-05-21 13:05:22 +01:00
erratum843419-no-args.d AArch64: Implement choice between Cortex-A53 erratum workarounds. (PR ld/24373) 2019-05-21 13:05:22 +01:00
erratum843419.d
erratum843419.s
farcall-b-defsym.d
farcall-b-defsym.s
farcall-b-gsym.d
farcall-b-gsym.s
farcall-b-none-function.d
farcall-b-none-function.s
farcall-b-plt.d
farcall-b-plt.s
farcall-b-section.d
farcall-b-section.s
farcall-b.d
farcall-b.s
farcall-back-be.d
farcall-back.d
farcall-back.s
farcall-bl-defsym.d
farcall-bl-defsym.s
farcall-bl-none-function.d
farcall-bl-none-function.s
farcall-bl-plt.d
farcall-bl-plt.s
farcall-bl-section.d
farcall-bl-section.s
farcall-bl.d
farcall-bl.s
func-in-so.s
func-sym-hash-opt.d
func-sym-hash-opt.s
gc-got-relocs.d
gc-plt1.s
gc-plt2.s
gc-plt-hidden.s
gc-plt-main.s
gc-plt-relocs.d
gc-relocs-257-dyn.d
gc-relocs-257.d
gc-relocs-257.s
gc-relocs-309.s
gc-relocs-311.s
gc-relocs-312.s
gc-relocs-tlsdesc.s
gc-relocs-tlsgd.s
gc-relocs-tlsie.s
gc-relocs-tlsle.s
gc-start.s
gc-tls-relocs.d
ifunc-1-local.d
ifunc-1-local.s
ifunc-1.d
ifunc-1.s
ifunc-2-local.d
ifunc-2-local.s
ifunc-2.d
ifunc-2.s
ifunc-3.s
ifunc-3a.d
ifunc-3b.d
ifunc-4.d
ifunc-4.s
ifunc-4a.d
ifunc-5-local.s
ifunc-5.s
ifunc-5a-local.d
ifunc-5a.d
ifunc-5b-local.d
ifunc-5b.d
ifunc-5r-local.d
ifunc-6.s
ifunc-6a.d
ifunc-6b.d
ifunc-7.s
ifunc-7a.d
ifunc-7b.d
ifunc-7c.d
ifunc-8.d
ifunc-8a.s
ifunc-8b.s
ifunc-9.d
ifunc-9.s
ifunc-10.d
ifunc-10.s
ifunc-11.d
ifunc-11.s
ifunc-12.d
ifunc-12.s
ifunc-13.d
ifunc-13a.s
ifunc-13b.s
ifunc-14a.d
ifunc-14a.s
ifunc-14b.d
ifunc-14b.s
ifunc-14c.d
ifunc-14c.s
ifunc-14d.d
ifunc-14e.d
ifunc-14f.d
ifunc-15.d
ifunc-15.s
ifunc-16.d
ifunc-16.s
ifunc-17a.d
ifunc-17a.s
ifunc-17b.d
ifunc-17b.s
ifunc-18a.d
ifunc-18a.s
ifunc-18b.d
ifunc-18b.s
ifunc-19a.d
ifunc-19a.s
ifunc-19b.d
ifunc-19b.s
ifunc-20.d
ifunc-20.s
ifunc-21.d
ifunc-21.s
ifunc-22.d
ifunc-22.s
implicit_got_section_1.d
implicit_got_section_1.s
limit-b.d
limit-b.s
limit-bl.d
limit-bl.s
local-addend-r.d
pac-plt-1.d [LD, AArch64] Move ELF options behind -z 2019-06-06 12:21:14 +01:00
pac-plt-2.d [LD, AArch64] Move ELF options behind -z 2019-06-06 12:21:14 +01:00
pcrel_pic_defined.d
pcrel_pic_undefined.d
pcrel.s
pie-bind-locally-a.s
pie-bind-locally-b.s
pie-bind-locally.d
plt_mapping_symbol.d
plt_mapping_symbol.s
pr17415.d
pr17415.s
pr20402.d
pr20402.s
pr22764.d
pr22764.s
property-bti-pac1.d 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
property-bti-pac1.s [BFD, LD, AArch64, 1/3] Add support for GNU PROPERTIES in AArch64 for BTI and PAC 2019-03-13 11:47:00 +00:00
property-bti-pac2.d 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
property-bti-pac2.s [BFD, LD, AArch64, 1/3] Add support for GNU PROPERTIES in AArch64 for BTI and PAC 2019-03-13 11:47:00 +00:00
property-bti-pac3.d 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
property-bti-pac4-a.d [BFD, AArch64] Fix PT_GNU_PROPERTY alignment issue 2019-06-06 12:27:41 +01:00
property-bti-pac4-b.d [BFD, AArch64] Fix PT_GNU_PROPERTY alignment issue 2019-06-06 12:27:41 +01:00
property-bti-pac4.s [BFD, AArch64] Fix PT_GNU_PROPERTY alignment issue 2019-06-06 12:27:41 +01:00
protected-data.d
protected-data.s
rela-abs-relative-be.d
rela-abs-relative-opt.d
rela-abs-relative.d
rela-abs-relative.s
relasz.d
relasz.s
reloc-overflow-1.s
reloc-overflow-2.s
reloc-overflow-bad.d
relocs-1027-symbolic-func.d
relocs-1027-symbolic-func.s
relocs-ilp32.ld
relocs.ld
tls-desc-ie-ilp32.d
tls-desc-ie.d
tls-desc-ie.s
tls-large-desc-be.d
tls-large-desc.d
tls-large-desc.s
tls-large-ie-be.d
tls-large-ie.d
tls-large-ie.s
tls-relax-all-ilp32.d
tls-relax-all.d
tls-relax-all.s
tls-relax-gd-ie-ilp32.d
tls-relax-gd-ie.d
tls-relax-gd-ie.s
tls-relax-gd-le-ilp32.d
tls-relax-gd-le.d
tls-relax-gd-le.s
tls-relax-gdesc-ie-2.d
tls-relax-gdesc-ie-2.s
tls-relax-gdesc-ie.d
tls-relax-gdesc-ie.s
tls-relax-gdesc-le-2-ilp32.d
tls-relax-gdesc-le-2.d
tls-relax-gdesc-le-2.s
tls-relax-gdesc-le-ilp32.d
tls-relax-gdesc-le-now.d AArch64: When DF_BIND_NOW don't use TLSDESC GOT value. 2019-04-11 11:30:03 +01:00
tls-relax-gdesc-le.d
tls-relax-gdesc-le.s
tls-relax-ie-le-2-ilp32.d
tls-relax-ie-le-2.d
tls-relax-ie-le-2.s
tls-relax-ie-le-3-ilp32.d
tls-relax-ie-le-3.d
tls-relax-ie-le-3.s
tls-relax-ie-le-ilp32.d
tls-relax-ie-le.d
tls-relax-ie-le.s
tls-relax-large-desc-ie-be.d
tls-relax-large-desc-ie.d
tls-relax-large-desc-ie.s
tls-relax-large-desc-le-be.d
tls-relax-large-desc-le.d
tls-relax-large-desc-le.s
tls-relax-large-gd-ie-be.d
tls-relax-large-gd-ie.d
tls-relax-large-gd-ie.s
tls-relax-large-gd-le-be.d
tls-relax-large-gd-le.d
tls-relax-large-gd-le.s
tls-relax-ld-le-small-ilp32.d
tls-relax-ld-le-small.d
tls-relax-ld-le-small.s
tls-relax-ld-le-tiny-ilp32.d
tls-relax-ld-le-tiny.d
tls-relax-ld-le-tiny.s
tls-small-ld.d
tls-small-ld.s
tls-tiny-desc-ie-ilp32.d
tls-tiny-desc-ie.d
tls-tiny-desc-ie.s
tls-tiny-desc-le-ilp32.d
tls-tiny-desc-le.d
tls-tiny-desc-le.s
tls-tiny-desc.d
tls-tiny-desc.s
tls-tiny-gd-ie-ilp32.d
tls-tiny-gd-ie.d
tls-tiny-gd-ie.s
tls-tiny-gd-le-ilp32.d
tls-tiny-gd-le.d
tls-tiny-gd-le.s
tls-tiny-gd.d
tls-tiny-gd.s
tls-tiny-ie.d
tls-tiny-ie.s
tls-tiny-ld.d
tls-tiny-ld.s
tlsle-symbol-offset.d
tlsle-symbol-offset.s
tlsle.d
tlsle.s
tprel_add_lo12_overflow.d
tprel_add_lo12_overflow.s
tprel_g2_overflow.d
tprel_g2_overflow.s
undef-tls.d AArch64: Fix LD crash on weak and undefined TLS symbols. (PR/24602). 2019-08-22 11:43:15 +01:00
undef-tls.s AArch64: Fix LD crash on weak and undefined TLS symbols. (PR/24602). 2019-08-22 11:43:15 +01:00
variant_pcs-1.s aarch64: handle STO_AARCH64_VARIANT_PCS in bfd 2019-05-24 15:11:00 +01:00
variant_pcs-2.s aarch64: handle STO_AARCH64_VARIANT_PCS in bfd 2019-05-24 15:11:00 +01:00
variant_pcs-now.d aarch64: fix variant_pcs ld tests 2019-05-28 12:03:51 +01:00
variant_pcs-r.d aarch64: handle STO_AARCH64_VARIANT_PCS in bfd 2019-05-24 15:11:00 +01:00
variant_pcs-shared.d aarch64: fix variant_pcs ld tests 2019-05-28 12:03:51 +01:00
variant_pcs.ld aarch64: handle STO_AARCH64_VARIANT_PCS in bfd 2019-05-24 15:11:00 +01:00
weak-tls.d AArch64: Fix LD crash on weak and undefined TLS symbols. (PR/24602). 2019-08-22 11:43:15 +01:00
weak-tls.s AArch64: Fix LD crash on weak and undefined TLS symbols. (PR/24602). 2019-08-22 11:43:15 +01:00
weak-undefined.d
weak-undefined.s