gcc: arm: linux-eabi: fix handling of armv4 bx fixups when linking
authorMike Frysinger <vapier@gcc.gnu.org>
Tue, 30 Apr 2013 04:07:23 +0000 (04:07 +0000)
committerMike Frysinger <vapier@gcc.gnu.org>
Tue, 30 Apr 2013 04:07:23 +0000 (04:07 +0000)
The bpabi.h header already sets up defines to automatically use the
--fix-v4bx flag with the assembler & linker as needed, and creates a
default assembly & linker spec which uses those.  Unfortunately, the
linux-eabi.h header clobbers the LINK_SPEC define and doesn't include
the v4bx define when setting up its own.  So while the assembler spec
is retained and works fine to generate the right relocs, building for
armv4 targets doesn't invoke the linker correctly so all the relocs
get processed as if we had an armv4t target.

You can see this with -dumpspecs when configuring gcc for an armv4
target and using --with-arch=armv4:
$ armv4l-unknown-linux-gnueabi-gcc -dumpspecs |& grep -B 1 fix-v4bx
*subtarget_extra_asm_spec:
.... %{mcpu=arm8|mcpu=arm810|mcpu=strongarm*|march=armv4|mcpu=fa526|mcpu=fa626:--fix-v4bx} ...

With this fix in place, we also get the link spec:
$ armv4l-unknown-linux-gnueabi-gcc -dumpspecs |& grep -B 1 fix-v4bx
*link:
...  %{mcpu=arm8|mcpu=arm810|mcpu=strongarm*|march=armv4|mcpu=fa526|mcpu=fa626:--fix-v4bx} ...

And all my hello world tests / glibc builds automatically turn the
bx insn into the 'mov pc, lr' insn and all is right in the world.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
From-SVN: r198438

gcc/ChangeLog
gcc/config/arm/bpabi.h
gcc/config/arm/linux-eabi.h

index a6eb15a2dc5ae0eba18ad8a85c1018443c407240..ed8f71976049ff812ac9fae192b7b0bab1971587 100644 (file)
@@ -1,3 +1,10 @@
+2013-04-29  Mike Frysinger  <vapier@gentoo.org>
+
+       * config/arm/bpabi.h (EABI_LINK_SPEC): Define.
+       (BPABI_LINK_SPEC): Use new EABI_LINK_SPEC.
+       * config/arm/linux-eabi.h (LINK_SPEC): Replace BE8_LINK_SPEC
+       with EABI_LINK_SPEC.
+
 2013-04-29  Uros Bizjak  <ubizjak@gmail.com>
 
        PR target/44578
@@ -7,7 +14,7 @@
 2013-04-29  Vladimir Makarov  <vmakarov@redhat.com>
 
        PR target/57097
-        * lra-constraints.c (process_alt_operands): Discourage a bit more
+       * lra-constraints.c (process_alt_operands): Discourage a bit more
        using memory for pseudos.  Print cost dump for alternatives.
        Modify cost values for conflicts with early clobbers.
        (curr_insn_transform): Spill pseudos reassigned to NO_REGS.
index 8e6683b3b235a7997204d6254d2dcab409574af7..ff89633d788a2e0d9e047300e1101b01f94a9b80 100644 (file)
 #define SUBTARGET_EXTRA_LINK_SPEC ""
 #endif
 
+/* Split out the EABI common values so other targets can use it.  */
+#define EABI_LINK_SPEC \
+  TARGET_FIX_V4BX_SPEC BE8_LINK_SPEC
+
 /* The generic link spec in elf.h does not support shared libraries.  */
 #define BPABI_LINK_SPEC \
   "%{mbig-endian:-EB} %{mlittle-endian:-EL} "          \
   "%{static:-Bstatic} %{shared:-shared} %{symbolic:-Bsymbolic} "       \
-  "-X" SUBTARGET_EXTRA_LINK_SPEC TARGET_FIX_V4BX_SPEC BE8_LINK_SPEC
+  "-X" SUBTARGET_EXTRA_LINK_SPEC EABI_LINK_SPEC
 
 #undef  LINK_SPEC
 #define LINK_SPEC BPABI_LINK_SPEC
index 4a425c87247e7c7d76faf6c4196c44e1331d3e68..23671a788c23b5735494f95be69bad39f99c690f 100644 (file)
@@ -80,7 +80,7 @@
 /* At this point, bpabi.h will have clobbered LINK_SPEC.  We want to
    use the GNU/Linux version, not the generic BPABI version.  */
 #undef  LINK_SPEC
-#define LINK_SPEC BE8_LINK_SPEC                                                \
+#define LINK_SPEC EABI_LINK_SPEC                                       \
   LINUX_OR_ANDROID_LD (LINUX_TARGET_LINK_SPEC,                         \
                       LINUX_TARGET_LINK_SPEC " " ANDROID_LINK_SPEC)