]> git.sur5r.net Git - u-boot/commitdiff
Reduce build times
authorWolfgang Denk <wd@denx.de>
Tue, 1 Nov 2011 20:54:02 +0000 (20:54 +0000)
committerWolfgang Denk <wd@denx.de>
Thu, 3 Nov 2011 19:44:58 +0000 (20:44 +0100)
U-Boot Makefiles contain a number of tests for compiler features etc.
which so far are executed again and again.  On some architectures
(especially ARM) this results in a large number of calls to gcc.

This patch makes sure to run such tests only once, thus largely
reducing the number of "execve" system calls.

Example: number of "execve" system calls for building the "P2020DS"
(Power Architecture) and "qong" (ARM) boards, measured as:
-> strace -f -e trace=execve -o /tmp/foo ./MAKEALL <board>
-> grep execve /tmp/foo | wc -l

Before: After: Reduction:
==================================
P2020DS 20555 15205 -26%
qong 31692 14490 -54%

As a result, built times are significantly reduced, typically by
30...50%.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>
Cc: Kumar Gala <galak@kernel.crashing.org>
Cc: Albert Aribaud <albert.aribaud@free.fr>
cc: Graeme Russ <graeme.russ@gmail.com>
cc: Mike Frysinger <vapier@gentoo.org>
Tested-by: Graeme Russ <graeme.russ@gmail.com>
Tested-by: Matthias Weisser <weisserm@arcor.de>
Tested-by: Sanjeev Premi <premi@ti.com>
Tested-by: Simon Glass <sjg@chromium.org>
Tested-by: Macpaul Lin <macpaul@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
25 files changed:
Makefile
arch/arm/config.mk
arch/arm/cpu/arm1136/config.mk
arch/arm/cpu/arm1176/config.mk
arch/arm/cpu/arm1176/s3c64xx/config.mk
arch/arm/cpu/arm720t/config.mk
arch/arm/cpu/arm920t/config.mk
arch/arm/cpu/arm925t/config.mk
arch/arm/cpu/arm926ejs/at91/config.mk
arch/arm/cpu/arm926ejs/config.mk
arch/arm/cpu/arm946es/config.mk
arch/arm/cpu/arm_intcm/config.mk
arch/arm/cpu/armv7/config.mk
arch/arm/cpu/armv7/omap-common/config.mk
arch/arm/cpu/ixp/config.mk
arch/arm/cpu/lh7a40x/config.mk
arch/arm/cpu/pxa/config.mk
arch/arm/cpu/s3c44b0/config.mk
arch/arm/cpu/sa1100/config.mk
arch/powerpc/cpu/mpc824x/Makefile
arch/powerpc/cpu/mpc85xx/config.mk
arch/x86/config.mk
board/siemens/SCM/Makefile
config.mk
examples/standalone/Makefile

index 9ef33f9fd1368ff4aa3881a281b0cfd2a24762bb..82de62b011478181899a228be6d95ab796faffa3 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -320,7 +320,7 @@ else
 PLATFORM_LIBGCC = -L $(USE_PRIVATE_LIBGCC) -lgcc
 endif
 else
-PLATFORM_LIBGCC = -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
+PLATFORM_LIBGCC := -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
 endif
 PLATFORM_LIBS += $(PLATFORM_LIBGCC)
 export PLATFORM_LIBS
index 9b4e581b2d05dec619ee3d490442612701b5f342..45f9dca5d5a2fa3ba84fc58e7eadb56b3ad957ae 100644 (file)
@@ -34,7 +34,7 @@ endif
 PLATFORM_CPPFLAGS += -DCONFIG_ARM -D__ARM__
 
 # Explicitly specifiy 32-bit ARM ISA since toolchain default can be -mthumb:
-PLATFORM_CPPFLAGS += $(call cc-option,-marm,)
+PF_CPPFLAGS_ARM := $(call cc-option,-marm,)
 
 # Try if EABI is supported, else fall back to old API,
 # i. e. for example:
