toolchain-external: Fix EABIhf check
authorStefan Sørensen <stefan.sorensen@spectralink.com>
Fri, 9 May 2014 11:44:00 +0000 (13:44 +0200)
committerPeter Korsgaard <peter@korsgaard.com>
Sun, 11 May 2014 19:22:04 +0000 (21:22 +0200)
Currently the check for EABI/EABIhf toolchains looks for the
Tag_ABI_VFP_args attribute in the crt1.o file which gcc adds in an
EABIhf toolchain.
In uClibc, however, crt1.o is not compiled from c but assembly, so the
Tag_ABI_VFP_args attribute is not added in the object file. This causes
the EABIhf check in the external toolchain logic to fail for
uClibc-based toolchains.

Fix by compiling a dummy .c file and trying to link the object against the
C library. Since it is impossible to mix EABI and EABIhf code, a mismatch
between the buildroot and toolchain ABI settings will be detected during
this link step.

Fixes bug #6842: https://bugs.busybox.net/show_bug.cgi?id=6842

[Peter: fix final 'fi']
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
[ThomasDS: do full link iso readelf test, update commit message]
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
toolchain/helpers.mk

index ef60120713aef77149c98a53c6e0fb59460259f6..81e02b71328467ff54d80c02bf2b71c26d18df72 100644 (file)
@@ -297,18 +297,10 @@ check_arm_abi = \
                echo "External toolchain uses the unsuported OABI" ; \
                exit 1 ; \
        fi ; \
-       EXT_TOOLCHAIN_CRT1=`LANG=C $${__CROSS_CC} -print-file-name=crt1.o` ; \
-       if $${__CROSS_READELF} -A $${EXT_TOOLCHAIN_CRT1} | grep -q "Tag_ABI_VFP_args:" ; then \
-               EXT_TOOLCHAIN_ABI="eabihf" ; \
-       else \
-               EXT_TOOLCHAIN_ABI="eabi" ; \
-       fi ; \
-       if [ "$(BR2_ARM_EABI)" = "y" -a "$${EXT_TOOLCHAIN_ABI}" = "eabihf" ] ; then \
-               echo "Incorrect ABI setting: EABI selected, but toolchain uses EABIhf" ; \
-               exit 1 ; \
-       fi ; \
-       if [ "$(BR2_ARM_EABIHF)" = "y" -a "$${EXT_TOOLCHAIN_ABI}" = "eabi" ] ; then \
-               echo "Incorrect ABI setting: EABIhf selected, but toolchain uses EABI" ; \
+       if ! echo 'int main(void) {}' | $${__CROSS_CC} -x c -o /dev/null - 2>/dev/null; then \
+               abistr_$(BR2_ARM_EABI)='EABI'; \
+               abistr_$(BR2_ARM_EABIHF)='EABIhf'; \
+               echo "Incorrect ABI setting: $${abistr_y} selected, but toolchain is incompatible"; \
                exit 1 ; \
        fi