summaryrefslogtreecommitdiff
path: root/bfd/elfxx-aarch64.h
diff options
context:
space:
mode:
authorTamar Christina <tamar.christina@arm.com>2019-08-22 11:35:35 +0100
committerTamar Christina <tamar.christina@arm.com>2019-08-28 09:35:10 +0100
commit6795dba28d531a17a0800d532d555653415702bb (patch)
treec8a407cc04c5fabe7a3b091408f60c8e947825f0 /bfd/elfxx-aarch64.h
parent8f254d8183a0c35d46fea419c67b52c89271f478 (diff)
downloadbinutils-gdb-6795dba28d531a17a0800d532d555653415702bb.tar.gz
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. (cherry picked from commit 652afeef247770b22c44ca292d1f4c65be40a696)
Diffstat (limited to 'bfd/elfxx-aarch64.h')
-rw-r--r--bfd/elfxx-aarch64.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/bfd/elfxx-aarch64.h b/bfd/elfxx-aarch64.h
index 1f9ce09675f..02e91d216fd 100644
--- a/bfd/elfxx-aarch64.h
+++ b/bfd/elfxx-aarch64.h
@@ -40,8 +40,8 @@ _bfd_aarch64_elf_put_addend (bfd *, bfd_byte *, bfd_reloc_code_real_type,
reloc_howto_type *, bfd_signed_vma);
extern bfd_vma
-_bfd_aarch64_elf_resolve_relocation (bfd_reloc_code_real_type, bfd_vma, bfd_vma,
- bfd_vma, bfd_boolean);
+_bfd_aarch64_elf_resolve_relocation (bfd *, bfd_reloc_code_real_type, bfd_vma,
+ bfd_vma, bfd_vma, bfd_boolean);
extern bfd_boolean
_bfd_aarch64_elf_grok_prstatus (bfd *, Elf_Internal_Note *);