@@ -44,15 +44,16 @@ PLATFORM_CPPFLAGS += $(call cc-option,-marm,)
 #      -mabi=apcs-gnu -mno-thumb-interwork
 # - with ELDK 3.1 (gcc 3.x), use:
 #      -mapcs-32 -mno-thumb-interwork
-PLATFORM_CPPFLAGS += $(call cc-option,\
-                               -mabi=aapcs-linux -mno-thumb-interwork,\
+PF_CPPFLAGS_ABI := $(call cc-option,\
+                       -mabi=aapcs-linux -mno-thumb-interwork,\
+                       $(call cc-option,\
+                               -mapcs-32,\
                                $(call cc-option,\
-                                       -mapcs-32,\
-                                       $(call cc-option,\
-                                               -mabi=apcs-gnu,\
-                                       )\
-                               ) $(call cc-option,-mno-thumb-interwork,)\
-                       )
+                                       -mabi=apcs-gnu,\
+                               )\
+                       ) $(call cc-option,-mno-thumb-interwork,)\
+               )
+PLATFORM_CPPFLAGS += $(PF_CPPFLAGS_ARM) $(PF_CPPFLAGS_ABI)
 
 # For EABI, make sure to provide raise()
 ifneq (,$(findstring -mabi=aapcs-linux,$(PLATFORM_CPPFLAGS)))
index 3e685354ab76bf411b16c32c8cec8813de4d8897..efee0d1dca6253f69839e1cb3be8f594a192236c 100644 (file)
@@ -29,4 +29,5 @@ PLATFORM_CPPFLAGS += -march=armv5
 # Supply options according to compiler version
 #
 # =========================================================================
-PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
+PF_RELFLAGS_SLB_AT := $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
+PLATFORM_RELFLAGS += $(PF_RELFLAGS_SLB_AT)
index 14346cfff3f865c95cc6c076abb24ca6b23c2ff6..222d352b3a88dc7e25c042d6d82db4adec29d129 100644 (file)
@@ -29,4 +29,6 @@ PLATFORM_CPPFLAGS += -march=armv5t
 # Supply options according to compiler version
 #
 # =========================================================================
-PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
+PF_RELFLAGS_SLB_AT := $(call cc-option,-mshort-load-bytes,\
+                       $(call cc-option,-malignment-traps,))
+PLATFORM_RELFLAGS += $(PF_RELFLAGS_SLB_AT)
index 14346cfff3f865c95cc6c076abb24ca6b23c2ff6..222d352b3a88dc7e25c042d6d82db4adec29d129 100644 (file)
@@ -29,4 +29,6 @@ PLATFORM_CPPFLAGS += -march=armv5t
 # Supply options according to compiler version
 #
 # =========================================================================
-PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
+PF_RELFLAGS_SLB_AT := $(call cc-option,-mshort-load-bytes,\
+                       $(call cc-option,-malignment-traps,))
+PLATFORM_RELFLAGS += $(PF_RELFLAGS_SLB_AT)
index 3844c626af331d64bade986b5bc08489c0aced4d..210c6dcb08a3e2ef2eae282114a621b5ca2eb5b6 100644 (file)
@@ -30,4 +30,6 @@ PLATFORM_CPPFLAGS += -march=armv4 -mtune=arm7tdmi
 # Supply options according to compiler version
 #
 # =========================================================================
-PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
+PF_RELFLAGS_SLB_AT := $(call cc-option,-mshort-load-bytes,\
+                       $(call cc-option,-malignment-traps,))
+PLATFORM_RELFLAGS += $(PF_RELFLAGS_SLB_AT)
index 8f6c1a354c5b23d696ec7d52393b62fb7e39648b..f03030a2fa5aaf5a08a946fba9b6bed038485b38 100644 (file)
@@ -29,4 +29,5 @@ PLATFORM_CPPFLAGS += -march=armv4
 # Supply options according to compiler version
 #
 # =========================================================================
-PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
+PF_RELFLAGS_SLB_AT := $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
+PLATFORM_RELFLAGS += $(PF_RELFLAGS_SLB_AT)
index 8f6c1a354c5b23d696ec7d52393b62fb7e39648b..f03030a2fa5aaf5a08a946fba9b6bed038485b38 100644 (file)
@@ -29,4 +29,5 @@ PLATFORM_CPPFLAGS += -march=armv4
 # Supply options according to compiler version
 #
 # =========================================================================
-PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
+PF_RELFLAGS_SLB_AT := $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
+PLATFORM_RELFLAGS += $(PF_RELFLAGS_SLB_AT)
index 19296fdba2a462ce135ab0a168260982898ae3f2..370630d4de08192b8615298d7b39079d6c8d3d68 100644 (file)
@@ -1 +1,2 @@
-PLATFORM_CPPFLAGS += $(call cc-option,-mtune=arm926ejs,)
+PF_CPPFLAGS_TUNE := $(call cc-option,-mtune=arm926ejs,)
+PLATFORM_CPPFLAGS += $(PF_CPPFLAGS_TUNE)
index f8ef90f2d5180365d5c4719708cf71d98458c432..ffb2e6c3ea76bfa7b0cd7873546995a34ce47fd8 100644 (file)
@@ -29,4 +29,5 @@ PLATFORM_CPPFLAGS += -march=armv5te
 # Supply options according to compiler version
 #
 # =========================================================================
-PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
+PF_RELFLAGS_SLB_AT := $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
+PLATFORM_RELFLAGS += $(PF_RELFLAGS_SLB_AT)
index e783f697a10f2337e825ba65cf9357f8d9a623ba..c2354ba4e9e548865f7d70b3f78301f12f186f72 100644 (file)
@@ -29,4 +29,5 @@ PLATFORM_CPPFLAGS +=  -march=armv4
 # Supply options according to compiler version
 #
 # =========================================================================
-PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
+PF_RELFLAGS_SLB_AT := $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
+PLATFORM_RELFLAGS += $(PF_RELFLAGS_SLB_AT)
index e783f697a10f2337e825ba65cf9357f8d9a623ba..c2354ba4e9e548865f7d70b3f78301f12f186f72 100644 (file)
@@ -29,4 +29,5 @@ PLATFORM_CPPFLAGS +=  -march=armv4
 # Supply options according to compiler version
 #
 # =========================================================================
-PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
+PF_RELFLAGS_SLB_AT := $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
+PLATFORM_RELFLAGS += $(PF_RELFLAGS_SLB_AT)
index 49ac9c74aeb2e98001064217268eba8578178989..83ddf10f1f60197a6a2e97c660c4e266fd3b8234 100644 (file)
@@ -29,5 +29,5 @@ PLATFORM_CPPFLAGS += -march=armv5
 # Supply options according to compiler version
 #
 # =========================================================================
-PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,\
-                   $(call cc-option,-malignment-traps,))
+PF_RELFLAGS_SLB_AT := $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
+PLATFORM_RELFLAGS += $(PF_RELFLAGS_SLB_AT)
index 49ac9c74aeb2e98001064217268eba8578178989..c400dccba8a3a4334d8ab308c83a27a78eea5751 100644 (file)
@@ -29,5 +29,6 @@ PLATFORM_CPPFLAGS += -march=armv5
 # Supply options according to compiler version
 #
 # =========================================================================
-PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,\
-                   $(call cc-option,-malignment-traps,))
+PF_RELFLAGS_SLB_AT := $(call cc-option,-mshort-load-bytes,\
+                       $(call cc-option,-malignment-traps,))
+PLATFORM_RELFLAGS += $(PF_RELFLAGS_SLB_AT)
index 5868cba38b7f3f3d3d486e52c227c4d4f2ce847e..914966599903fb08d6fceb547d93c7cf517680bc 100644 (file)
@@ -37,4 +37,5 @@ LDFLAGS_u-boot += --gc-sections
 # Supply options according to compiler version
 #
 # =========================================================================
-PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
+PF_RELFLAGS_SLB_AT := $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
+PLATFORM_RELFLAGS += $(PF_RELFLAGS_SLB_AT)
index 47b2b7b722ddf75813a1b34a0114b1e44d69d902..1c4aa97eaa610b7ae816ad8b70e0ad182f20aea9 100644 (file)
@@ -29,4 +29,5 @@ PLATFORM_CPPFLAGS += -march=armv4
 # Supply options according to compiler version
 #
 # ========================================================================
-PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
+PF_RELFLAGS_SLB_AT := $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
+PLATFORM_RELFLAGS += $(PF_RELFLAGS_SLB_AT)
index a05d69ca270c0deb05822c4fce55cdbdacc41763..0bbe295a2c051ba954a7c7b2b3472e7b3d001cc6 100644 (file)
@@ -30,4 +30,5 @@ PLATFORM_CPPFLAGS += -march=armv5te -mtune=xscale
 # Supply options according to compiler version
 #
 # ========================================================================
-PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
+PF_RELFLAGS_SLB_AT := $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
+PLATFORM_RELFLAGS += $(PF_RELFLAGS_SLB_AT)
index 7454d728a55a93a8177b962f5c6a55986f3815e9..f6f6398e6e54450c2c0cd59c96a67572ce2c036e 100644 (file)
@@ -30,4 +30,5 @@ PLATFORM_CPPFLAGS += -march=armv4 -mtune=arm7tdmi -msoft-float
 # Supply options according to compiler version
 #
 # ========================================================================
-PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
+PF_RELFLAGS_SLB_AT := $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
+PLATFORM_RELFLAGS += $(PF_RELFLAGS_SLB_AT)
index 6f21f410be33ef507f219968baf7b809caf13bd8..06af16088df5b0ef92641161d1b16da6896d30f8 100644 (file)
@@ -30,4 +30,5 @@ PLATFORM_CPPFLAGS += -march=armv4 -mtune=strongarm1100
 # Supply options according to compiler version
 #
 # ========================================================================
-PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
+PF_RELFLAGS_SLB_AT := $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
+PLATFORM_RELFLAGS += $(PF_RELFLAGS_SLB_AT)
index 2bfcd8548c23f28eb2f0cc98a511b20d96838963..ebf4cb25122117fa16243d7285d2afe3b9579a39 100644 (file)
@@ -23,8 +23,7 @@
 
 include $(TOPDIR)/config.mk
 ifneq ($(OBJTREE),$(SRCTREE))
-$(shell mkdir -p $(obj)drivers/epic)
-$(shell mkdir -p $(obj)drivers/i2c)
+$(shell mkdir -p $(obj)drivers/epic $(obj)drivers/i2c)
 endif
 
 LIB    = $(obj)lib$(CPU).o
index 68ac57dd0de6df2f893f9375681c57054e76a3cc..f36d8230544a6e0abd0ffcfe6a57bd5bde5f2167 100644 (file)
@@ -28,5 +28,6 @@ PLATFORM_CPPFLAGS += -ffixed-r2 -Wa,-me500 -msoft-float -mno-string
 # -mspe=yes is needed to have -mno-spe accepted by a buggy GCC;
 # see "[PATCH,rs6000] make -mno-spe work as expected" on
 # http://gcc.gnu.org/ml/gcc-patches/2008-04/msg00311.html
