diff options
author | Mike Frysinger <vapier@gcc.gnu.org> | 2013-04-30 04:07:23 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gcc.gnu.org> | 2013-04-30 04:07:23 +0000 |
commit | 37953bd308af0b2ffe9205fbec12b40a0bf725a1 (patch) | |
tree | f21ee9c2aa4e009fc4843bffb10b136117b8784e /gcc/config | |
parent | 5eb8b03c897aba9796d421c160c65f1929fc6cf3 (diff) | |
download | gcc-37953bd308af0b2ffe9205fbec12b40a0bf725a1.zip gcc-37953bd308af0b2ffe9205fbec12b40a0bf725a1.tar.gz gcc-37953bd308af0b2ffe9205fbec12b40a0bf725a1.tar.bz2 |
gcc: arm: linux-eabi: fix handling of armv4 bx fixups when linking
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
Diffstat (limited to 'gcc/config')
-rw-r--r-- | gcc/config/arm/bpabi.h | 6 | ||||
-rw-r--r-- | gcc/config/arm/linux-eabi.h | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/gcc/config/arm/bpabi.h b/gcc/config/arm/bpabi.h index 8e6683b..ff89633 100644 --- a/gcc/config/arm/bpabi.h +++ b/gcc/config/arm/bpabi.h @@ -91,11 +91,15 @@ #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 diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h index 4a425c8..23671a7 100644 --- a/gcc/config/arm/linux-eabi.h +++ b/gcc/config/arm/linux-eabi.h @@ -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) |