Commit cca4e4aec1fe52e5ecd15e3cebdbb36e2f254220

Authored by Wolfgang Denk
1 parent 4d6402b012

Reduce build times

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>

Showing 25 changed files with 67 additions and 43 deletions Side-by-side Diff

... ... @@ -320,7 +320,7 @@
320 320 PLATFORM_LIBGCC = -L $(USE_PRIVATE_LIBGCC) -lgcc
321 321 endif
322 322 else
323   -PLATFORM_LIBGCC = -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
  323 +PLATFORM_LIBGCC := -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
324 324 endif
325 325 PLATFORM_LIBS += $(PLATFORM_LIBGCC)
326 326 export PLATFORM_LIBS
... ... @@ -34,7 +34,7 @@
34 34 PLATFORM_CPPFLAGS += -DCONFIG_ARM -D__ARM__
35 35  
36 36 # Explicitly specifiy 32-bit ARM ISA since toolchain default can be -mthumb:
37   -PLATFORM_CPPFLAGS += $(call cc-option,-marm,)
  37 +PF_CPPFLAGS_ARM := $(call cc-option,-marm,)
38 38  
39 39 # Try if EABI is supported, else fall back to old API,
40 40 # i. e. for example:
41 41  
... ... @@ -44,15 +44,16 @@
44 44 # -mabi=apcs-gnu -mno-thumb-interwork
45 45 # - with ELDK 3.1 (gcc 3.x), use:
46 46 # -mapcs-32 -mno-thumb-interwork
47   -PLATFORM_CPPFLAGS += $(call cc-option,\
48   - -mabi=aapcs-linux -mno-thumb-interwork,\
  47 +PF_CPPFLAGS_ABI := $(call cc-option,\
  48 + -mabi=aapcs-linux -mno-thumb-interwork,\
  49 + $(call cc-option,\
  50 + -mapcs-32,\
49 51 $(call cc-option,\
50   - -mapcs-32,\
51   - $(call cc-option,\
52   - -mabi=apcs-gnu,\
53   - )\
54   - ) $(call cc-option,-mno-thumb-interwork,)\
55   - )
  52 + -mabi=apcs-gnu,\
  53 + )\
  54 + ) $(call cc-option,-mno-thumb-interwork,)\
  55 + )
  56 +PLATFORM_CPPFLAGS += $(PF_CPPFLAGS_ARM) $(PF_CPPFLAGS_ABI)
56 57  
57 58 # For EABI, make sure to provide raise()
58 59 ifneq (,$(findstring -mabi=aapcs-linux,$(PLATFORM_CPPFLAGS)))
arch/arm/cpu/arm1136/config.mk
... ... @@ -29,5 +29,6 @@
29 29 # Supply options according to compiler version
30 30 #
31 31 # =========================================================================
32   -PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
  32 +PF_RELFLAGS_SLB_AT := $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
  33 +PLATFORM_RELFLAGS += $(PF_RELFLAGS_SLB_AT)
arch/arm/cpu/arm1176/config.mk
... ... @@ -29,5 +29,7 @@
29 29 # Supply options according to compiler version
30 30 #
31 31 # =========================================================================
32   -PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
  32 +PF_RELFLAGS_SLB_AT := $(call cc-option,-mshort-load-bytes,\
  33 + $(call cc-option,-malignment-traps,))
  34 +PLATFORM_RELFLAGS += $(PF_RELFLAGS_SLB_AT)
arch/arm/cpu/arm1176/s3c64xx/config.mk
... ... @@ -29,5 +29,7 @@
29 29 # Supply options according to compiler version
30 30 #
31 31 # =========================================================================
32   -PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
  32 +PF_RELFLAGS_SLB_AT := $(call cc-option,-mshort-load-bytes,\
  33 + $(call cc-option,-malignment-traps,))
  34 +PLATFORM_RELFLAGS += $(PF_RELFLAGS_SLB_AT)
arch/arm/cpu/arm720t/config.mk
... ... @@ -30,5 +30,7 @@
30 30 # Supply options according to compiler version
31 31 #
32 32 # =========================================================================
33   -PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
  33 +PF_RELFLAGS_SLB_AT := $(call cc-option,-mshort-load-bytes,\
  34 + $(call cc-option,-malignment-traps,))
  35 +PLATFORM_RELFLAGS += $(PF_RELFLAGS_SLB_AT)
arch/arm/cpu/arm920t/config.mk
... ... @@ -29,5 +29,6 @@
29 29 # Supply options according to compiler version
30 30 #
31 31 # =========================================================================
32   -PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
  32 +PF_RELFLAGS_SLB_AT := $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
  33 +PLATFORM_RELFLAGS += $(PF_RELFLAGS_SLB_AT)