-PLATFORM_CPPFLAGS +=$(call cc-option,-mspe=yes)
-PLATFORM_CPPFLAGS +=$(call cc-option,-mno-spe)
+PF_CPPFLAGS_SPE := $(call cc-option,-mspe=yes) \
+                  $(call cc-option,-mno-spe)
+PLATFORM_CPPFLAGS += $(PF_CPPFLAGS_SPE)
index ee23c9f87d29fd20e6b6c12ac06a9da12d02790d..fe9083f6268a8646efd90c0a1e25972589158f61 100644 (file)
@@ -27,10 +27,12 @@ PLATFORM_CPPFLAGS += -fno-strict-aliasing
 PLATFORM_CPPFLAGS += -Wstrict-prototypes
 PLATFORM_CPPFLAGS += -mregparm=3
 PLATFORM_CPPFLAGS += -fomit-frame-pointer
-PLATFORM_CPPFLAGS += $(call cc-option, -ffreestanding)
-PLATFORM_CPPFLAGS += $(call cc-option, -fno-toplevel-reorder,  $(call cc-option, -fno-unit-at-a-time))
-PLATFORM_CPPFLAGS += $(call cc-option, -fno-stack-protector)
-PLATFORM_CPPFLAGS += $(call cc-option, -mpreferred-stack-boundary=2)
+PF_CPPFLAGS_X86   := $(call cc-option, -ffreestanding) \
+                    $(call cc-option, -fno-toplevel-reorder, \
+                      $(call cc-option, -fno-unit-at-a-time)) \
+                    $(call cc-option, -fno-stack-protector) \
+                    $(call cc-option, -mpreferred-stack-boundary=2)
+PLATFORM_CPPFLAGS += $(PF_CPPFLAGS_X86)
 PLATFORM_CPPFLAGS += -fno-dwarf2-cfi-asm
 PLATFORM_CPPFLAGS += -DREALMODE_BASE=0x7c0
 
index 07cc5a659d2893c57fd4b31ed1d6306258ae2388..07db9d44e5db46446da4429754a571ae71163b4f 100644 (file)
@@ -24,8 +24,7 @@
 include $(TOPDIR)/config.mk
 
 ifneq ($(OBJTREE),$(SRCTREE))
-$(shell mkdir -p $(obj)../common)
-$(shell mkdir -p $(obj)../../tqc/tqm8xx)
+$(shell mkdir -p $(obj)../common $(obj)../../tqc/tqm8xx)
 endif
 
 LIB    = $(obj)lib$(BOARD).o
index 11b67e540ef35cf0ab51c1bd4fb5892a5d1baea5..918cffe3eb70c677c997778932c07050109a677f 100644 (file)
--- a/config.mk
+++ b/config.mk
@@ -209,11 +209,13 @@ else
 CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes
 endif
 
-CFLAGS += $(call cc-option,-fno-stack-protector)
+CFLAGS_SSP := $(call cc-option,-fno-stack-protector)
+CFLAGS += $(CFLAGS_SSP)
 # Some toolchains enable security related warning flags by default,
 # but they don't make much sense in the u-boot world, so disable them.
-CFLAGS += $(call cc-option,-Wno-format-nonliteral)
-CFLAGS += $(call cc-option,-Wno-format-security)
+CFLAGS_WARN := $(call cc-option,-Wno-format-nonliteral) \
+              $(call cc-option,-Wno-format-security)
+CFLAGS += $(CFLAGS_WARN)
 
 # $(CPPFLAGS) sets -g, which causes gcc to pass a suitable -g<format>
 # option to the assembler.
index b1e33fba73d084b03f41da6c1c68dd6fd60a191c..e23865b4b020ba0781335cf81c82ae2168630702 100644 (file)
@@ -85,7 +85,8 @@ endif
 # We don't want gcc reordering functions if possible.  This ensures that an
 # application's entry point will be the first function in the application's
 # source file.
-CFLAGS += $(call cc-option,-fno-toplevel-reorder)
+CFLAGS_NTR := $(call cc-option,-fno-toplevel-reorder)
+CFLAGS += $(CFLAGS_NTR)
 
 all:   $(obj).depend $(OBJS) $(LIB) $(SREC) $(BIN) $(ELF)