[U-Boot-Users] Problem building U-Boot for ARM target

Dear all,
I'm using the GCC 3.2 toolchain for building U-Boot (current head of git) for an ARM target. I get the following error: cc1: invalid option 'abi=apcs-gnu'
This option (correct me if I'm wrong) was introduced with a recent patch by Peter Pearse. Digging a bit in gcc.gnu.org it appears that this option comes only with GCC 4.0!
Is this a known behaviour?
BTW: removing this option from 'cpu/armxxx/config.mk' U-Boot builds fine!
Best regards
-P.Broggini

Paolo Broggini pbroggini@softool.ch wrote:
I'm using the GCC 3.2 toolchain for building U-Boot (current head of git) for an ARM target. I get the following error: cc1: invalid option 'abi=apcs-gnu'
This option (correct me if I'm wrong) was introduced with a recent patch by Peter Pearse. Digging a bit in gcc.gnu.org it appears that this option comes only with GCC 4.0!
That's true but the cc-option checker should use -mapcs-32 if it is available, otherwise it will fall back to -mabi=apcs-gnu. It looks like your compiler doesn't support the first option either. In this case, I'm not sure it worked before Peter's patch. What CPU is it?
You could try the following in your config.mk but you should investigate why -mapcs-32 doesn't work:
PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,$(call cc-option,-mabi=apcs-gnu,))

Catalin Marinas ha scritto:
Paolo Broggini pbroggini@softool.ch wrote:
I'm using the GCC 3.2 toolchain for building U-Boot (current head of git) for an ARM target. I get the following error: cc1: invalid option 'abi=apcs-gnu'
This option (correct me if I'm wrong) was introduced with a recent patch by Peter Pearse. Digging a bit in gcc.gnu.org it appears that this option comes only with GCC 4.0!
That's true but the cc-option checker should use -mapcs-32 if it is available, otherwise it will fall back to -mabi=apcs-gnu. It looks like your compiler doesn't support the first option either. In this case, I'm not sure it worked before Peter's patch.
Yes it did, I build U-Boot for quite a long time.
What CPU is it?
Freescale MC9328MX1
You could try the following in your config.mk but you should investigate why -mapcs-32 doesn't work:
Yes it do work!
PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,$(call cc-option,-mabi=apcs-gnu,))
Great, with this it builds fine :-) but the statement contained in the head of git 'config.mk' is: PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)
It also builds fine if I replace the above statement with: PLATFORM_CPPFLAGS += -march=armv4, -mapcs-32 like it was before Peters's patch.
Thanks
-P.Broggini

Paolo Broggini pbroggini@softool.ch wrote:
Catalin Marinas ha scritto:
PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,$(call cc-option,-mabi=apcs-gnu,))
Great, with this it builds fine :-) but the statement contained in the head of git 'config.mk' is:
PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)
My proposals tries both -mapcs-32 and -mabi=apcs-gnu and if neither works it doesn't add anything.
In your config.mk file, can you change -mapcs-32 with -g (this one would never fail) just to make sure there isn't any problem with the option checker?
Thanks.

Catalin Marinas ha scritto:
Paolo Broggini pbroggini@softool.ch wrote:
Catalin Marinas ha scritto:
PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,$(call cc-option,-mabi=apcs-gnu,))
Great, with this it builds fine :-) but the statement contained in the head of git 'config.mk' is:
PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)
My proposals tries both -mapcs-32 and -mabi=apcs-gnu and if neither works it doesn't add anything.
-mapcs-32 do work, -mabi=apcs-gnu doesn't!
In your config.mk file, can you change -mapcs-32 with -g (this one would never fail) just to make sure there isn't any problem with the option checker?
Ok, see below: 1) PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu) -> gcc complains about '-mabi=apcs-gnu' (see my original mail)
2) PLATFORM_CPPFLAGS +=$(call cc-option,-g,-mabi=apcs-gnu) -> everything compiles fine, the option used is '-g'
3) PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-g) -> everything compiles fine, the option used is '-mapcs-32'
Thanks
-P.Broggini

Paolo Broggini pbroggini@softool.ch wrote:
PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu) -> gcc complains about '-mabi=apcs-gnu' (see my original mail)
PLATFORM_CPPFLAGS +=$(call cc-option,-g,-mabi=apcs-gnu) -> everything compiles fine, the option used is '-g'
PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-g) -> everything compiles fine, the option used is '-mapcs-32'
Very weird. A 'make' bug maybe? I don't see why 1 and 3 checks return different options. If you write a shorter version in 1 like -mapbi=a, would it make any difference?

Catalin Marinas ha scritto:
Paolo Broggini pbroggini@softool.ch wrote:
PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu) -> gcc complains about '-mabi=apcs-gnu' (see my original mail)
PLATFORM_CPPFLAGS +=$(call cc-option,-g,-mabi=apcs-gnu) -> everything compiles fine, the option used is '-g'
PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-g) -> everything compiles fine, the option used is '-mapcs-32'
I don't see why 1 and 3 checks return different options.
Indeed!
Well may be it starts to become out-of-topics here in U-Boot list, but just one more thing: I tried the macro cc-option "by hand" (so without $CFLAGS) in a bash shell and I got the same results as above, i.e. the check for option -mapcs-32 fails but the compiler support it and indeed the compilation works fine! May be a bug?
Thanks
-P.Broggini

Paolo Broggini pbroggini@softool.ch wrote:
Well may be it starts to become out-of-topics here in U-Boot list, but just one more thing:
I don't think it is OT as long as the config.mk files are part of U-Boot and they don't work as expected (unless the bug is definitely in a different tool).
I tried the macro cc-option "by hand" (so without $CFLAGS) in a bash shell and I got the same results as above, i.e. the check for option -mapcs-32 fails but the compiler support it and indeed the compilation works fine! May be a bug?
I tried the below file (with CC set to your compiler) and it works as expected for me (called with the two options as arguments), choosing -mapcs-32 (but it's a 3.4.0 compiler):
#!/bin/sh
CC=arm-linux-gcc
if $CC $1 -S -o /dev/null -xc /dev/null \ > /dev/null 2>&1; then echo "$1"; else echo "$2"; fi;
You could look for bug in the shell as well

Catalin Marinas ha scritto:
Paolo Broggini pbroggini@softool.ch wrote:
I don't think it is OT as long as the config.mk files are part of U-Boot and they don't work as expected (unless the bug is definitely in a different tool).
Ok
I tried the below file (with CC set to your compiler) and it works as expected for me (called with the two options as arguments), choosing -mapcs-32 (but it's a 3.4.0 compiler):
#!/bin/sh
CC=arm-linux-gcc
if $CC $1 -S -o /dev/null -xc /dev/null \ > /dev/null 2>&1; then echo "$1"; else echo "$2"; fi;
You could look for bug in the shell as well
I start to be a litle bit confused. I tried what you suggested above and it works as expected here to i.e. it chooses -mapcs-32!!!!!!!! But if I build U-Boot it still fails, it takes the wrong option!
What about if you tried to buid U-Boot ?
Best regards -P.Broggini
participants (2)
-
Catalin Marinas
-
Paolo Broggini