arch/arm/cpu/arm925t/config.mk
... ... @@ -29,5 +29,6 @@
29 29 # Supply options according to compiler version
30 30 #
31 31 # =========================================================================
32   -PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
  32 +PF_RELFLAGS_SLB_AT := $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
  33 +PLATFORM_RELFLAGS += $(PF_RELFLAGS_SLB_AT)
arch/arm/cpu/arm926ejs/at91/config.mk
1   -PLATFORM_CPPFLAGS += $(call cc-option,-mtune=arm926ejs,)
  1 +PF_CPPFLAGS_TUNE := $(call cc-option,-mtune=arm926ejs,)
  2 +PLATFORM_CPPFLAGS += $(PF_CPPFLAGS_TUNE)
arch/arm/cpu/arm926ejs/config.mk
... ... @@ -29,5 +29,6 @@
29 29 # Supply options according to compiler version
30 30 #
31 31 # =========================================================================
32   -PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
  32 +PF_RELFLAGS_SLB_AT := $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
  33 +PLATFORM_RELFLAGS += $(PF_RELFLAGS_SLB_AT)
arch/arm/cpu/arm946es/config.mk
... ... @@ -29,5 +29,6 @@
29 29 # Supply options according to compiler version
30 30 #
31 31 # =========================================================================
32   -PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
  32 +PF_RELFLAGS_SLB_AT := $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
  33 +PLATFORM_RELFLAGS += $(PF_RELFLAGS_SLB_AT)
arch/arm/cpu/arm_intcm/config.mk
... ... @@ -29,5 +29,6 @@
29 29 # Supply options according to compiler version
30 30 #
31 31 # =========================================================================
32   -PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
  32 +PF_RELFLAGS_SLB_AT := $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
  33 +PLATFORM_RELFLAGS += $(PF_RELFLAGS_SLB_AT)
arch/arm/cpu/armv7/config.mk
... ... @@ -29,6 +29,6 @@
29 29 # Supply options according to compiler version
30 30 #
31 31 # =========================================================================
32   -PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,\
33   - $(call cc-option,-malignment-traps,))
  32 +PF_RELFLAGS_SLB_AT := $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
  33 +PLATFORM_RELFLAGS += $(PF_RELFLAGS_SLB_AT)
arch/arm/cpu/armv7/omap-common/config.mk
... ... @@ -29,6 +29,7 @@
29 29 # Supply options according to compiler version
30 30 #
31 31 # =========================================================================
32   -PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,\
33   - $(call cc-option,-malignment-traps,))
  32 +PF_RELFLAGS_SLB_AT := $(call cc-option,-mshort-load-bytes,\
  33 + $(call cc-option,-malignment-traps,))
  34 +PLATFORM_RELFLAGS += $(PF_RELFLAGS_SLB_AT)
arch/arm/cpu/ixp/config.mk
... ... @@ -37,5 +37,6 @@
37 37 # Supply options according to compiler version
38 38 #
39 39 # =========================================================================
40   -PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
  40 +PF_RELFLAGS_SLB_AT := $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
  41 +PLATFORM_RELFLAGS += $(PF_RELFLAGS_SLB_AT)
arch/arm/cpu/lh7a40x/config.mk
... ... @@ -29,5 +29,6 @@
29 29 # Supply options according to compiler version
30 30 #
31 31 # ========================================================================
32   -PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
  32 +PF_RELFLAGS_SLB_AT := $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
  33 +PLATFORM_RELFLAGS += $(PF_RELFLAGS_SLB_AT)
arch/arm/cpu/pxa/config.mk
... ... @@ -30,5 +30,6 @@
30 30 # Supply options according to compiler version
31 31 #
32 32 # ========================================================================
33   -PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
  33 +PF_RELFLAGS_SLB_AT := $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
  34 +PLATFORM_RELFLAGS += $(PF_RELFLAGS_SLB_AT)
arch/arm/cpu/s3c44b0/config.mk
... ... @@ -30,5 +30,6 @@
30 30 # Supply options according to compiler version
31 31 #
32 32 # ========================================================================
33   -PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
  33 +PF_RELFLAGS_SLB_AT := $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
  34 +PLATFORM_RELFLAGS += $(PF_RELFLAGS_SLB_AT)
arch/arm/cpu/sa1100/config.mk
... ... @@ -30,5 +30,6 @@
30 30 # Supply options according to compiler version
31 31 #
32 32 # ========================================================================
33   -PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
  33 +PF_RELFLAGS_SLB_AT := $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
  34 +PLATFORM_RELFLAGS += $(PF_RELFLAGS_SLB_AT)
