[Buildroot] Question about float-abi

Ludovic Desroches ludovic.desroches at atmel.com
Wed Feb 29 11:08:51 UTC 2012


Hi,

On Tue, Feb 28, 2012 at 11:55:50AM +0100, Ludovic Desroches wrote:
> Hi,
> 
> I am trying to play with the -mfloat-abi option to see performance improvement
> between soft, softfp and hard values.
> 
> I was not sure that the toolchain generated by Buildroot (even if BR2_VFP_FLOAT
> is selected) will fit my needs (since I had low performances on nbench floating
> point index).
> 
> Then I decided to use Crosstool-ng to generate my toolchain (moreover I'll be
> able to compare glibc/eglibc/uclibc performances). I set the -mtune, -mfpu
> options and changed -mfloat-abi value to generate three toolchains: one with
> -mfloat-abi=soft, one with -mfloat-abi=softfp and one with -mfloat-abi=hard.
> 
> Then I compiled nbench as a static binary. The results of the benchmark are
> consistent. Floating point index is low for mfloat-abi=soft, much better for
> softfp and hard.
> 
> So I would like to remove the static option. I expected to have an issue with
> at least one of the three binaries. The rootfs I used was generated with
> Buildroot and the code sourcery toolchain (I also tried with the toolchains I
> have generated with crosstool-ng).
> I could run the binary with mfloat-abi=hard but floating point performances
> were low so it seems that the libm/libc are not using the vfp unit. Why not!
> I was surprised when I could also run the binary with mfloat-abi=soft because
> I thought that soft and hard float-abi were not compatible.
> 
> If I try to compile nbench with mfloat-abi=hard with the toolchain generated
> with mfloat-abi=soft I have some erros telling me that I am using VFP register
> arguments. In this case, the behavior is ok.

The strange behavior about float-abi compability between the libc and the binary
is probably coming from an error on my side. I have not checked all combination
but it seems more logical even if I still have some strange behavior.
For instance, I have on my target a libc compiled with float-abi=hard. I can run
my benchmark compiled with float-abi=hard option and with a libc compiled also
with float-abi=hard.
I also tried on the same target, a benchmark which should be compiled with 
float-abi=soft option with a libc compiled also with float-abi=soft. I can run
this binary too that is quite surprising. In fact, the binary was compiled with
float-abi=softfp option with a libc compiled with float-abi=soft. To my mind,
it is still strange to have something working here. Running several times the
benchmark, I noticed that sometimes it was stuck.
To finish with, the benchmark really compiled with float-abi=soft option with a
libc compiled also with float-abi=soft is stuck when it starts floating point
benches so the behavior is correct.

Now, it seems more logical but not totally. This part doesn't concern Buildroot
but it was to keep you inform.



When I use a glibc/eglibc toolchain (I have somes issues to build the uclibc
one) built with crosstool-ng I have the results I expect with the benchmark.

If Buildroot builds the toolchain using the uclibc (with VFP_FLOAT set and
SOFT_FLOAT not set) I have unexpected results.
I compiled my benchmark outside buildroot environment. I could compile it with
float-abi set to soft and softfp but not to hard. Ok it's not too strange for
the moment.
Then I tried to run my two binaries on the target. The first one compiled
with float-abi set to soft gave me poor results with a floating point score
about 0.15. The second binary gave me better results with a floating point
score about 0.55. It seems better but in fact it is far from the score I had
with my toolchains based on glibc/eglibc.

Deassaembling the libm which is on my target, I didn't see any vfp
instructions. So why floating point performances are increased with float-abi
set to softfp?


How can I have a hardware floating point support with Buildroot and uclibc?
Looking at the BR2_VFP_FLOAT setting, it seems to be only used for external
toolchains providing multi-lib support.
I added mcpu, mfpu and mfloat-abi flags to BR2_TARGET_OPTIMIZATION and to
UCLIBC_EXTRA_FLAGS. I think it really force hardware floating point support
since I have this error during the build:

[snip]/arm-unknown-linux-uclibcgnueabi/bin/ld: error: lib/libuClibc-0.9.32.1.so
uses VFP register arguments, [snip]/arm-unknown-linux-uclibcgnueabi/4.5.3/libgcc.a(bpabi.o)
does not

Do I play with the good settings? Do I miss some settings?


Thanks.

Regards.

Ludovic



More information about the buildroot mailing list