mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-15 00:54:22 +00:00
perf(build): don't check the compiler's flags for every target
The TF_FLAGS variable must be recursively expanded as the rules that use it are defined before it has been fully defined. That has the unfortunate side effect of spawning a subshell that calls the compiler for every file that is being built, thrashing multicore build times. We don't cater to the possibility of the toolchain changing mid build so precomputing this value would be more sensible. Doing a clean build on an Intel dual socket Xeon Gold 5218 (i.e. 64 threads) workstation used to take about 9 seconds. After this patch it takes about 1.5. Single core performance went from ~45 seconds to about 25. Change-Id: If56ed0ab3cc42bc482d9dd05a41ffbff4dd7f147 Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com>
This commit is contained in:
parent
f7a41fb493
commit
316f5c97f2
2 changed files with 8 additions and 2 deletions
6
Makefile
6
Makefile
|
@ -256,10 +256,12 @@ WARNINGS += -Wunused-but-set-variable -Wmaybe-uninitialized \
|
|||
-Wlogical-op
|
||||
|
||||
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105523
|
||||
TF_CFLAGS += $(call cc_option, --param=min-pagesize=0)
|
||||
TF_CFLAGS_MIN_PAGE_SIZE := $(call cc_option, --param=min-pagesize=0)
|
||||
TF_CFLAGS += $(TF_CFLAGS_MIN_PAGE_SIZE)
|
||||
|
||||
ifeq ($(HARDEN_SLS), 1)
|
||||
TF_CFLAGS_aarch64 += $(call cc_option, -mharden-sls=all)
|
||||
TF_CFLAGS_MHARDEN_SLS := $(call cc_option, -mharden-sls=all)
|
||||
TF_CFLAGS_aarch64 += $(TF_CFLAGS_MHARDEN_SLS)
|
||||
endif
|
||||
|
||||
else
|
||||
|
|
|
@ -96,6 +96,10 @@ ld_option = $(shell $($(ARCH)-ld) $(1) -Wl,--version >/dev/null 2>&1 || $($(ARCH
|
|||
|
||||
# Convenience function to check for a given compiler option. A call to
|
||||
# $(call cc_option, --no-XYZ) will return --no-XYZ if supported by the compiler
|
||||
# NOTE: consider assigning to an immediately expanded temporary variable before
|
||||
# assigning. This is because variables like TF_CFLAGS are recursively expanded
|
||||
# and assigning this directly will cause it to be expanded every time the
|
||||
# variable is used, potentially thrashing multicore performance.
|
||||
define cc_option
|
||||
$(shell if $($(ARCH)-cc) $(1) -c -x c /dev/null -o /dev/null >/dev/null 2>&1; then echo $(1); fi )
|
||||
endef
|
||||
|
|
Loading…
Add table
Reference in a new issue