bfd/
authorJulian Brown <julian@codesourcery.com>
Thu, 28 Feb 2013 10:31:34 +0000 (10:31 +0000)
committerJulian Brown <julian@codesourcery.com>
Thu, 28 Feb 2013 10:31:34 +0000 (10:31 +0000)
    * elf32-arm.c (elf32_arm_size_dynamic_sections): Don't call
    elf32_arm_allocate_dynrelocs for source reloc for non-dynamic link.

    ld/testsuite/
    * ld-arm/tls-local-static.s: New test.
    * ld-arm/tls-local-static.d: New.
    * ld-arm/arm-elf.exp (tls-local-static): Add test.

bfd/ChangeLog
bfd/elf32-arm.c
ld/testsuite/ChangeLog
ld/testsuite/ld-arm/arm-elf.exp
ld/testsuite/ld-arm/tls-local-static.d [new file with mode: 0644]
ld/testsuite/ld-arm/tls-local-static.s [new file with mode: 0644]

index 27746f20f21dbdd08f8744864d3db0effbb6531a..93ad3cc789317e7383826d7b07fdcfe76b9c2992 100644 (file)
@@ -1,3 +1,8 @@
+2013-02-28  Nathan Sidwell  <nathan@codesourcery.com>
+
+       * elf32-arm.c (elf32_arm_size_dynamic_sections): Don't call
+       elf32_arm_allocate_dynrelocs for source reloc for non-dynamic link.
+
 2013-02-27  DJ Delorie  <dj@redhat.com>
 
        * reloc.c (BFD_RELOC_RL78_CODE): Add.
index cf5bc6db2c8b68c7dc7c5b2c1143e4107bc29a54..aba1814f8555933f8a98da214bd9708336da6000 100644 (file)
@@ -13648,14 +13648,18 @@ elf32_arm_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED,
                  && (local_iplt == NULL
                      || local_iplt->arm.noncall_refcount == 0))
                elf32_arm_allocate_irelocs (info, srel, 1);
-             else if ((info->shared && !(*local_tls_type & GOT_TLS_GDESC))
-                      || *local_tls_type & GOT_TLS_GD)
-               elf32_arm_allocate_dynrelocs (info, srel, 1);
-
-             if (info->shared && *local_tls_type & GOT_TLS_GDESC)
+             else if (info->shared || output_bfd->flags & DYNAMIC)
                {
-                 elf32_arm_allocate_dynrelocs (info, htab->root.srelplt, 1);
-                 htab->tls_trampoline = -1;
+                 if ((info->shared && !(*local_tls_type & GOT_TLS_GDESC))
+                     || *local_tls_type & GOT_TLS_GD)
+                   elf32_arm_allocate_dynrelocs (info, srel, 1);
+                 
+                 if (info->shared && *local_tls_type & GOT_TLS_GDESC)
+                   {
+                     elf32_arm_allocate_dynrelocs (info,
+                                                   htab->root.srelplt, 1);
+                     htab->tls_trampoline = -1;
+                   }
                }
            }
          else
index 07a01a894a137115a62c0f4efd2abbe2e04183de..0db8fe702ada35adf7d56c1bda343f87c643423a 100644 (file)
@@ -1,4 +1,10 @@
-013-02-21  H.J. Lu  <hongjiu.lu@intel.com>
+2013-02-28  Nathan Sidwell  <nathan@codesourcery.com>
+
+       * ld-arm/tls-local-static.s: New test.
+       * ld-arm/tls-local-static.d: New.
+       * ld-arm/arm-elf.exp (tls-local-static): Add test.
+
+2013-02-21  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR ld/15167
        * ld-unique/unique.exp: Add a test for shared library with
index 414bc6925d3aad29cacf201c4aec2f7cecd84ba7..d9375ecb980d63e4c6db9a172ef70ed92e42e414 100644 (file)
@@ -142,6 +142,9 @@ set armelftests_common {
     {"TLS descseq relaxation BE32" "-T arm-dyn.ld -EB" "" "-mbig-endian" {tls-descrelax-be32.s}
      {{objdump -fdw tls-descrelax-be32.d}}
      "tls-descrelax-be32"}
+    {"TLS local PIC symbol static link" "-T arm.ld" "" "" {tls-local-static.s}
+      {{objdump -fdw tls-local-static.d}}
+      "tls-local-static"}
     {"Thumb entry point" "-T arm.ld" "" "" {thumb-entry.s}
      {{readelf -h thumb-entry.d}}
      "thumb-entry"}
diff --git a/ld/testsuite/ld-arm/tls-local-static.d b/ld/testsuite/ld-arm/tls-local-static.d
new file mode 100644 (file)
index 0000000..d246ab1
--- /dev/null
@@ -0,0 +1,11 @@
+
+.*/tls-local-static:     file format elf32-.*arm.*
+architecture: .*, flags 0x[0-9a-f]+:
+EXEC_P, HAS_SYMS, D_PAGED
+start address 0x[0-9a-f]+
+
+Disassembly of section .text:
+
+[0-9a-f]+ <_start>:
+    [0-9a-f]+: e12fff1e        bx      lr
+    [0-9a-f]+: 00000ff8        .word   0x00000ff8
diff --git a/ld/testsuite/ld-arm/tls-local-static.s b/ld/testsuite/ld-arm/tls-local-static.s
new file mode 100644 (file)
index 0000000..15a409a
--- /dev/null
@@ -0,0 +1,15 @@
+       .text
+       .arch armv4t
+       .global _start
+_start:
+.LPIC0:        
+       bx lr
+       .align  2
+       .word   var(tlsgd) + (. - .LPIC0 - 8)
+
+       .section        .tbss,"awT",%nobits
+       .align  2
+       .type   var, %object
+       .size   var, 4
+var:
+       .space  4