Browse Source

Make sure only supported compiler options are used
Import "cc-option" shell function from kernel and
use it to get the correct ARM GCC options for individual CPUs
Patch by Peter Pearse, 30 Jun 2005

Wolfgang Denk 19 năm trước cách đây
mục cha
commit
1820d4c73b

+ 5 - 0
CHANGELOG

@@ -2,6 +2,11 @@
 Changes for U-Boot 1.1.4:
 Changes for U-Boot 1.1.4:
 ======================================================================
 ======================================================================
 
 
+* Make sure only supported compiler options are used
+  Import "cc-option" shell function from kernel and
+  use it to get the correct ARM GCC options for individual CPUs
+  Patch by Peter Pearse, 30 Jun 2005
+
 * Fix 440GR to print correct cpu revision
 * Fix 440GR to print correct cpu revision
   Patch by Stefan Roese, 4 Oct 2005
   Patch by Stefan Roese, 4 Oct 2005
 
 

+ 6 - 0
config.mk

@@ -86,6 +86,12 @@ HOSTCFLAGS	= -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
 HOSTSTRIP	= strip
 HOSTSTRIP	= strip
 
 
 #########################################################################
 #########################################################################
+#
+# Option checker (courtesy linux kernel) to ensure
+# only supported compiler options are used
+#
+cc-option = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \
+             > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)
 
 
 #
 #
 # Include the make variables (CC, etc...)
 # Include the make variables (CC, etc...)

+ 10 - 1
cpu/arm1136/config.mk

@@ -21,6 +21,15 @@
 # MA 02111-1307 USA
 # MA 02111-1307 USA
 #
 #
 PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8 \
 PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8 \
+	-msoft-float
 
 
 # Make ARMv5 to allow more compilers to work, even though its v6.
 # Make ARMv5 to allow more compilers to work, even though its v6.
-PLATFORM_CPPFLAGS += -mapcs-32 -march=armv5
+PLATFORM_CPPFLAGS += -march=armv5
+# =========================================================================
+#
+# Supply options according to compiler version
+#
+# =========================================================================
+PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)
+PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
+

+ 10 - 2
cpu/arm720t/config.mk

@@ -23,6 +23,14 @@
 #
 #
 
 
 PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8 \
 PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8 \
-	-mshort-load-bytes -msoft-float
+	-msoft-float
+
+PLATFORM_CPPFLAGS += -march=armv4 -mtune=arm7tdmi
+# =========================================================================
+#
+# Supply options according to compiler version
+#
+# =========================================================================
+PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)
+PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
 
 
-PLATFORM_CPPFLAGS += -mapcs-32 -march=armv4 -mtune=arm7tdmi

+ 10 - 2
cpu/arm920t/config.mk

@@ -22,6 +22,14 @@
 #
 #
 
 
 PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8 \
 PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8 \
-	-mshort-load-bytes -msoft-float
+	-msoft-float
+
+PLATFORM_CPPFLAGS += -march=armv4
+# =========================================================================
+#
+# Supply options according to compiler version
+#
+# =========================================================================
+PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)
+PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
 
 
-PLATFORM_CPPFLAGS += -mapcs-32 -march=armv4

+ 10 - 2
cpu/arm925t/config.mk

@@ -22,6 +22,14 @@
 #
 #
 
 
 PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8 \
 PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8 \
-	-mshort-load-bytes -msoft-float
+	-msoft-float
+
+PLATFORM_CPPFLAGS += -march=armv4
+# =========================================================================
+#
+# Supply options according to compiler version
+#
+# =========================================================================
+PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)
+PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
 
 
-PLATFORM_CPPFLAGS += -mapcs-32 -march=armv4

+ 10 - 2
cpu/arm926ejs/config.mk

@@ -22,6 +22,14 @@
 #
 #
 
 
 PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8 \
 PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8 \
-	-mshort-load-bytes -msoft-float
+	-msoft-float
+
+PLATFORM_CPPFLAGS += -march=armv4
+# =========================================================================
+#
+# Supply options according to compiler version
+#
+# =========================================================================
+PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)
+PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
 
 
-PLATFORM_CPPFLAGS += -mapcs-32 -march=armv4

+ 10 - 2
cpu/ixp/config.mk

@@ -25,6 +25,14 @@
 BIG_ENDIAN = y
 BIG_ENDIAN = y
 
 
 PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8 \
 PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8 \
-	-mshort-load-bytes -msoft-float -mbig-endian
+	-msoft-float -mbig-endian
+
+PLATFORM_CPPFLAGS += -mbig-endian -march=armv4 -mtune=strongarm1100
+# =========================================================================
+#
+# Supply options according to compiler version
+#
+# =========================================================================
+PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)
+PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
 
 
-PLATFORM_CPPFLAGS += -mbig-endian -mapcs-32 -march=armv4 -mtune=strongarm1100

+ 10 - 2
cpu/lh7a40x/config.mk

@@ -22,6 +22,14 @@
 #
 #
 
 
 PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8 \
 PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8 \
-	-mshort-load-bytes -msoft-float
+	-msoft-float
+
+PLATFORM_CPPFLAGS += -march=armv4
+# =========================================================================
+#
+# Supply options according to compiler version
+#
+# ========================================================================
+PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)
+PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
 
 
-PLATFORM_CPPFLAGS += -mapcs-32 -march=armv4

+ 10 - 2
cpu/pxa/config.mk

@@ -23,7 +23,15 @@
 #
 #
 
 
 PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8 \
 PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8 \
-	-mshort-load-bytes -msoft-float
+	-msoft-float
 
 
 #PLATFORM_CPPFLAGS += -mapcs-32 -march=armv4 -mtune=strongarm1100
 #PLATFORM_CPPFLAGS += -mapcs-32 -march=armv4 -mtune=strongarm1100
-PLATFORM_CPPFLAGS += -mapcs-32 -march=armv5 -mtune=xscale
+PLATFORM_CPPFLAGS += -march=armv5 -mtune=xscale
+# =========================================================================
+#
+# Supply options according to compiler version
+#
+# ========================================================================
+PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)
+PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
+

+ 10 - 2
cpu/s3c44b0/config.mk

@@ -23,6 +23,14 @@
 #
 #
 
 
 PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8 \
 PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8 \
-	-mshort-load-bytes -msoft-float
+	-msoft-float
+
+PLATFORM_CPPFLAGS += -march=armv4 -mtune=arm7tdmi -msoft-float
+# =========================================================================
+#
+# Supply options according to compiler version
+#
+# ========================================================================
+PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)
+PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
 
 
-PLATFORM_CPPFLAGS += -mapcs-32 -march=armv4 -mtune=arm7tdmi -msoft-float

+ 10 - 2
cpu/sa1100/config.mk

@@ -23,6 +23,14 @@
 #
 #
 
 
 PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8 \
 PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8 \
-	-mshort-load-bytes -msoft-float
+	-msoft-float
+
+PLATFORM_CPPFLAGS += -march=armv4 -mtune=strongarm1100
+# =========================================================================
+#
+# Supply options according to compiler version
+#
+# ========================================================================
+PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)
+PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
 
 
-PLATFORM_CPPFLAGS += -mapcs-32 -march=armv4 -mtune=strongarm1100