diff mbox

[1/1] Use libm.so when testing external compiler ABI

Message ID 1392385415-19367-1-git-send-email-syntheticpp@gmx.net
State Rejected
Headers show

Commit Message

Peter Kümmel Feb. 14, 2014, 1:43 p.m. UTC
crt1.o could not be used to test for eabihf because
it does not list the tag Tag_ABI_VFP_args.

Signed-off-by: Peter Kümmel <syntheticpp@gmx.net>
---
 toolchain/helpers.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Thomas Petazzoni Feb. 14, 2014, 2:36 p.m. UTC | #1
Dear Peter Kümmel,

On Fri, 14 Feb 2014 14:43:35 +0100, Peter Kümmel wrote:
> crt1.o could not be used to test for eabihf because
> it does not list the tag Tag_ABI_VFP_args.
> 
> Signed-off-by: Peter Kümmel <syntheticpp@gmx.net>
> ---
>  toolchain/helpers.mk | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk
> index faa9d90..c41d757 100644
> --- a/toolchain/helpers.mk
> +++ b/toolchain/helpers.mk
> @@ -284,8 +284,8 @@ 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_LIBM=`LANG=C $${__CROSS_CC} -print-file-name=libm.so` ; \
> +	if $${__CROSS_READELF} -A $${EXT_TOOLCHAIN_LIBM} | grep -q "Tag_ABI_VFP_args:" ; then \
>  		EXT_TOOLCHAIN_ABI="eabihf" ; \
>  	else \
>  		EXT_TOOLCHAIN_ABI="eabi" ; \

This is more or less the same patch as proposed at
https://bugs.busybox.net/show_bug.cgi?id=6842.

Originally, the reason why I had chosen to check crt1.o instead of
a .so file is because crt1.o exists even for purely static toolchains
(i.e no support for shared libraries). Even though I admit that the
likelihood of finding such toolchains for ARM is quite small, I'd like
to understand why crt1.o doesn't have the Tag_ABI_VFP_args. Is this
happening when using a Buildroot toolchain as an external toolchain? If
so, maybe it's Buildroot who actually does something wrong when
building the toolchain, because the Linaro toolchains do have
Tag_ABI_VFP_args in crt1.o :

The multilib variant compiled EABIhf:

$ arm-linux-gnueabihf-readelf -A ./arm-linux-gnueabihf/libc/usr/lib/arm-linux-gnueabihf/crt1.o | grep Tag_ABI_VFP_args
  Tag_ABI_VFP_args: VFP registers
$

The multilib variant compiled EABI:

$ arm-linux-gnueabihf-readelf -A ./arm-linux-gnueabihf/libc/usr/lib/arm-linux-gnueabi/crt1.o | grep Tag_ABI_VFP_args
$

So I'd prefer to have an understanding of why crt1.o is not EABIhf
before applying this patch.

Thanks!

Thomas
Peter Kümmel Feb. 14, 2014, 3:02 p.m. UTC | #2
> This is more or less the same patch as proposed at
> https://bugs.busybox.net/show_bug.cgi?id=6842.

Yes, just more in the commit message.

> 
> Originally, the reason why I had chosen to check crt1.o instead of
> a .so file is because crt1.o exists even for purely static toolchains
> (i.e no support for shared libraries). Even though I admit that the
> likelihood of finding such toolchains for ARM is quite small, I'd like
> to understand why crt1.o doesn't have the Tag_ABI_VFP_args. Is this
> happening when using a Buildroot toolchain as an external toolchain? If

Yes, buildroot's GCC 4.8.2, relevant configs:

BR2_arm=y
BR2_cortex_a8=y
BR2_ARM_EABIHF=y
BR2_ARM_FPU_VFPV3=y
BR2_TOOLCHAIN_BUILDROOT_LARGEFILE=y
BR2_TOOLCHAIN_BUILDROOT_INET_IPV6=y
BR2_TOOLCHAIN_BUILDROOT_LOCALE=y
BR2_BINUTILS_VERSION_2_24=y
BR2_GCC_VERSION_4_8_X=y
BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_ENABLE_LOCALE_PURGE=y
BR2_ENABLE_LOCALE_WHITELIST="C en_US de "

> so, maybe it's Buildroot who actually does something wrong when
> building the toolchain, because the Linaro toolchains do have
> Tag_ABI_VFP_args in crt1.o :
> 
> The multilib variant compiled EABIhf:
> 
> $ arm-linux-gnueabihf-readelf -A ./arm-linux-gnueabihf/libc/usr/lib/arm-linux-gnueabihf/crt1.o | grep Tag_ABI_VFP_args
>   Tag_ABI_VFP_args: VFP registers
> $
> 
> The multilib variant compiled EABI:
> 
> $ arm-linux-gnueabihf-readelf -A ./arm-linux-gnueabihf/libc/usr/lib/arm-linux-gnueabi/crt1.o | grep Tag_ABI_VFP_args
> $
> 
> So I'd prefer to have an understanding of why crt1.o is not EABIhf
> before applying this patch.

I agree, but don't know much about building/configuring gcc.

> 
> Thanks!
> 
> Thomas
> -- 
> Thomas Petazzoni, CTO, Free Electrons
> Embedded Linux, Kernel and Android engineering
> http://free-electrons.com
>
diff mbox

Patch

diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk
index faa9d90..c41d757 100644
--- a/toolchain/helpers.mk
+++ b/toolchain/helpers.mk
@@ -284,8 +284,8 @@  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_LIBM=`LANG=C $${__CROSS_CC} -print-file-name=libm.so` ; \
+	if $${__CROSS_READELF} -A $${EXT_TOOLCHAIN_LIBM} | grep -q "Tag_ABI_VFP_args:" ; then \
 		EXT_TOOLCHAIN_ABI="eabihf" ; \
 	else \
 		EXT_TOOLCHAIN_ABI="eabi" ; \