From afb933145e2869c73c08db0995171d0d2e5b6296 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Wed, 2 Jul 2014 14:04:21 +0930 Subject: [PATCH] Set DF_STATIC_TLS for PIEs If we can dlopen an object then DF_STATIC_TLS is relevant. * elf32-ppc.c (ppc_elf_check_relocs): Set DF_STATIC_TLS for PIEs too. * elf64-ppc.c (ppc64_elf_check_relocs): Likewise. --- bfd/ChangeLog | 5 +++++ bfd/elf32-ppc.c | 4 ++-- bfd/elf64-ppc.c | 7 +++---- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 44ce84655dc..9eb3edaf80a 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2014-07-02 Alan Modra + + * elf32-ppc.c (ppc_elf_check_relocs): Set DF_STATIC_TLS for PIEs too. + * elf64-ppc.c (ppc64_elf_check_relocs): Likewise. + 2014-07-01 Alan Modra * bfd.c (struct bfd): Reorganise for better packing. Delete diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index c4a95433b34..0a9c8f996f7 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -4017,7 +4017,7 @@ ppc_elf_check_relocs (bfd *abfd, case R_PPC_GOT_TPREL16_LO: case R_PPC_GOT_TPREL16_HI: case R_PPC_GOT_TPREL16_HA: - if (!info->executable) + if (info->shared) info->flags |= DF_STATIC_TLS; tls_type = TLS_TLS | TLS_TPREL; goto dogottls; @@ -4308,7 +4308,7 @@ ppc_elf_check_relocs (bfd *abfd, case R_PPC_TPREL16_LO: case R_PPC_TPREL16_HI: case R_PPC_TPREL16_HA: - if (!info->executable) + if (info->shared) info->flags |= DF_STATIC_TLS; goto dodyn; diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index 267a9253163..81e54a76f70 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -5328,7 +5328,7 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, case R_PPC64_GOT_TPREL16_LO_DS: case R_PPC64_GOT_TPREL16_HI: case R_PPC64_GOT_TPREL16_HA: - if (!info->executable) + if (info->shared) info->flags |= DF_STATIC_TLS; tls_type = TLS_TLS | TLS_TPREL; goto dogottls; @@ -5558,7 +5558,7 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, case R_PPC64_TPREL64: tls_type = TLS_EXPLICIT | TLS_TLS | TLS_TPREL; - if (!info->executable) + if (info->shared) info->flags |= DF_STATIC_TLS; goto dotlstoc; @@ -5636,8 +5636,7 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, case R_PPC64_TPREL16_HIGHESTA: if (info->shared) { - if (!info->executable) - info->flags |= DF_STATIC_TLS; + info->flags |= DF_STATIC_TLS; goto dodyn; } break; -- 2.30.2