Skip to contentSkip to conversation

toolchain-external: Fix EABIhf check

PATCH New Stefan Sørensen 3 participants 6 messages Jan 14, 2014 – Jan 28, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 toolchain-external: Fix EABIhf check

Currently the check for EABI/EABIhf toolchains looks for the Tag_ABI_VFP_args attribute in the crt1.o file which gcc adds in a EABIhw toolchain. The crt1.o is however often not compiled from c but assembler, and will then always failt he EABIhf check.

Fix by compiling a temporary .c file and checking for the attribute.

---
 toolchain/helpers.mk | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
toolchain/helpers.mk +5 -2
index faa9d90..0accb7b 100644
@@ -284,12 +284,15 @@ 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 \
+	TEMP_C_FILE=`mktemp --tmpdir --suffix=.c`; \
+	touch $${TEMP_C_FILE}; \
+	$${__CROSS_CC} -c -o $${TEMP_C_FILE}.o $${TEMP_C_FILE}; \
+	if $${__CROSS_READELF} -A $${TEMP_C_FILE}.o | grep -q "Tag_ABI_VFP_args:" ; then \
 		EXT_TOOLCHAIN_ABI="eabihf" ; \
 	else \
 		EXT_TOOLCHAIN_ABI="eabi" ; \
 	fi ; \
+	rm -f $${TEMP_C_FILE} $${TEMP_C_FILE}.o; \
 	if [ "$(BR2_ARM_EABI)" = "y" -a "$${EXT_TOOLCHAIN_ABI}" = "eabihf" ] ; then \
 		echo "Incorrect ABI setting: EABI selected, but toolchain uses EABIhf" ; \
 		exit 1 ; \
Signature · 1 line
1.8.4.2
#1 lore raw

PATCH 2/3 toolchain-external: Fix ld.so naming with uClibc and EABIhf.

Currently ld-linux-armhf.so.* is added to external libs when using an EABIhf toolchain, but this naming is not used by uClibc. Fix by adding a check for glibc.

---
 toolchain/toolchain-external/toolchain-external.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
toolchain/toolchain-external/toolchain-external.mk +1 -1
index 1084ee2..a7bfafc 100644
@@ -63,7 +63,7 @@
 
 ifeq ($(BR2_TOOLCHAIN_EXTERNAL_GLIBC)$(BR2_TOOLCHAIN_EXTERNAL_UCLIBC),y)
 LIB_EXTERNAL_LIBS+=libc.so.* libcrypt.so.* libdl.so.* libgcc_s.so.* libm.so.* libnsl.so.* libresolv.so.* librt.so.* libutil.so.*
-ifeq ($(BR2_ARM_EABIHF),y)
+ifeq ($(BR2_TOOLCHAIN_EXTERNAL_GLIBC)$(BR2_ARM_EABIHF),yy)
 LIB_EXTERNAL_LIBS+=ld-linux-armhf.so.*
 else
 LIB_EXTERNAL_LIBS+=ld*.so.*
Signature · 1 line
1.8.4.2
#2 lore raw

PATCH 2/3 toolchain-external: Fix ld.so naming with uClibc and EABIhf.

Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Stefan" == Stefan S?rensen <[email protected]> writes:

Currently ld-linux-armhf.so.* is added to external libs when using an EABIhf toolchain, but this naming is not used by uClibc. Fix by adding a check for glibc.

---

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#3 lore raw

PATCH 3/3 protobuf-c: Don't require protobuf on target.

In reply to Stefan Sørensen

protobuf-c only requires protobuf when building the protoc compiler, hence protobuf can be dropped from the target dependencies.

---
 package/protobuf-c/Config.in     | 1 -
 package/protobuf-c/protobuf-c.mk | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)
package/protobuf-c/Config.in +0 -1
index 3baa05e..732befc 100644
@@ -2,7 +2,6 @@ config BR2_PACKAGE_PROTOBUF_C
 	bool "protobuf-c"
 	depends on BR2_INSTALL_LIBSTDCPP
 	depends on BR2_TOOLCHAIN_HAS_THREADS # protobuf
-	select BR2_PACKAGE_PROTOBUF
 	help
 	  Code generator and runtime libraries to use Protocol Buffers
 	  from pure C (not C++).
package/protobuf-c/protobuf-c.mk +1 -1
index 271f6d8..42f592b 100644
@@ -6,7 +6,7 @@
 
 PROTOBUF_C_VERSION = 0.15
 PROTOBUF_C_SITE = http://protobuf-c.googlecode.com/files
-PROTOBUF_C_DEPENDENCIES = protobuf host-protobuf-c
+PROTOBUF_C_DEPENDENCIES = host-protobuf-c
 HOST_PROTOBUF_C_DEPENDENCIES = host-protobuf
 PROTOBUF_C_MAKE = $(MAKE1)
 PROTOBUF_C_CONF_OPT = --disable-protoc
Signature · 1 line
1.8.4.2
#4 lore raw

PATCH 3/3 protobuf-c: Don't require protobuf on target.

Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Stefan" == Stefan S?rensen <[email protected]> writes:

protobuf-c only requires protobuf when building the protoc compiler, hence protobuf can be dropped from the target dependencies.

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#5 lore raw

PATCH 1/3 toolchain-external: Fix EABIhf check

In reply to Stefan Sørensen

Dear Stefan S?rensen,

Quoted 4 lines · Stefan S?rensen

Currently the check for EABI/EABIhf toolchains looks for the Tag_ABI_VFP_args attribute in the crt1.o file which gcc adds in a EABIhw toolchain. The crt1.o is however often not compiled from c but assembler, and will then always failt he EABIhf check.

Do you have details about this? Because the crt1.o trick was actually tested by me on several toolchains, and it was indeed working.

toolchain/helpers.mk check_arm_abi = \ · line 289

Quoted 3 lines
toolchain/helpers.mk +3 -0
+	TEMP_C_FILE=`mktemp --tmpdir --suffix=.c`; \
+	touch $${TEMP_C_FILE}; \
+	$${__CROSS_CC} -c -o $${TEMP_C_FILE}.o $${TEMP_C_FILE}; \

If all you need is build an empty source file, then you do not even need to create a temporary .c file:

gcc -x c -c -o toto.o /dev/null

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com