[U-Boot] [RFC] fix break caused by new binutils

Víctor Manuel Jáquez Leal vjaquez at igalia.com
Mon Jan 24 19:36:48 CET 2011


According with this discussion [1] the new assemblers need
-march=armv7-a+sec on command line or .arch_extension sec inline to
enable use of the smc instruction.

In the sakoman's u-boot repository there is branch for the omap4 [2]
which uses the smc instruction with the -march=armv7-a, and it will
not compile with the latest binutils (2.21)

This patch fix that problem adding conditionally the armv7-a+sec the
march. In order to do this the patch adds as-instr which checks the
latter to enable the correct -march in AFLAGS for files that use smc.

This patch must be applied on top of
git://www.sakoman.com/git/u-boot.git;branch=omap4-exp

1. https://bugs.launchpad.net/ubuntu/+source/gcc-4.5/+bug/669912
2. http://www.sakoman.com/cgi-bin/gitweb.cgi?p=u-boot.git;a=shortlog;h=refs/heads/omap4-exp

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez at igalia.com>
---
 arch/arm/cpu/armv7/omap4/Makefile |    2 ++
 config.mk                         |    9 +++++++++
 2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/arch/arm/cpu/armv7/omap4/Makefile b/arch/arm/cpu/armv7/omap4/Makefile
index 987dc9d..9dc2b64 100644
--- a/arch/arm/cpu/armv7/omap4/Makefile
+++ b/arch/arm/cpu/armv7/omap4/Makefile
@@ -26,6 +26,8 @@ include $(TOPDIR)/config.mk
 LIB	=  $(obj)lib$(SOC).o
 
 SOBJS	+= lowlevel_init.o
+plus_sec := $(call as-instr,.arch_extension sec,+sec)
+lowlevel_init.o: AFLAGS += -Wa,-march=armv7-a$(plus_sec)
 
 COBJS	+= board.o
 COBJS	+= mem.o
diff --git a/config.mk b/config.mk
index c6d6f7b..8d86860 100644
--- a/config.mk
+++ b/config.mk
@@ -266,3 +266,12 @@ cmd_link_o_target = $(if $(strip $1),\
 		      rm -f $@; $(AR) rcs $@ )
 
 #########################################################################
+
+# Tries to compile an assembly instruction
+as-instr = $(shell if echo -e "$(1)" | \
+            $(CC) $(AFLAGS) -c -xassembler - \
+             -o $(TMPOUT)astest$$$$.out > /dev/null 2>&1; \
+         then rm $(TMPOUT)astest$$$$.out; echo "$(2)"; \
+         else echo "$(3)"; fi)
+
+#########################################################################
-- 
1.7.0.2



More information about the U-Boot mailing list