Skip to contentSkip to conversation

EABI vs EABIhf check

PATCH New Thomas Petazzoni 3 participants 7 messages Jul 17, 2013

lore
Share & tools
lore
#0 lore raw

v3 cover EABI vs EABIhf check

Hello,

Third version of the EABI vs EABIhf check, which takes into account the comments from Yann E. Morin:

* Added quoting where needed.
* Fixed the comment in Config.in.arm

Thanks!

Thomas

Thomas Petazzoni (4):
toolchain/helpers: don't use the x$(...) = x"value" syntax
toolchain: check ARM EABI vs. EABIhf for external toolchains toolchain/toolchain-external: don't use x$(...) construct or == arch/arm: update VFPv2 comment to mention ARMv5

 arch/Config.in.arm                       |  5 +++--
 toolchain/helpers.mk                     | 21 ++++++++++++++++++---
 toolchain/toolchain-external/ext-tool.mk | 13 ++++++++-----
 3 files changed, 29 insertions(+), 10 deletions(-)
Signature · 1 line
1.8.1.2
#1 lore raw

PATCH v3 1/4 toolchain/helpers: don't use the x$(...) = x"value" syntax

As noted by Yann E. Morin, the x$(...) = x"value" syntax is old and ugly, and the easier to read "$(...)" = "value" can now be used without problems.

---
 toolchain/helpers.mk | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
toolchain/helpers.mk +3 -3
index 95217e7..764c795 100644
@@ -181,7 +181,7 @@ create_lib64_symlinks = \
 # $2: feature description
 #
 check_glibc_feature = \
-	if [ x$($(1)) != x"y" ] ; then \
+	if [ "$($(1))" != "y" ] ; then \
 		echo "$(2) available in C library, please enable $(1)" ; \
 		exit 1 ; \
 	fi
@@ -236,11 +236,11 @@ check_glibc = \
 #
 check_uclibc_feature = \
 	IS_IN_LIBC=`grep -q "\#define $(1) 1" $(3) && echo y` ; \
-	if [ x$($(2)) != x"y" -a x$${IS_IN_LIBC} = x"y" ] ; then \
+	if [ "$($(2))" != "y" -a "$${IS_IN_LIBC}" = "y" ] ; then \
 		echo "$(4) available in C library, please enable $(2)" ; \
 		exit 1 ; \
 	fi ; \
-	if [ x$($(2)) = x"y" -a x$${IS_IN_LIBC} != x"y" ] ; then \
+	if [ "$($(2))" = "y" -a "$${IS_IN_LIBC}" != "y" ] ; then \
 		echo "$(4) not available in C library, please disable $(2)" ; \
 		exit 1 ; \
 	fi
Signature · 1 line
1.8.1.2
#2 lore raw

PATCH v3 2/4 toolchain: check ARM EABI vs. EABIhf for external toolchains

In reply to Thomas Petazzoni

Following the introduction of the support of EABIhf as a second ARM ABI, it is important to check whether the external toolchain provided by the user actually uses the ABI that has been selected in the Buildroot configuration. This commit introduces such a check by looking at the 'Tag_ABI_VFP_args' tag of the architecture-specific section of the ELF headers. This assumes that ELF is the binary format used on ARM, which may not be the case on ARM noMMU systems (they use the FLAT binary format), but Buildroot doesn't have support for such systems at the moment.

---
 toolchain/helpers.mk                     | 15 +++++++++++++++
 toolchain/toolchain-external/ext-tool.mk |  5 ++++-
 2 files changed, 19 insertions(+), 1 deletion(-)
toolchain/helpers.mk +15 -0
index 764c795..4c988a5 100644
@@ -279,10 +279,25 @@ check_uclibc = \
 #
 check_arm_abi = \
 	__CROSS_CC=$(strip $1) ; \
+	__CROSS_READELF=$(strip $2) ; \
 	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" ; \
 		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_ABI="eabihf" ; \
+	else \
+		EXT_TOOLCHAIN_ABI="eabi" ; \
+	fi ; \
+	if [ "$(BR2_ARM_EABI)" = "y" -a "$${EXT_TOOLCHAIN_ABI}" = "eabihf" ] ; then \
+		echo "Incorrect ABI setting: EABI selected, but toolchain uses EABIhf" ; \
+		exit 1 ; \
+	fi ; \
+	if [ "$(BR2_ARM_EABIHF)" = "y" -a "$${EXT_TOOLCHAIN_ABI}" = "eabi" ] ; then \
+		echo "Incorrect ABI setting: EABIhf selected, but toolchain uses EABI" ; \
+		exit 1 ; \
 	fi
 
 #
toolchain/toolchain-external/ext-tool.mk +4 -1
index b9ae68f..80e03b9 100644
@@ -125,6 +125,7 @@ endif
 TOOLCHAIN_EXTERNAL_CROSS=$(TOOLCHAIN_EXTERNAL_BIN)/$(TOOLCHAIN_EXTERNAL_PREFIX)-
 TOOLCHAIN_EXTERNAL_CC=$(TOOLCHAIN_EXTERNAL_CROSS)gcc
 TOOLCHAIN_EXTERNAL_CXX=$(TOOLCHAIN_EXTERNAL_CROSS)g++
+TOOLCHAIN_EXTERNAL_READELF=$(TOOLCHAIN_EXTERNAL_CROSS)readelf
 TOOLCHAIN_EXTERNAL_WRAPPER_ARGS = -DBR_SYSROOT='"$(STAGING_SUBDIR)"'
 
 ifeq ($(filter $(HOST_DIR)/%,$(TOOLCHAIN_EXTERNAL_BIN)),)
