From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] toolchain: check ARM EABI vs. EABIhf for external toolchains
Date: Wed, 17 Jul 2013 09:25:19 +0200 [thread overview]
Message-ID: <20130717092519.7543da71@skate> (raw)
In-Reply-To: <20130716223952.GB7947@free.fr>
Dear Yann E. MORIN,
On Wed, 17 Jul 2013 00:39:53 +0200, Yann E. MORIN wrote:
> > EXT_TOOLCHAIN_TARGET=`LANG=C $${__CROSS_CC} -v 2>&1 | grep ^Target | cut -f2 -d ' '` ; \
> > - if ! echo $${EXT_TOOLCHAIN_TARGET} | grep -qE 'eabi(hf)?$$' ; then \
> > - echo "External toolchain uses the unsuported OABI" ; \
> > + if echo $${EXT_TOOLCHAIN_TARGET} | grep -qE 'eabi$$' ; then \
> > + EXT_TOOLCHAIN_ABI="eabi" ; \
> > + elif echo $${EXT_TOOLCHAIN_TARGET} | grep -qE 'eabihf$$' ; then \
> > + EXT_TOOLCHAIN_ABI="eabihf" ; \
>
> That's not always the case. You can well have a toolchain which tuple
> ends in eabi, but the toolchain uses the hard-float ABI.
>
> That's the case by default for crosstool-NG toolchains, for example.
> Since the *eabihf is recent, not all gcc or binutils versions recognise
> it, while they are absolutely capable of emitting EABI using the
> hard-float ABI. Hence, ct-ng allows adding the 'hf' suffix as an option.
> (see attachment for an example of 'gcc -v' dump).
>
> Checking for EABI, it is better and more reliable to run the
> preprocessor, and check some defines are available or not (I always
> need a bit of googling to get this):
> ARM_TUPLE-gcc -E -dM -xc - </dev/null |grep __ARM_EABI__
>
> However, I could not find a #define about the float ABI... :-(
Ah, interesting. Originally, I wasn't planning on checking the tuple,
and I was instead thinking of using a specific tag in the ELF headers.
A binary compiled with an EABIhf toolchain:
$ arm-linux-gnueabihf-readelf -A toto.o | grep Tag_ABI_VFP_args
Tag_ABI_VFP_args: VFP registers
$
A binary compiled with an EABI toolchain:
$ arm-linux-gnueabihf-readelf -A toto.o | grep Tag_ABI_VFP_args
$
I would run this on the libc or ld.so provided with the toolchain.
What do you think?
> > + else \
> > + echo "Unsupported ABI of the external toolchain" ; \
> > + exit 1 ; \
> > + fi ; \
> > + if [ x$(BR2_ARM_EABI) = x"y" -a $${EXT_TOOLCHAIN_ABI} = "eabihf" ] ; then \
>
> Using this 'x$(VAR) = xy' construct is ugly. Just quote the variables,
> it is easier to read:
> if [ "$(BR2_ARM_EABI)" = "y" ... ]
>
> The x$VAR construct was from a time when some shells where failing to
> test against an empty string. That time is long gone. Virtaully all
> shells can compare to empty strings, nowadays.
Ok, will fix.
Thomas
--
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
next prev parent reply other threads:[~2013-07-17 7:25 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-16 22:06 [Buildroot] [PATCH] toolchain: check ARM EABI vs. EABIhf for external toolchains Thomas Petazzoni
2013-07-16 22:39 ` Yann E. MORIN
2013-07-17 5:27 ` Peter Korsgaard
2013-07-17 7:25 ` Thomas Petazzoni [this message]
2013-07-17 7:45 ` Yann E. MORIN
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130717092519.7543da71@skate \
--to=thomas.petazzoni@free-electrons.com \
--cc=buildroot@busybox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox