Bug 6842 - Checking external toolchain for eabihf
Summary: Checking external toolchain for eabihf
Status: RESOLVED FIXED
Alias: None
Product: buildroot
Classification: Unclassified
Component: Other (show other bugs)
Version: 2014.02
Hardware: PC Linux
: P5 minor
Target Milestone: 2014.05
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-01 14:29 UTC by syntheticpp
Modified: 2014-05-11 19:33 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Comment 1 Thomas De Schampheleire 2014-02-07 08:30:47 UTC
Thomas Petazzoni, could you shine your light on this patch?
Copy/pasted here for convenience:

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" ; \
Comment 2 Thomas De Schampheleire 2014-02-21 07:50:06 UTC
Patch resubmitted to the list: http://patchwork.ozlabs.org/patch/320459/
Discussion started, but needs followup.
Comment 3 syntheticpp 2014-02-23 16:32:24 UTC
Investigated it further: there are no problems when eglibc is used, only with uclibc.

A grep for 'hard' or "EABI" in the uclibc-0.9.33.2 sources shows nothing relevant, so I assume eabihf is not supported by uclibc.
Comment 4 Thomas Petazzoni 2014-02-23 17:37:22 UTC
(In reply to comment #3)
> Investigated it further: there are no problems when eglibc is used, only with
> uclibc.

Correct.

> 
> A grep for 'hard' or "EABI" in the uclibc-0.9.33.2 sources shows nothing
> relevant, so I assume eabihf is not supported by uclibc.

I don't think the C library needs anything to "support" eabihf. eabihf is all about a change in the calling convention of functions taking floating point arguments.

I haven't got the bottom of this problem yet, but I have indeed reproduced it, and I continue to believe that the fix is *not* to change the external toolchain check, but instead to investigate *why* the uClibc crt1.o does not have those flags when built with the internal toolchain backend.
Comment 5 syntheticpp 2014-02-23 18:22:52 UTC
> 
> the fix is *not* to change the external toolchain check, 

Yes, the patch should not be applied.
Comment 6 syntheticpp 2014-02-23 20:03:10 UTC
command line for crtl1.o looks like this:

$ /opt/testgcc4.8.2/usr/bin/arm-buildroot-linux-uclibcgnueabihf-gcc -c libc/sysdeps/linux/arm/crt1.S -o lib/crt1.o -include ./include/libc-symbols.h -Wall -Wstrict-prototypes -Wstrict-aliasing -funsigned-char -fno-builtin -fno-asm -mlittle-endian -fno-stack-protector -nostdinc -I./include -I./include -I. -I./libc/sysdeps/linux -I./libc/sysdeps/linux/arm -Os -funit-at-a-time -fmerge-all-constants -fstrict-aliasing -fno-tree-loop-optimize -fno-tree-dominator-opts -fno-strength-reduce -DHAVE_FORCED_UNWIND -I./libpthread/nptl -I./libpthread/nptl -I./libpthread/nptl/sysdeps/unix/sysv/linux/arm/ -I./libpthread/nptl/sysdeps/unix/sysv/linux/arm -I./libpthread/nptl/sysdeps/arm -I./libpthread/nptl/sysdeps/arm -I./libpthread/nptl/sysdeps/unix/sysv/linux -I./libpthread/nptl/sysdeps/unix/sysv/linux -I./libpthread/nptl/sysdeps/pthread -I./libpthread/nptl/sysdeps/pthread/bits -I./libpthread/nptl/sysdeps/generic -I./ldso/ldso/arm -I./ldso/include -I./libc/sysdeps/linux/common -I/opt/testgcc4.8.2/usr/arm-buildroot-linux-uclibcgnueabihf/sysroot/usr/include/ -isystem /opt/testgcc4.8.2/usr/lib/gcc/arm-buildroot-linux-uclibcgnueabihf/4.8.2/include-fixed -isystem /opt/testgcc4.8.2/usr/lib/gcc/arm-buildroot-linux-uclibcgnueabihf/4.8.2/include -DNDEBUG -D__USE_STDIO_FUTEXES__ -MT lib/crt1.o -MD -MP -MF lib/.crt1.o.dep -D__ASSEMBLER__ -Wa,--noexecstack    -DL_crt1
Comment 7 Stefan Sørensen 2014-02-24 08:24:25 UTC
(In reply to comment #4)

> I haven't got the bottom of this problem yet, but I have indeed reproduced it,
> and I continue to believe that the fix is *not* to change the external
> toolchain check, but instead to investigate *why* the uClibc crt1.o does not
> have those flags when built with the internal toolchain backend.

The attributes are added by the compiler, not the assembler. glibc has both c and assembler source for crt1.o while uclibc has only assembler source.
Comment 8 Thomas De Schampheleire 2014-02-28 13:01:10 UTC
Config file for toolchain:
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 "


I can indeed confirm that uClibc builds crt1.o from crt1.S, using the command line as specified in comment #7.

Looking in the binutils sources (that creates the assembler), I do find references to ABI_VFP, but I don't see places where it is actually emitted in the build, unless the source assembly file contains a statement .eabi_attribute.

So the statements made by the submitter seem to be valid.
Comment 9 Thomas De Schampheleire 2014-05-05 12:14:23 UTC
Alternative patch submitted by Stefan Sørensen, updated and tested today by me:
http://patchwork.ozlabs.org/patch/345703/

This patch compiles a temporary object instead of using libm or crt1.
Comment 10 Thomas De Schampheleire 2014-05-11 19:33:22 UTC
Fixed with http://git.buildroot.net/buildroot/commit/?id=3787592063b0f30c69d074534a5a437bb458fbd7

Thanks for reporting!