diff mbox

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

Message ID 1295894210-14541-1-git-send-email-vjaquez@igalia.com
State Rejected, archived
Headers show

Commit Message

Víctor Manuel Jáquez Leal Jan. 24, 2011, 6:36 p.m. UTC
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@igalia.com>
---
 arch/arm/cpu/armv7/omap4/Makefile |    2 ++
 config.mk                         |    9 +++++++++
 2 files changed, 11 insertions(+), 0 deletions(-)

Comments

Steve Sakoman Jan. 24, 2011, 6:56 p.m. UTC | #1
On Mon, 2011-01-24 at 19:36 +0100, Víctor Manuel Jáquez Leal wrote:
> 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)

Just to clarify -- my branch has Aneesh's "armv7: adapt omap4 to the new
cache maintenance framework" patch series in it.

So this issue will arise only when Aneesh's patch series is applied.

Perhaps this fix could be incorporated into Aneesh's next revision??

Steve

> 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@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)
> +
> +#########################################################################
Wolfgang Denk Jan. 24, 2011, 7:14 p.m. UTC | #2
Dear Steve Sakoman,

In message <1295895368.1999.14.camel@quadra> you wrote:
> On Mon, 2011-01-24 at 19:36 +0100, Víctor Manuel Jáquez Leal wrote:
> > 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)
> 
> Just to clarify -- my branch has Aneesh's "armv7: adapt omap4 to the new
> cache maintenance framework" patch series in it.
> 
> So this issue will arise only when Aneesh's patch series is applied.

I have a bsic question: do we really need  -march=armv7-a  at all in
U-Boot?  What is it good for?

Best regards,

Wolfgang Denk
diff mbox

Patch

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)
+
+#########################################################################