[U-Boot-Users] Wrong compiler called for as flags

Robert Schwebel robert at schwebel.de
Sat Jun 12 20:49:45 CEST 2004


Hi, 

while trying to make u-boot gcc-3.4 compilable I just found a strange
effect. The attached patch tries to fix the issues that came up on the
list during the last days. 

As gcc-2.95.3 is not able to generate code with -march=armv5
-mtune=xscale, I tried to make the decision on compile time by finding
out which compiler we have. This basically works, but for the
compilation of cpu/pxa/start.S it looks like the host compiler is taken
instead of the cross-gcc to determine the compiler flags. You can easily
reproduce this by applying my patch and compiling with a 2.95.3 cross
gcc, then grepping the output for 'armv5'. The incorrect results come
from the fact that, in this case, CROSS_COMPILE is not set, so instead
of arm-linux-gcc the host gcc is called to determine the test. 

My assumption is that the effect comes from the order the different
Makefiles and config.mk files are included when being called from
cpu/pxa. Unfortunately this is not easy to debug - maybe there is
somebody with better Makefile debugging skills than me on the list ;) 

Robert
-- 
 Dipl.-Ing. Robert Schwebel | http://www.pengutronix.de
 Pengutronix - Linux Solutions for Science and Industry
   Handelsregister:  Amtsgericht Hildesheim, HRA 2686
     Hornemannstraße 12,  31137 Hildesheim, Germany
    Phone: +49-5121-28619-0 |  Fax: +49-5121-28619-4
-------------- next part --------------
# 
# Author:       Robert Schwebel <r.schwebel at pengutronix.de>
# 
# Description:  Changelog Entry:
#
#               * Patch by Robert Schwebel, 12 June  2004:
#                 decide on compile time: gcc < 3.x builds xscale code 
#                 optimized for strong arm, > 3.x for xscale. 
#
#               * Patch by Robert Schwebel, 12 June 2004:
#                 make SMC91111 driver compile with gcc-3.4
#
#               * Patch by Richard Woodruff, 11.June 2004:
#                 remove 'static in stubs.c, to compile with gcc-3.4
#
# State:        2004-06-12: submitted
#


#
# Patch managed by http://www.mn-logistik.de/unsupported/pxa250/patcher
#

--- u-boot-maintainance/cpu/pxa/config.mk~submit-gcc34	2004-06-12 18:53:17.000000000 +0200
+++ u-boot-maintainance/cpu/pxa/config.mk	2004-06-12 19:54:18.000000000 +0200
@@ -23,6 +23,12 @@
 #
 
 PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8 \
-	-mshort-load-bytes -msoft-float
+	-msoft-float
+
+# GCC < 3.x cannot optimize for xscale and ARMv5
 
+ifeq (0, $(shell test `$(CC) -dumpversion | sed -e 's/\([0-9]\)\..*/\1/'` -gt 2; echo $$?))
+PLATFORM_CPPFLAGS += -mapcs-32 -march=armv5 -mtune=xscale
+else
 PLATFORM_CPPFLAGS += -mapcs-32 -march=armv4 -mtune=strongarm1100
+endif
--- u-boot-maintainance/cpu/arm720t/config.mk~submit-gcc34	2004-06-12 18:53:17.000000000 +0200
+++ u-boot-maintainance/cpu/arm720t/config.mk	2004-06-12 18:53:20.000000000 +0200
@@ -23,6 +23,6 @@
 #
 
 PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8 \
-	-mshort-load-bytes -msoft-float
+	-msoft-float
 
 PLATFORM_CPPFLAGS += -mapcs-32 -march=armv4 -mtune=arm7tdmi
--- u-boot-maintainance/cpu/arm920t/config.mk~submit-gcc34	2004-06-12 18:53:17.000000000 +0200
+++ u-boot-maintainance/cpu/arm920t/config.mk	2004-06-12 18:53:20.000000000 +0200
@@ -22,6 +22,6 @@
 #
 
 PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8 \
-	-mshort-load-bytes -msoft-float
+	-msoft-float
 
 PLATFORM_CPPFLAGS += -mapcs-32 -march=armv4
--- u-boot-maintainance/cpu/arm925t/config.mk~submit-gcc34	2004-06-12 18:53:17.000000000 +0200
+++ u-boot-maintainance/cpu/arm925t/config.mk	2004-06-12 18:53:20.000000000 +0200
@@ -22,6 +22,6 @@
 #
 
 PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8 \
-	-mshort-load-bytes -msoft-float
+	-msoft-float
 
 PLATFORM_CPPFLAGS += -mapcs-32 -march=armv4
