aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzabolcs Nagy <szabolcs.nagy@arm.com>2019-10-02 19:46:46 +0100
committerSzabolcs Nagy <szabolcs.nagy@arm.com>2019-10-10 12:11:33 +0100
commitb094948c0943c996460cbc9ab3c14207dc520445 (patch)
tree221893fb09df694f8310355cdeafe98c3e5f898c /bfd/elf32-arm.c
parent[PR ld/25062] arm: sign extend the addend of R_ARM_TLS_GOTDESC (diff)
downloadbinutils-gdb-b094948c0943c996460cbc9ab3c14207dc520445.tar.gz
binutils-gdb-b094948c0943c996460cbc9ab3c14207dc520445.tar.bz2
binutils-gdb-b094948c0943c996460cbc9ab3c14207dc520445.zip
[PR ld/22263][PR ld/25056] arm: Avoid dynamic TLS relocs in PIE
Dynamic relocs are only needed in an executable for TLS symbols if those are defined in an external module and even then TLS access can be relaxed to use IE model instead of GD. Several bfd_link_pic checks are turned into bfd_link_dll checks to fix TLS handling in PIE, for the same fix some other targets used !bfd_link_executable checks, but that includes relocatable objects so dll seems safer (in most cases either should work, since dynamic relocations are not applied in relocatable objects). On arm* fixes FAIL: Build pr22263-1 bfd/ PR ld/22263 PR ld/25056 * elf32-arm.c (elf32_arm_tls_transition): Use bfd_link_dll instead of bfd_link_pic for TLS checks. (elf32_arm_final_link_relocate): Likewise. (allocate_dynrelocs_for_symbol): Likewise.
Diffstat (limited to 'bfd/elf32-arm.c')
-rw-r--r--bfd/elf32-arm.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index ff9a5ef604d..cce796dafd9 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -4911,7 +4911,7 @@ elf32_arm_tls_transition (struct bfd_link_info *info, int r_type,
{
int is_local = (h == NULL);
- if (bfd_link_pic (info)
+ if (bfd_link_dll (info)
|| (h && h->root.type == bfd_link_hash_undefweak))
return r_type;
@@ -11697,7 +11697,7 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
{
/* If we don't know the module number, create a relocation
for it. */
- if (bfd_link_pic (info))
+ if (bfd_link_dll (info))
{
Elf_Internal_Rela outrel;
@@ -11801,7 +11801,7 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
now, and emit any relocations. If both an IE GOT and a
GD GOT are necessary, we emit the GD first. */
- if ((bfd_link_pic (info) || indx != 0)
+ if ((bfd_link_dll (info) || indx != 0)
&& (h == NULL
|| (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
&& !resolved_to_zero)
@@ -11818,7 +11818,7 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
/* We should have relaxed, unless this is an undefined
weak symbol. */
BFD_ASSERT ((h && (h->root.type == bfd_link_hash_undefweak))
- || bfd_link_pic (info));
+ || bfd_link_dll (info));
BFD_ASSERT (globals->sgotplt_jump_table_size + offplt + 8
<= globals->root.sgotplt->size);
@@ -16491,7 +16491,7 @@ allocate_dynrelocs_for_symbol (struct elf_link_hash_entry *h, void * inf)
indx = h->dynindx;
if (tls_type != GOT_NORMAL
- && (bfd_link_pic (info) || indx != 0)
+ && (bfd_link_dll (info) || indx != 0)
&& (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|| h->root.type != bfd_link_hash_undefweak))
{