gcc: arm: linux-eabi: fix handling of armv4 bx fixups when linking
authorvapier <vapier@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 30 Apr 2013 04:07:23 +0000 (04:07 +0000)
committervapier <vapier@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 30 Apr 2013 04:07:23 +0000 (04:07 +0000)
commit2090f4f01dec1647e39695611d3b4f4b64bb5620
treef21ee9c2aa4e009fc4843bffb10b136117b8784e
parent7eb23f214ea86eabd8c9c3a5e4e2b93abc265a0a
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>
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@198438 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ChangeLog
gcc/config/arm/bpabi.h
gcc/config/arm/linux-eabi.h