Set DF_STATIC_TLS for PIEs
authorAlan Modra <amodra@gmail.com>
Wed, 2 Jul 2014 04:34:21 +0000 (14:04 +0930)
committerAlan Modra <amodra@gmail.com>
Wed, 2 Jul 2014 04:34:21 +0000 (14:04 +0930)
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
bfd/elf32-ppc.c
bfd/elf64-ppc.c

index 44ce84655dc009870da9bf81ab9fe48caf327c79..9eb3edaf80a1c6b659c8917608fc08fac40c0594 100644 (file)
@@ -1,3 +1,8 @@
+2014-07-02  Alan Modra  <amodra@gmail.com>
+
+       * 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  <amodra@gmail.com>
 
        * bfd.c (struct bfd): Reorganise for better packing.  Delete
index c4a95433b342533fa2034d3ca04d86aa3c997f1b..0a9c8f996f7fc7cd765c77b67244e849f5e54ad0 100644 (file)
@@ -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;
 
index 267a9253163df760d540197522809990b690050b..81e54a76f7038d05dc8b7edb0ca57c46fa52e1f9 100644 (file)
@@ -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;