]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
2005-03-29 Julian Brown <julian@codesourcery.com>
authorPaul Brook <paul@codesourcery.com>
Tue, 29 Mar 2005 15:00:26 +0000 (15:00 +0000)
committerPaul Brook <paul@codesourcery.com>
Tue, 29 Mar 2005 15:00:26 +0000 (15:00 +0000)
* elf32-arm.c (elf32_arm_final_link_relocate): Use blx to get to
symbian plt entries from thumb mode.

ChangeLog.csl
bfd/elf32-arm.c

index 2437c62166944ad741b3600188c8fcc8771014e3..b32d247b1d845f5e64ca57c9f116142d7055d8f8 100644 (file)
@@ -1,3 +1,8 @@
+2005-03-29  Julian Brown  <julian@codesourcery.com>
+
+       * elf32-arm.c (elf32_arm_final_link_relocate): Use blx to get to
+       symbian plt entries from thumb mode.
+
 2005-03-28  Daniel Jacobowitz  <dan@codesourcery.com>
            Phil Blundell  <philb@gnu.org>
 
index 3648015c83fa71104435b0d1e7d7f612a7bf44d7..7a2afe9cbaed3f3256aa2cc883f7239d3444da0e 100644 (file)
@@ -2851,6 +2851,7 @@ elf32_arm_final_link_relocate (reloc_howto_type *           howto,
        bfd_signed_vma reloc_signed_min = ~ reloc_signed_max;
        bfd_vma check;
        bfd_signed_vma signed_check;
+       bfd_boolean thumb_plt_call = FALSE;
 
        /* Need to refetch the addend and squish the two 11 bit pieces
           together.  */
@@ -2900,8 +2901,20 @@ elf32_arm_final_link_relocate (reloc_howto_type *           howto,
            value = (splt->output_section->vma
                     + splt->output_offset
                     + h->plt.offset);
-           /* Target the Thumb stub before the ARM PLT entry.  */
-           value -= 4;
+           if (globals->symbian_p)
+             {
+               /* On SymbianOS, we are guaranteed to be using at least ARMv5t.
+                  Convert the BL to a BLX instruction to call the ARM-mode PLT
+                  entry.  */
+               if ((lower_insn & (0x3 << 11)) == 0x3 << 11)
+                 {
+                   lower_insn = (lower_insn & ~(0x3 << 11)) | 0x1 << 11;
+                   thumb_plt_call = TRUE;
+                 }
+             }
+           else
+             /* Target the Thumb stub before the ARM PLT entry.  */
+             value -= PLT_THUMB_STUB_SIZE;
            *unresolved_reloc_p = FALSE;
          }
 
@@ -2925,8 +2938,9 @@ elf32_arm_final_link_relocate (reloc_howto_type *           howto,
          overflow = TRUE;
 
 #ifndef OLD_ARM_ABI
-       if (r_type == R_ARM_THM_XPC22
-           && ((lower_insn & 0x1800) == 0x0800))
+       if ((r_type == R_ARM_THM_XPC22
+            && ((lower_insn & 0x1800) == 0x0800))
+           || thumb_plt_call)
          /* For a BLX instruction, make sure that the relocation is rounded up
             to a word boundary.  This follows the semantics of the instruction
             which specifies that bit 1 of the target address will come from bit