@@ -368,7 +369,9 @@ $(STAMP_DIR)/ext-toolchain-checked: $(TOOLCHAIN_EXTERNAL_DEPENDENCIES)
 		exit 1 ; \
 	fi ; \
 	if test x$(BR2_arm) == x"y" ; then \
-		$(call check_arm_abi,$(TOOLCHAIN_EXTERNAL_CC)) ; \
+		$(call check_arm_abi,\
+			"$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS)",\
+			$(TOOLCHAIN_EXTERNAL_READELF)) ; \
 	fi ; \
 	if test x$(BR2_INSTALL_LIBSTDCPP) == x"y" ; then \
 		$(call check_cplusplus,$(TOOLCHAIN_EXTERNAL_CXX)) ; \
Signature · 1 line
1.8.1.2
#3 lore raw

PATCH v3 3/4 toolchain/toolchain-external: don't use x$(...) construct or ==

In reply to Thomas Petazzoni

With modern shells, we can simply do test using the "$(...)" = "value" form. This commit gets rid of the x$(...) = x"value" constructs and replaces == by =, which is the correct operator to test the equality of two strings with the test program.

---
 toolchain/toolchain-external/ext-tool.mk | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
toolchain/toolchain-external/ext-tool.mk +4 -4
index 80e03b9..8aac50e 100644
@@ -368,15 +368,15 @@ $(STAMP_DIR)/ext-toolchain-checked: $(TOOLCHAIN_EXTERNAL_DEPENDENCIES)
 		@echo "External toolchain doesn't support --sysroot. Cannot use." ; \
 		exit 1 ; \
 	fi ; \
-	if test x$(BR2_arm) == x"y" ; then \
+	if test "$(BR2_arm)" = "y" ; then \
 		$(call check_arm_abi,\
 			"$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS)",\
 			$(TOOLCHAIN_EXTERNAL_READELF)) ; \
 	fi ; \
-	if test x$(BR2_INSTALL_LIBSTDCPP) == x"y" ; then \
+	if test "$(BR2_INSTALL_LIBSTDCPP)" = "y" ; then \
 		$(call check_cplusplus,$(TOOLCHAIN_EXTERNAL_CXX)) ; \
 	fi ; \
-	if test x$(BR2_TOOLCHAIN_EXTERNAL_UCLIBC) == x"y" ; then \
+	if test "$(BR2_TOOLCHAIN_EXTERNAL_UCLIBC)" = "y" ; then \
 		$(call check_uclibc,$${SYSROOT_DIR}) ; \
 	else \
 		$(call check_glibc,$${SYSROOT_DIR}) ; \
@@ -464,7 +464,7 @@ $(STAMP_DIR)/ext-toolchain-installed: $(STAMP_DIR)/ext-toolchain-checked
 	if [ -L $${ARCH_SYSROOT_DIR}/lib64 -o -d $${ARCH_SYSROOT_DIR}/lib64 ] ; then \
 		$(call create_lib64_symlinks) ; \
 	fi ; \
-	if test x"$(BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY)" == x"y"; then \
+	if test "$(BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY)" = "y"; then \
 		$(call MESSAGE,"Copying gdbserver") ; \
 		gdbserver_found=0 ; \
 		for d in $${ARCH_SYSROOT_DIR}/usr $${ARCH_SYSROOT_DIR}/../debug-root/usr $${ARCH_SYSROOT_DIR}/usr/$${ARCH_LIB_DIR} ; do \
Signature · 1 line
1.8.1.2
#4 lore raw

PATCH v3 4/4 arch/arm: update VFPv2 comment to mention ARMv5

In reply to Thomas Petazzoni

Commit 6b3a0417c4 ('arch/arm: arm926 may have VFP') forgot to update the help text of the VFPv2 option to mention ARMv5. This commit fixes that.

---
 arch/Config.in.arm | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
arch/Config.in.arm +3 -2
index b2fe257..2a0cf45 100644
@@ -193,8 +193,9 @@ config BR2_ARM_FPU_VFPV2
 	depends on BR2_ARM_CPU_HAS_VFPV2 || BR2_ARM_CPU_MAYBE_HAS_VFPV2
 	help
 	  This option allows to use the VFPv2 floating point unit, as
-	  available in some ARMv6 processors (ARM1136JF-S,
-	  ARM1176JZF-S and ARM11 MPCore).
+	  available in some ARMv5 processors (ARM926EJ-S) and some
+	  ARMv6 processors (ARM1136JF-S, ARM1176JZF-S and ARM11
+	  MPCore).
 
 	  Note that this option is also safe to use for newer cores
 	  such as Cortex-A, because the VFPv3 and VFPv4 units are
Signature · 1 line
1.8.1.2
#5 lore raw

v3 cover EABI vs EABIhf check

In reply to Thomas Petazzoni

Thomas, All,

On 2013-07-17 22:30 +0200, Thomas Petazzoni spake thusly:

Quoted 8 lines

Third version of the EABI vs EABIhf check, which takes into account the comments from Yann E. Morin:

* Added quoting where needed.
* Fixed the comment in Config.in.arm

Thanks!

Quoted 7 lines

Thomas

Thomas Petazzoni (4):
toolchain/helpers: don't use the x$(...) = x"value" syntax
toolchain: check ARM EABI vs. EABIhf for external toolchains toolchain/toolchain-external: don't use x$(...) construct or == arch/arm: update VFPv2 comment to mention ARMv5

For the whole series:

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#6 lore raw

v3 cover EABI vs EABIhf check

In reply to Thomas Petazzoni
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

Thomas> Hello,
Thomas> Third version of the EABI vs EABIhf check, which takes into account Thomas> the comments from Yann E. Morin:

Thomas> * Added quoting where needed.
Thomas> * Fixed the comment in Config.in.arm

Committed series, thanks.

Signature · 1 line
Bye, Peter Korsgaard