--- u-boot-maintainance/cpu/arm926ejs/config.mk~submit-gcc34	2004-06-12 18:53:17.000000000 +0200
+++ u-boot-maintainance/cpu/arm926ejs/config.mk	2004-06-12 18:53:20.000000000 +0200
@@ -22,6 +22,6 @@
 #
 
 PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8 \
-	-mshort-load-bytes -msoft-float
+	-msoft-float
 
 PLATFORM_CPPFLAGS += -mapcs-32 -march=armv4
--- u-boot-maintainance/cpu/at91rm9200/config.mk~submit-gcc34	2004-06-12 18:53:17.000000000 +0200
+++ u-boot-maintainance/cpu/at91rm9200/config.mk	2004-06-12 18:53:20.000000000 +0200
@@ -22,6 +22,6 @@
 # MA 02111-1307 USA
 #
 PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8 \
-	-mshort-load-bytes -msoft-float
+	-msoft-float
 
 PLATFORM_CPPFLAGS += -mapcs-32 -march=armv4 -mtune=arm7tdmi
--- u-boot-maintainance/cpu/ixp/config.mk~submit-gcc34	2004-06-12 18:53:17.000000000 +0200
+++ u-boot-maintainance/cpu/ixp/config.mk	2004-06-12 18:53:20.000000000 +0200
@@ -25,6 +25,6 @@
 BIG_ENDIAN = y
 
 PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8 \
-	-mshort-load-bytes -msoft-float -mbig-endian
+	-msoft-float -mbig-endian
 
 PLATFORM_CPPFLAGS += -mbig-endian -mapcs-32 -march=armv4 -mtune=strongarm1100
--- u-boot-maintainance/cpu/lh7a40x/config.mk~submit-gcc34	2004-06-12 18:53:17.000000000 +0200
+++ u-boot-maintainance/cpu/lh7a40x/config.mk	2004-06-12 18:53:20.000000000 +0200
@@ -22,6 +22,6 @@
 #
 
 PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8 \
-	-mshort-load-bytes -msoft-float
+	-msoft-float
 
 PLATFORM_CPPFLAGS += -mapcs-32 -march=armv4
--- u-boot-maintainance/cpu/mc9328/config.mk~submit-gcc34	2004-06-12 18:53:17.000000000 +0200
+++ u-boot-maintainance/cpu/mc9328/config.mk	2004-06-12 18:53:20.000000000 +0200
@@ -22,6 +22,6 @@
 #
 
 PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8 \
-	-mshort-load-bytes -msoft-float
+	-msoft-float
 
 PLATFORM_CPPFLAGS += -mapcs-32 -march=armv4
--- u-boot-maintainance/cpu/s3c44b0/config.mk~submit-gcc34	2004-06-12 18:53:17.000000000 +0200
+++ u-boot-maintainance/cpu/s3c44b0/config.mk	2004-06-12 18:53:20.000000000 +0200
@@ -23,6 +23,6 @@
 #
 
 PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8 \
-	-mshort-load-bytes -msoft-float
+	-msoft-float
 
 PLATFORM_CPPFLAGS += -mapcs-32 -march=armv4 -mtune=arm7tdmi -msoft-float
--- u-boot-maintainance/cpu/sa1100/config.mk~submit-gcc34	2004-06-12 18:53:17.000000000 +0200
+++ u-boot-maintainance/cpu/sa1100/config.mk	2004-06-12 18:53:20.000000000 +0200
@@ -23,6 +23,6 @@
 #
 
 PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8 \
-	-mshort-load-bytes -msoft-float
+	-msoft-float
 
 PLATFORM_CPPFLAGS += -mapcs-32 -march=armv4 -mtune=strongarm1100
--- u-boot-maintainance/drivers/smc91111.c~submit-gcc34	2004-06-12 18:53:17.000000000 +0200
+++ u-boot-maintainance/drivers/smc91111.c	2004-06-12 18:53:20.000000000 +0200
@@ -1414,7 +1414,9 @@
 	/* Re-Configure the Receive/Phy Control register */
 	SMC_outw (RPC_DEFAULT, RPC_REG);
 
-      smc_phy_configure_exit:
+smc_phy_configure_exit:
+
+	return;
 
 }
 #endif /* !CONFIG_SMC91111_EXT_PHY */
--- u-boot-maintainance/examples/stubs.c~submit-gcc34	2004-06-12 18:53:17.000000000 +0200
+++ u-boot-maintainance/examples/stubs.c	2004-06-12 18:53:20.000000000 +0200
@@ -117,7 +117,7 @@
  * implementation. On the other hand, asm() statements with
  * arguments can be used only inside the functions (gcc limitation)
  */
-static void __attribute__((unused)) dummy(void)
+void __attribute__((unused)) dummy(void)
 {
 #include <_exports.h>
 }


More information about the U-Boot mailing list