This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb] [PR ld/22263] aarch64: Avoid dynamic TLS relocs in PIE
- From: Szabolcs Nagy <nsz at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 27 Nov 2017 11:53:55 -0000
- Subject: [binutils-gdb] [PR ld/22263] aarch64: Avoid dynamic TLS relocs in PIE
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=6dda7875a8021787f11bd95a69d81a079e408a57
commit 6dda7875a8021787f11bd95a69d81a079e408a57
Author: Szabolcs Nagy <szabolcs.nagy@arm.com>
Date: Wed Nov 15 17:40:04 2017 +0000
[PR ld/22263] aarch64: Avoid dynamic TLS relocs in PIE
No dynamic relocs are needed for TLS defined in an executable, the
TP relative offset is known at link time.
Fixes
FAIL: Build pr22263-1
bfd/
PR ld/22263
* elfnn-aarch64.c (elfNN_aarch64_relocate_section): Use
bfd_link_executable instead of bfd_link_pic for TLS.
(elfNN_aarch64_allocate_dynrelocs): Likewise.
(aarch64_can_relax_tls): Likewise.
Diff:
---
bfd/ChangeLog | 8 ++++++++
bfd/elfnn-aarch64.c | 8 ++++----
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 46c2a59..3903b1d 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,13 @@
2017-11-27 Szabolcs Nagy <szabolcs.nagy@arm.com>
+ PR ld/22263
+ * elfnn-aarch64.c (elfNN_aarch64_relocate_section): Use
+ bfd_link_executable instead of bfd_link_pic for TLS.
+ (elfNN_aarch64_allocate_dynrelocs): Likewise.
+ (aarch64_can_relax_tls): Likewise.
+
+2017-11-27 Szabolcs Nagy <szabolcs.nagy@arm.com>
+
PR ld/22269
* elfnn-aarch64.c (elfNN_aarch64_finish_dynamic_symbol): Use
UNDEFWEAK_NO_DYNAMIC_RELOC to avoid dynamic GOT relocs.
diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
index 7571a16..ed402bb 100644
--- a/bfd/elfnn-aarch64.c
+++ b/bfd/elfnn-aarch64.c
@@ -4580,7 +4580,7 @@ aarch64_can_relax_tls (bfd *input_bfd,
if (symbol_got_type == GOT_TLS_IE && GOT_TLS_GD_ANY_P (reloc_got_type))
return TRUE;
- if (bfd_link_pic (info))
+ if (!bfd_link_executable (info))
return FALSE;
if (h && h->root.type == bfd_link_hash_undefweak)
@@ -6247,7 +6247,7 @@ elfNN_aarch64_relocate_section (bfd *output_bfd,
indx = h && h->dynindx != -1 ? h->dynindx : 0;
need_relocs =
- (bfd_link_pic (info) || indx != 0) &&
+ (!bfd_link_executable (info) || indx != 0) &&
(h == NULL
|| ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|| h->root.type != bfd_link_hash_undefweak);
@@ -6342,7 +6342,7 @@ elfNN_aarch64_relocate_section (bfd *output_bfd,
indx = h && h->dynindx != -1 ? h->dynindx : 0;
need_relocs =
- (bfd_link_pic (info) || indx != 0) &&
+ (!bfd_link_executable (info) || indx != 0) &&
(h == NULL
|| ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|| h->root.type != bfd_link_hash_undefweak);
@@ -8057,7 +8057,7 @@ elfNN_aarch64_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
indx = h && h->dynindx != -1 ? h->dynindx : 0;
if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|| h->root.type != bfd_link_hash_undefweak)
- && (bfd_link_pic (info)
+ && (!bfd_link_executable (info)
|| indx != 0
|| WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h)))
{