2011-05-31 Paul Brook <paul@codesourcery.com>
authorPaul Brook <paul@codesourcery.com>
Tue, 31 May 2011 13:37:27 +0000 (13:37 +0000)
committerPaul Brook <paul@codesourcery.com>
Tue, 31 May 2011 13:37:27 +0000 (13:37 +0000)
bfd/
* elf32-arm.c (arm_stub_is_thumb): Add
arm_stub_long_branch_v4t_thumb_tls_pic.
(elf32_arm_final_link_relocate): TLS stubs are always ARM.
Handle Thumb stubs.

ld/testsuite/
* ld-arm/tls-longplt.d: Update expected output.
* ld-arm/tls-thumb1.d: Ditto.

bfd/ChangeLog
bfd/elf32-arm.c
ld/testsuite/ChangeLog
ld/testsuite/ld-arm/tls-longplt.d
ld/testsuite/ld-arm/tls-thumb1.d

index a66e8964eaad58b3d6ba11da0e948f8748bdab1e..8cd4935eff43c2cbd9ddb669f11d221c914b08f8 100644 (file)
@@ -1,3 +1,10 @@
+2011-05-31  Paul Brook  <paul@codesourcery.com>
+
+       * elf32-arm.c (arm_stub_is_thumb): Add
+       arm_stub_long_branch_v4t_thumb_tls_pic.
+       (elf32_arm_final_link_relocate): TLS stubs are always ARM.
+       Handle Thumb stubs.
+
 2011-05-27  Nick Clifton  <nickc@redhat.com>
 
        PR binutils/12710
index 671a20996ee2ef2287be0dcbf43859a3fd229676..611e08ed1420306652c8e80a081f45715c1326d7 100644 (file)
@@ -3427,6 +3427,7 @@ arm_stub_is_thumb (enum elf32_arm_stub_type stub_type)
     case arm_stub_long_branch_v4t_thumb_arm:
     case arm_stub_short_branch_v4t_thumb_arm:
     case arm_stub_long_branch_v4t_thumb_arm_pic:
+    case arm_stub_long_branch_v4t_thumb_tls_pic:
     case arm_stub_long_branch_thumb_only_pic:
       return TRUE;
     case arm_stub_none:
@@ -9304,6 +9305,9 @@ elf32_arm_final_link_relocate (reloc_howto_type *           howto,
            || ELF32_R_TYPE(rel->r_info) == R_ARM_THM_TLS_CALL)
          {
            bfd_signed_vma offset;
+           /* TLS stubs are arm mode.  The original symbol is a
+              data object, so branch_type is bogus.  */
+           branch_type = ST_BRANCH_TO_ARM;
            enum elf32_arm_stub_type stub_type
              = arm_type_of_stub (info, input_section, rel,
                                  st_type, &branch_type,
@@ -9348,16 +9352,25 @@ elf32_arm_final_link_relocate (reloc_howto_type *           howto,
                           input_section->output_offset
                           + rel->r_offset + 4);
            
-               /* Round up the offset to a word boundary */
-               offset = (offset + 2) & ~2;
+               if (stub_type != arm_stub_none
+                   && arm_stub_is_thumb (stub_type))
+                 {
+                   lower_insn = 0xd000;
+                 }
+               else
+                 {
+                   lower_insn = 0xc000;
+                   /* Round up the offset to a word boundary */
+                   offset = (offset + 2) & ~2;
+                 }
+
                neg = offset < 0;
                upper_insn = (0xf000
                              | ((offset >> 12) & 0x3ff)
                              | (neg << 10));
-               lower_insn = (0xc000
-                             | (((!((offset >> 23) & 1)) ^ neg) << 13)
+               lower_insn |= (((!((offset >> 23) & 1)) ^ neg) << 13)
                              | (((!((offset >> 22) & 1)) ^ neg) << 11)
-                             | ((offset >> 1) & 0x7ff));
+                             | ((offset >> 1) & 0x7ff);
                bfd_put_16 (input_bfd, upper_insn, hit_data);
                bfd_put_16 (input_bfd, lower_insn, hit_data + 2);
                return bfd_reloc_ok;
index d3bafcc552adde50f96c09302b2fc29285ef2e6f..a652cdeee088dce74cf461e4dbe745a0c5998bf6 100644 (file)
@@ -1,3 +1,8 @@
+2011-05-31  Paul Brook  <paul@codesourcery.com>
+
+       * ld-arm/tls-longplt.d: Update expected output.
+       * ld-arm/tls-thumb1.d: Ditto.
+
 2011-05-26  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR ld/12809
index 8729e742067995d816ea0cc2a69be688cd0eddea..175c56179a6b4b75c3f887a7f7cb271388598984 100644 (file)
@@ -47,7 +47,7 @@ Disassembly of section .foo:
  4001018:      e1a00000        nop                     ; .*
  400101c:      fc00f2a0        .word   0xfc00f2a0
  4001020:      4801            ldr     r0, \[pc, #4\]  ; .*
- 4001022:      f000 e80a       blx     4001038 .*
+ 4001022:      f000 f809       bl      4001038 .*
  4001026:      46c0            nop                     ; .*
  4001028:      fc00f291        .word   0xfc00f291
  400102c:      00000000        .word   0x00000000
index 26b65bb52c5876961af28964975db18650fa5eb3..ad2a512c947ab063cb113fe1701aada877ef4daa 100644 (file)
@@ -31,7 +31,7 @@ Disassembly of section .text:
     81b0:      e1a00000        nop                     ; .*
     81b4:      000080c0        .word   0x000080c0
     81b8:      4801            ldr     r0, \[pc, #4\]  ; .*
-    81ba:      f000 e806       blx     81c8 .*
+    81ba:      f000 f805       bl      81c8 .*
     81be:      46c0            nop                     ; .*
     81c0:      000080b1        .word   0x000080b1
     81c4:      00000000        .word   0x00000000
@@ -55,7 +55,7 @@ Disassembly of section .foo:
  4001018:      e1a00000        nop                     ; .*
  400101c:      fc00f260        .word   0xfc00f260
  4001020:      4801            ldr     r0, \[pc, #4\]  ; .*
- 4001022:      f000 e80c       blx     400103c .*
+ 4001022:      f000 f80b       bl      400103c .*
  4001026:      46c0            nop                     ; .*
  4001028:      fc00f249        .word   0xfc00f249
  400102c:      00000000        .word   0x00000000
This page took 0.033606 seconds and 4 git commands to generate.