2011-05-31 Paul Brook <paul@codesourcery.com>
authorPaul Brook <paul@codesourcery.com>
Tue, 31 May 2011 14:07:58 +0000 (14:07 +0000)
committerPaul Brook <paul@codesourcery.com>
Tue, 31 May 2011 14:07:58 +0000 (14:07 +0000)
bfd/
* elf32-arm.c (elf32_arm_final_link_relocate): Only do bl conversion
for known functions.
(elf32_arm_swap_symbol_in): Only set ST_BRANCH_TO_ARM for function
symbols.

include/elf/
* arm.h (arm_st_branch_type): Add ST_BRANCH_UNKNOWN.

ld/testsuite/
* ld-arm/cortex-a8-far.d: Adjust expected output.
* ld-arm/arm-call1.s: Give function symbol correct type.
* ld-arm/arm-call2.s: Ditto.
* ld-arm/farcall-group4.s: Ditto.
* ld-arm/arm-elf.exp (cortex-a8-far): Define far symbols with correct
type via assembly file.
* ld-arm/cortex-a8-far-3.s: New file.
* ld-arm/abs-call-1.s: Add Thumb tests

12 files changed:
bfd/ChangeLog
bfd/elf32-arm.c
include/elf/ChangeLog
include/elf/arm.h
ld/testsuite/ChangeLog
ld/testsuite/ld-arm/abs-call-1.d
ld/testsuite/ld-arm/abs-call-1.s
ld/testsuite/ld-arm/arm-call1.s
ld/testsuite/ld-arm/arm-call2.s
ld/testsuite/ld-arm/arm-elf.exp
ld/testsuite/ld-arm/cortex-a8-far-3.s [new file with mode: 0644]
ld/testsuite/ld-arm/farcall-group4.s

index 8cd4935eff43c2cbd9ddb669f11d221c914b08f8..5701e71fd4edfc348a03f58b106c9e1da1070e61 100644 (file)
@@ -1,3 +1,10 @@
+2011-05-31  Paul Brook  <paul@codesourcery.com>
+
+       * elf32-arm.c (elf32_arm_final_link_relocate): Only do bl conversion
+       for known functions.
+       (elf32_arm_swap_symbol_in): Only set ST_BRANCH_TO_ARM for function
+       symbols.
+
 2011-05-31  Paul Brook  <paul@codesourcery.com>
 
        * elf32-arm.c (arm_stub_is_thumb): Add