arch/powerpc/cpu/mpc824x/Makefile
... ... @@ -23,8 +23,7 @@
23 23  
24 24 include $(TOPDIR)/config.mk
25 25 ifneq ($(OBJTREE),$(SRCTREE))
26   -$(shell mkdir -p $(obj)drivers/epic)
27   -$(shell mkdir -p $(obj)drivers/i2c)
  26 +$(shell mkdir -p $(obj)drivers/epic $(obj)drivers/i2c)
28 27 endif
29 28  
30 29 LIB = $(obj)lib$(CPU).o
arch/powerpc/cpu/mpc85xx/config.mk
... ... @@ -28,6 +28,7 @@
28 28 # -mspe=yes is needed to have -mno-spe accepted by a buggy GCC;
29 29 # see "[PATCH,rs6000] make -mno-spe work as expected" on
30 30 # http://gcc.gnu.org/ml/gcc-patches/2008-04/msg00311.html
31   -PLATFORM_CPPFLAGS +=$(call cc-option,-mspe=yes)
32   -PLATFORM_CPPFLAGS +=$(call cc-option,-mno-spe)
  31 +PF_CPPFLAGS_SPE := $(call cc-option,-mspe=yes) \
  32 + $(call cc-option,-mno-spe)
  33 +PLATFORM_CPPFLAGS += $(PF_CPPFLAGS_SPE)
... ... @@ -27,10 +27,12 @@
27 27 PLATFORM_CPPFLAGS += -Wstrict-prototypes
28 28 PLATFORM_CPPFLAGS += -mregparm=3
29 29 PLATFORM_CPPFLAGS += -fomit-frame-pointer
30   -PLATFORM_CPPFLAGS += $(call cc-option, -ffreestanding)
31   -PLATFORM_CPPFLAGS += $(call cc-option, -fno-toplevel-reorder, $(call cc-option, -fno-unit-at-a-time))
32   -PLATFORM_CPPFLAGS += $(call cc-option, -fno-stack-protector)
33   -PLATFORM_CPPFLAGS += $(call cc-option, -mpreferred-stack-boundary=2)
  30 +PF_CPPFLAGS_X86 := $(call cc-option, -ffreestanding) \
  31 + $(call cc-option, -fno-toplevel-reorder, \
  32 + $(call cc-option, -fno-unit-at-a-time)) \
  33 + $(call cc-option, -fno-stack-protector) \
  34 + $(call cc-option, -mpreferred-stack-boundary=2)
  35 +PLATFORM_CPPFLAGS += $(PF_CPPFLAGS_X86)
34 36 PLATFORM_CPPFLAGS += -fno-dwarf2-cfi-asm
35 37 PLATFORM_CPPFLAGS += -DREALMODE_BASE=0x7c0
36 38  
board/siemens/SCM/Makefile
... ... @@ -24,8 +24,7 @@
24 24 include $(TOPDIR)/config.mk
25 25  
26 26 ifneq ($(OBJTREE),$(SRCTREE))
27   -$(shell mkdir -p $(obj)../common)
28   -$(shell mkdir -p $(obj)../../tqc/tqm8xx)
  27 +$(shell mkdir -p $(obj)../common $(obj)../../tqc/tqm8xx)
29 28 endif
30 29  
31 30 LIB = $(obj)lib$(BOARD).o
... ... @@ -209,11 +209,13 @@
209 209 CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes
210 210 endif
211 211  
212   -CFLAGS += $(call cc-option,-fno-stack-protector)
  212 +CFLAGS_SSP := $(call cc-option,-fno-stack-protector)
  213 +CFLAGS += $(CFLAGS_SSP)
213 214 # Some toolchains enable security related warning flags by default,
214 215 # but they don't make much sense in the u-boot world, so disable them.
215   -CFLAGS += $(call cc-option,-Wno-format-nonliteral)
216   -CFLAGS += $(call cc-option,-Wno-format-security)
  216 +CFLAGS_WARN := $(call cc-option,-Wno-format-nonliteral) \
  217 + $(call cc-option,-Wno-format-security)
  218 +CFLAGS += $(CFLAGS_WARN)
217 219  
218 220 # $(CPPFLAGS) sets -g, which causes gcc to pass a suitable -g<format>
219 221 # option to the assembler.
examples/standalone/Makefile
... ... @@ -85,7 +85,8 @@
85 85 # We don't want gcc reordering functions if possible. This ensures that an
86 86 # application's entry point will be the first function in the application's
87 87 # source file.
88   -CFLAGS += $(call cc-option,-fno-toplevel-reorder)
  88 +CFLAGS_NTR := $(call cc-option,-fno-toplevel-reorder)
  89 +CFLAGS += $(CFLAGS_NTR)
89 90  
90 91 all: $(obj).depend $(OBJS) $(LIB) $(SREC) $(BIN) $(ELF)
91 92