index 611e08ed1420306652c8e80a081f45715c1326d7..58bb367780b6a20a7f69d63c4df4aa087d7aeeca 100644 (file)
@@ -8304,7 +8304,7 @@ elf32_arm_final_link_relocate (reloc_howto_type *           howto,
                     case, mode switching is performed by the stub.  */
                  if (branch_type == ST_BRANCH_TO_THUMB && !stub_entry)
                    value |= (1 << 28);
-                 else
+                 else if (stub_entry || branch_type != ST_BRANCH_UNKNOWN)
                    {
                      value &= ~(bfd_vma)(1 << 28);
                      value |= (1 << 24);
@@ -15131,12 +15131,16 @@ elf32_arm_swap_symbol_in (bfd * abfd,
 
   /* New EABI objects mark thumb function symbols by setting the low bit of
      the address.  */
-  if ((ELF_ST_TYPE (dst->st_info) == STT_FUNC
-       || ELF_ST_TYPE (dst->st_info) == STT_GNU_IFUNC)
-      && (dst->st_value & 1))
+  if (ELF_ST_TYPE (dst->st_info) == STT_FUNC
+      || ELF_ST_TYPE (dst->st_info) == STT_GNU_IFUNC)
     {
-      dst->st_value &= ~(bfd_vma) 1;
-      dst->st_target_internal = ST_BRANCH_TO_THUMB;
+      if (dst->st_value & 1)
+       {
+         dst->st_value &= ~(bfd_vma) 1;
+         dst->st_target_internal = ST_BRANCH_TO_THUMB;
+       }
+      else
+       dst->st_target_internal = ST_BRANCH_TO_ARM;
     }
   else if (ELF_ST_TYPE (dst->st_info) == STT_ARM_TFUNC)
     {
@@ -15146,7 +15150,7 @@ elf32_arm_swap_symbol_in (bfd * abfd,
   else if (ELF_ST_TYPE (dst->st_info) == STT_SECTION)
     dst->st_target_internal = ST_BRANCH_LONG;
   else
-    dst->st_target_internal = ST_BRANCH_TO_ARM;
+    dst->st_target_internal = ST_BRANCH_UNKNOWN;
 
   return TRUE;
 }
index a43b34d91bc67b7667ced3fb809bf5a710ee3ee6..d0700468bcddc5cae1b3dc97618ebb5e8fa8c820 100644 (file)
@@ -1,3 +1,7 @@
+2011-05-31  Paul Brook  <paul@codesourcery.com>
+
+       * arm.h (arm_st_branch_type): Add ST_BRANCH_UNKNOWN.
+
 2011-04-15  Sergio Durigan Junior  <sergiodj@redhat.com>
 
        * common.h (NT_STAPSDT): New define.
index 5b01835a74ade3e55eabd1451875f6dba10c546a..860fdf77afbc440061a5c2885927f9cb61c80327 100644 (file)
@@ -328,7 +328,8 @@ enum
 enum arm_st_branch_type {
   ST_BRANCH_TO_ARM,
   ST_BRANCH_TO_THUMB,
-  ST_BRANCH_LONG
+  ST_BRANCH_LONG,
+  ST_BRANCH_UNKNOWN
 };
 
 #define ARM_SYM_BRANCH_TYPE(SYM) \
index 586356e5c431d490312604049d89b17dd1d63560..5c645bca5944fc99ec32c8e49d55a634298a277e 100644 (file)
@@ -1,3 +1,14 @@
+2011-05-31  Paul Brook  <paul@codesourcery.com>
+
+       * ld-arm/cortex-a8-far.d: Adjust expected output.
+       * ld-arm/arm-call1.s: Give function symbol correct type.
+       * ld-arm/arm-call2.s: Ditto.
+       * ld-arm/farcall-group4.s: Ditto.
+       * ld-arm/arm-elf.exp (cortex-a8-far): Define far symbols with correct
+       type via assembly file.
+       * ld-arm/cortex-a8-far-3.s: New file.
+       * ld-arm/abs-call-1.s: Add Thumb tests
+
 2011-05-31  Paul Brook  <paul@codesourcery.com>
        Nathan Sidwell  <nathan@codesourcery.com>
 
index 4482beba529a407487fffbca0aa4a60467da478a..7214e3a6f9a63560d787d6d08a58bfef3116fcb9 100644 (file)
@@ -6,4 +6,9 @@ Disassembly of section .text:
 00008000 <arm>:
     8000:      eb03dffe        bl      100000 <foo>
     8004:      ea03dffd        b       100000 <foo>
-    8008:      eb03dffc        bl      100000 <foo>
+    8008:      fa03dffc        blx     100000 <foo>
+    800c:      eb03dffb        bl      100000 <foo>
+00008010 <thumb>:
+    8010:      f0f7 fff6       bl      100000 <foo>
+    8014:      f0f7 bff4       b\.w    100000 <foo>
+    8018:      f0f7 eff2       blx     100000 <foo>
index c0a66b467404cee4487eadb2b60d8072978aebf0..ab1ac3d83832b78a7adbc64fe24f646d2c6d7723 100644 (file)
@@ -4,5 +4,12 @@
 
 arm:   bl      0x100000
        b       0x100000
+       blx     0x100000
        bl      foo
 
+       .syntax unified
+       .thumb
+thumb: bl      0x100000
+       b       0x100000
+       blx     0x100000
+       @ bl foo is broken - gas fails to preserve the symbol reference
index e6ea1f2ec5c4463b1c5fcc74e92c0b01cff862de..e4ab1c25a2509d127e0fccebca846253f7d0d1e2 100644 (file)
@@ -2,6 +2,7 @@
        .text
        .arch armv5t
        .global _start
+       .type _start, %function
 _start:
        bl arm
        bl t1
index 30ae349572a2ebab86ddd779678288e46e69f051..02aa379a3e02aab4589a535483b760072b76a84b 100644 (file)
@@ -4,6 +4,7 @@
        .global t1
        .global t2
        .global t5
+       .type arm, %function
 arm:
        bx lr
        .thumb
index a8c51c25cf6cc3dd5746d59da348a599b7b2a482..8b8495e9d395dec8ae2398c4e7dacdb95d1dc42e 100644 (file)
@@ -276,8 +276,8 @@ set armelftests {
      {{objdump -dr cortex-a8-fix-blx-rel-thumb.d}}
      "cortex-a8-fix-blx-rel-thumb"}
     {"Cortex-A8 erratum fix, relocate bl.w and far call"
-     "-EL -Ttext=0x00 --fix-cortex-a8 --defsym far_fn1=0x80000000 --defsym far_fn2=0x80000004  --defsym far_fn=0x7fff0000 --defsym _start=0"
-     "-EL -mcpu=cortex-a8" {cortex-a8-far-1.s cortex-a8-far-2.s}
+     "-EL -Ttext=0x00 --fix-cortex-a8 --defsym _start=0"
+     "-EL -mcpu=cortex-a8" {cortex-a8-far-1.s cortex-a8-far-2.s cortex-a8-far-3.s}
      {{objdump -dr cortex-a8-far.d}}
      "cortex-a8-far"}
     {"Cortex-A8 erratum fix, headers"
diff --git a/ld/testsuite/ld-arm/cortex-a8-far-3.s b/ld/testsuite/ld-arm/cortex-a8-far-3.s
new file mode 100644 (file)
index 0000000..48241a5
--- /dev/null
@@ -0,0 +1,9 @@
+.globl far_fn
+.type far_fn, %function
+.set far_fn, 0x7fff0000
+.globl far_fn1
+.type far_fn1, %function
+.set far_fn1, 0x80000000
+.globl far_fn2
+.type far_fn2, %function
+.set far_fn2, 0x80000004
index 17f503bf6647c37727f8aa6a349eaef23d0d24a6..95ad03555d171bd1c7df46652f4d491aea891f14 100644 (file)
@@ -8,6 +8,7 @@ myfunc:
        bl bar
 
        .section .far, "xa"
+       .type bar, %function
        .global bar
 bar:
        bx lr
This page took 0.05017 seconds and 4 git commands to generate.