Big acceleration of Kbuild performance
Subsystems (9)
v3 cover Big acceleration of Kbuild performance
Kbuild brought about many advantages for us but a significant performance regression was reported by Simon Glass.
After some discussions and analysis, it turned out its main cause is in $(call cc-option,...).
Historically, U-Boot parses all config.mk (arch/*/config.mk and board/*/config.mk)
every time descending into subdirectories.
That means cc-options are evaluated over and over again.
$(call cc-option,...) is useful but costly.
So we want to evaluate them only in ./Makefile
and spl/Makefile and export compiler flags.
1/4 through 3/4 are preparation for 4/4.
4/4 is what we really want to do.
By applying it, I think Kbuild will get much faster.
I confirmed this series can apply on commit 32907339.
Masahiro Yamada (4):
kbuild,blackfin: Add CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED
kbuild: add CONFIG_ prefix to USE_PRIVATE_LIBGCC config.mk: specify the exact path to standalone linker script
kbuild: improve Kbuild speed
Makefile | 13 +++++++------ arch/arm/cpu/arm720t/tegra114/config.mk | 19 ------------------- arch/arm/cpu/arm720t/tegra124/config.mk | 7 ------- arch/arm/cpu/arm720t/tegra20/config.mk | 10 ---------- arch/arm/cpu/arm720t/tegra30/config.mk | 19 ------------------- arch/arm/lib/Makefile | 13 ++----------- arch/blackfin/config.mk | 1 + arch/mips/cpu/mips32/config.mk | 3 ++- arch/mips/cpu/mips64/config.mk | 3 ++- arch/mips/cpu/xburst/config.mk | 3 ++- arch/mips/lib/Makefile | 7 +------ arch/nds32/config.mk | 3 ++- arch/powerpc/lib/Makefile | 6 +----- arch/sh/lib/Makefile | 14 ++------------ arch/sparc/config.mk | 4 +++- arch/x86/config.mk | 2 +- board/bct-brettl2/config.mk | 13 ------------- board/bf518f-ezbrd/config.mk | 13 ------------- board/bf526-ezbrd/config.mk | 13 ------------- board/bf527-ad7160-eval/config.mk | 13 ------------- board/bf527-ezkit/config.mk | 13 ------------- board/bf527-sdp/config.mk | 5 ----- board/bf533-ezkit/config.mk | 5 ----- board/bf533-stamp/config.mk | 5 ----- board/bf537-stamp/config.mk | 5 ----- board/bf538f-ezkit/config.mk | 5 ----- board/bf548-ezkit/config.mk | 5 ----- board/bf561-acvilon/config.mk | 5 ----- board/bf561-ezkit/config.mk | 5 ----- board/br4/config.mk | 15 --------------- board/cm-bf527/config.mk | 13 ------------- board/cm-bf533/config.mk | 5 ----- board/cm-bf537e/config.mk | 5 ----- board/cm-bf537u/config.mk | 5 ----- board/cm-bf548/config.mk | 5 ----- board/cm-bf561/config.mk | 5 ----- board/ip04/config.mk | 5 ----- board/pr1/config.mk | 15 --------------- board/tcm-bf518/config.mk | 13 ------------- board/tcm-bf537/config.mk | 5 ----- config.mk | 28 ++++++++++++++++++++-------- examples/standalone/Makefile | 5 ++--- include/configs/bct-brettl2.h | 2 +- include/configs/bf518f-ezbrd.h | 2 +- include/configs/bf526-ezbrd.h | 1 + include/configs/bf527-ad7160-eval.h | 2 +- include/configs/bf527-ezkit.h | 2 +- include/configs/bf527-sdp.h | 2 +- include/configs/bf533-ezkit.h | 2 +- include/configs/bf533-stamp.h | 1 + include/configs/bf537-stamp.h | 1 + include/configs/bf538f-ezkit.h | 2 +- include/configs/bf548-ezkit.h | 1 + include/configs/bf561-acvilon.h | 2 +- include/configs/bf561-ezkit.h | 1 + include/configs/br4.h | 2 +- include/configs/cm-bf527.h | 2 +- include/configs/cm-bf533.h | 2 +- include/configs/cm-bf537e.h | 1 + include/configs/cm-bf537u.h | 2 +- include/configs/cm-bf548.h | 1 + include/configs/cm-bf561.h | 2 +- include/configs/ip04.h | 1 + include/configs/pr1.h | 2 +- include/configs/tcm-bf518.h | 2 +- include/configs/tcm-bf537.h | 2 +- include/configs/tegra-common.h | 4 ++++ lib/Makefile | 2 ++ scripts/Makefile.build | 10 +++++----- scripts/Makefile.lib | 7 +++---- spl/Makefile | 17 ++++++++--------- 71 files changed, 94 insertions(+), 342 deletions(-) delete mode 100644 arch/arm/cpu/arm720t/tegra114/config.mk delete mode 100644 arch/arm/cpu/arm720t/tegra124/config.mk delete mode 100644 arch/arm/cpu/arm720t/tegra20/config.mk delete mode 100644 arch/arm/cpu/arm720t/tegra30/config.mk delete mode 100644 board/bct-brettl2/config.mk delete mode 100644 board/bf518f-ezbrd/config.mk delete mode 100644 board/bf526-ezbrd/config.mk delete mode 100644 board/bf527-ad7160-eval/config.mk delete mode 100644 board/bf527-ezkit/config.mk delete mode 100644 board/br4/config.mk delete mode 100644 board/cm-bf527/config.mk delete mode 100644 board/pr1/config.mk delete mode 100644 board/tcm-bf518/config.mk
Signature · 1 line
1.8.3.2
PATCH v3 1/4 kbuild, blackfin: Add CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED
Many (but not all) of Blackfin boards give -O2 option to compile under lib/ directory.
That means lib/ should be speed-optimized, whereas other parts should be size-optimized.
We want to keep the same behavior,
but do not want to parse board/*/config.mk again and again. We've got no choice but to invent a new method.
CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED, if it is enabled, gives -O2 flag only for building under lib/ directory.
Dirty codes which I had marked as "FIX ME" in board/${BOARD}/config.mk have been deleted. Instead, CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED has been defined in include/configs/${BOARD}.h.
---
Changes in v3: None
Changes in v2: None
board/bct-brettl2/config.mk | 13 ------------- board/bf518f-ezbrd/config.mk | 13 ------------- board/bf526-ezbrd/config.mk | 13 ------------- board/bf527-ad7160-eval/config.mk | 13 ------------- board/bf527-ezkit/config.mk | 13 ------------- board/bf527-sdp/config.mk | 5 ----- board/bf533-ezkit/config.mk | 5 ----- board/bf533-stamp/config.mk | 5 ----- board/bf537-stamp/config.mk | 5 ----- board/bf538f-ezkit/config.mk | 5 ----- board/bf548-ezkit/config.mk | 5 ----- board/bf561-acvilon/config.mk | 5 ----- board/bf561-ezkit/config.mk | 5 ----- board/br4/config.mk | 15 --------------- board/cm-bf527/config.mk | 13 ------------- board/cm-bf533/config.mk | 5 ----- board/cm-bf537e/config.mk | 5 ----- board/cm-bf537u/config.mk | 5 ----- board/cm-bf548/config.mk | 5 ----- board/cm-bf561/config.mk | 5 ----- board/ip04/config.mk | 5 ----- board/pr1/config.mk | 15 --------------- board/tcm-bf518/config.mk | 13 ------------- board/tcm-bf537/config.mk | 5 ----- include/configs/bct-brettl2.h | 2 +- include/configs/bf518f-ezbrd.h | 2 +- include/configs/bf526-ezbrd.h | 1 + include/configs/bf527-ad7160-eval.h | 2 +- include/configs/bf527-ezkit.h | 2 +- include/configs/bf527-sdp.h | 2 +- include/configs/bf533-ezkit.h | 2 +- include/configs/bf533-stamp.h | 1 + include/configs/bf537-stamp.h | 1 + include/configs/bf538f-ezkit.h | 2 +- include/configs/bf548-ezkit.h | 1 + include/configs/bf561-acvilon.h | 2 +- include/configs/bf561-ezkit.h | 1 + include/configs/br4.h | 2 +- include/configs/cm-bf527.h | 2 +- include/configs/cm-bf533.h | 2 +- include/configs/cm-bf537e.h | 1 + include/configs/cm-bf537u.h | 2 +- include/configs/cm-bf548.h | 1 + include/configs/cm-bf561.h | 2 +- include/configs/ip04.h | 1 + include/configs/pr1.h | 2 +- include/configs/tcm-bf518.h | 2 +- include/configs/tcm-bf537.h | 2 +- lib/Makefile | 2 ++ 49 files changed, 26 insertions(+), 212 deletions(-) delete mode 100644 board/bct-brettl2/config.mk delete mode 100644 board/bf518f-ezbrd/config.mk delete mode 100644 board/bf526-ezbrd/config.mk delete mode 100644 board/bf527-ad7160-eval/config.mk delete mode 100644 board/bf527-ezkit/config.mk delete mode 100644 board/br4/config.mk delete mode 100644 board/cm-bf527/config.mk delete mode 100644 board/pr1/config.mk delete mode 100644 board/tcm-bf518/config.mk
board/bct-brettl2/config.mk deleted +0 -13
@@ -1,13 +0,0 @@ -# -# Copyright (c) 2005-2008 Analog Device Inc. -# -# (C) Copyright 2001 -# Wolfgang Denk, DENX Software Engineering, wd at denx.de. -# -# SPDX-License-Identifier: GPL-2.0+ -# - -# FIX ME -ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),) -ccflags-y := -O2 -endif
board/bf518f-ezbrd/config.mk deleted +0 -13
@@ -1,13 +0,0 @@ -# -# Copyright (c) 2005-2008 Analog Device Inc. -# -# (C) Copyright 2001 -# Wolfgang Denk, DENX Software Engineering, wd at denx.de. -# -# SPDX-License-Identifier: GPL-2.0+ -# - -# FIX ME -ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),) -ccflags-y := -O2 -endif
board/bf526-ezbrd/config.mk deleted +0 -13
@@ -1,13 +0,0 @@ -# -# Copyright (c) 2005-2008 Analog Device Inc. -# -# (C) Copyright 2001 -# Wolfgang Denk, DENX Software Engineering, wd at denx.de. -# -# SPDX-License-Identifier: GPL-2.0+ -# - -# FIX ME -ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),) -ccflags-y := -O2 -endif
board/bf527-ad7160-eval/config.mk deleted +0 -13
@@ -1,13 +0,0 @@ -# -# Copyright (c) 2005-2008 Analog Device Inc. -# -# (C) Copyright 2001 -# Wolfgang Denk, DENX Software Engineering, wd at denx.de. -# -# SPDX-License-Identifier: GPL-2.0+ -# - -# FIX ME -ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),) -ccflags-y := -O2 -endif
board/bf527-ezkit/config.mk deleted +0 -13
@@ -1,13 +0,0 @@ -# -# Copyright (c) 2005-2008 Analog Device Inc. -# -# (C) Copyright 2001 -# Wolfgang Denk, DENX Software Engineering, wd at denx.de. -# -# SPDX-License-Identifier: GPL-2.0+ -# - -# FIX ME -ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),) -ccflags-y := -O2 -endif
board/bf527-sdp/config.mk +0 -5
@@ -7,10 +7,5 @@ # SPDX-License-Identifier: GPL-2.0+ # -# FIX ME -ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),) -ccflags-y := -O2 -endif - # Set some default LDR flags based on boot mode. LDR_FLAGS-BFIN_BOOT_PARA := --bits 16 --dma 6
board/bf533-ezkit/config.mk +0 -5
@@ -7,10 +7,5 @@ # SPDX-License-Identifier: GPL-2.0+ # -# FIX ME -ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),) -ccflags-y := -O2 -endif - # Set some default LDR flags based on boot mode. LDR_FLAGS-BFIN_BOOT_PARA := --bits 16 --dma 8
board/bf533-stamp/config.mk +0 -5
@@ -7,10 +7,5 @@ # SPDX-License-Identifier: GPL-2.0+ # -# FIX ME -ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),) -ccflags-y := -O2 -endif - # Set some default LDR flags based on boot mode. LDR_FLAGS-BFIN_BOOT_PARA := --bits 16 --dma 8
board/bf537-stamp/config.mk +0 -5
@@ -7,11 +7,6 @@ # SPDX-License-Identifier: GPL-2.0+ # -# FIX ME -ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),) -ccflags-y := -O2 -endif - # Set some default LDR flags based on boot mode. LDR_FLAGS-BFIN_BOOT_PARA := --bits 16 --dma 8 LDR_FLAGS-BFIN_BOOT_UART := --port g --gpio 6
board/bf538f-ezkit/config.mk +0 -5
@@ -7,10 +7,5 @@ # SPDX-License-Identifier: GPL-2.0+ # -# FIX ME -ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),) -ccflags-y := -O2 -endif - # Set some default LDR flags based on boot mode. LDR_FLAGS-BFIN_BOOT_PARA := --bits 16 --dma 8
board/bf548-ezkit/config.mk +0 -5
@@ -7,11 +7,6 @@ # SPDX-License-Identifier: GPL-2.0+ # -# FIX ME -ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),) -ccflags-y := -O2 -endif - # Set some default LDR flags based on boot mode. LDR_FLAGS-BFIN_BOOT_PARA := --dma 6 LDR_FLAGS-BFIN_BOOT_FIFO := --dma 1
board/bf561-acvilon/config.mk +0 -5
@@ -7,10 +7,5 @@ # SPDX-License-Identifier: GPL-2.0+ # -# FIX ME -ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),) -ccflags-y := -O2 -endif - # Set some default LDR flags based on boot mode. LDR_FLAGS-BFIN_BOOT_PARA := --bits 16
board/bf561-ezkit/config.mk +0 -5
@@ -7,10 +7,5 @@ # SPDX-License-Identifier: GPL-2.0+ # -# FIX ME -ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),) -ccflags-y := -O2 -endif - # Set some default LDR flags based on boot mode. LDR_FLAGS-BFIN_BOOT_PARA := --bits 16
board/br4/config.mk deleted +0 -15
@@ -1,15 +0,0 @@ -# -# Copyright (c) Switchfin Org. <[email protected]> -# -# Copyright (c) 2005-2008 Analog Device Inc. -# -# (C) Copyright 2001 -# Wolfgang Denk, DENX Software Engineering, wd at denx.de. -# -# SPDX-License-Identifier: GPL-2.0+ -# - -# FIX ME -ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),) -ccflags-y := -O2 -endif
board/cm-bf527/config.mk deleted +0 -13
@@ -1,13 +0,0 @@ -# -# Copyright (c) 2005-2008 Analog Device Inc. -# -# (C) Copyright 2001 -# Wolfgang Denk, DENX Software Engineering, wd at denx.de. -# -# SPDX-License-Identifier: GPL-2.0+ -# - -# FIX ME -ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),) -ccflags-y := -O2 -endif
board/cm-bf533/config.mk +0 -5
@@ -7,10 +7,5 @@ # SPDX-License-Identifier: GPL-2.0+ # -# FIX ME -ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),) -ccflags-y := -O2 -endif - # Set some default LDR flags based on boot mode. LDR_FLAGS-BFIN_BOOT_PARA := --bits 16 --dma 8
board/cm-bf537e/config.mk +0 -5
@@ -7,10 +7,5 @@ # SPDX-License-Identifier: GPL-2.0+ # -# FIX ME -ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),) -ccflags-y := -O2 -endif - # Set some default LDR flags based on boot mode. LDR_FLAGS-BFIN_BOOT_PARA := --bits 16 --dma 8
board/cm-bf537u/config.mk +0 -5
@@ -7,10 +7,5 @@ # SPDX-License-Identifier: GPL-2.0+ # -# FIX ME -ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),) -ccflags-y := -O2 -endif - # Set some default LDR flags based on boot mode. LDR_FLAGS-BFIN_BOOT_PARA := --bits 16 --dma 8
board/cm-bf548/config.mk +0 -5
@@ -7,11 +7,6 @@ # SPDX-License-Identifier: GPL-2.0+ # -# FIX ME -ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),) -ccflags-y := -O2 -endif - # Set some default LDR flags based on boot mode. LDR_FLAGS-BFIN_BOOT_PARA := --dma 6 LDR_FLAGS-BFIN_BOOT_FIFO := --dma 1
board/cm-bf561/config.mk +0 -5
@@ -7,10 +7,5 @@ # SPDX-License-Identifier: GPL-2.0+ # -# FIX ME -ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),) -ccflags-y := -O2 -endif - # Set some default LDR flags based on boot mode. LDR_FLAGS-BFIN_BOOT_PARA := --bits 16
board/ip04/config.mk +0 -5
@@ -7,11 +7,6 @@ # SPDX-License-Identifier: GPL-2.0+ # -# FIX ME -ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),) -ccflags-y := -O2 -endif - # Set some default LDR flags based on boot mode. LDR_FLAGS-BFIN_BOOT_PARA := --bits 16 --dma 8 LDR_FLAGS-BFIN_BOOT_UART := --port g --gpio 6
board/pr1/config.mk deleted +0 -15
@@ -1,15 +0,0 @@ -# -# Copyright (c) Switchfin Org. <[email protected]> -# -# Copyright (c) 2005-2008 Analog Device Inc. -# -# (C) Copyright 2001 -# Wolfgang Denk, DENX Software Engineering, wd at denx.de. -# -# SPDX-License-Identifier: GPL-2.0+ -# - -# FIX ME -ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),) -ccflags-y := -O2 -endif
board/tcm-bf518/config.mk deleted +0 -13
@@ -1,13 +0,0 @@ -# -# Copyright (c) 2005-2008 Analog Device Inc. -# -# (C) Copyright 2001 -# Wolfgang Denk, DENX Software Engineering, wd at denx.de. -# -# SPDX-License-Identifier: GPL-2.0+ -# - -# FIX ME -ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),) -ccflags-y := -O2 -endif
board/tcm-bf537/config.mk +0 -5
@@ -7,10 +7,5 @@ # SPDX-License-Identifier: GPL-2.0+ # -# FIX ME -ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),) -ccflags-y := -O2 -endif - # Set some default LDR flags based on boot mode. LDR_FLAGS-BFIN_BOOT_PARA := --bits 16 --dma 8
include/configs/bct-brettl2.h +1 -1
@@ -136,7 +136,7 @@#define CONFIG_MTD_DEVICE #define CONFIG_MTD_PARTITIONS #define CONFIG_SYS_HUSH_PARSER - +#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED /* * Pull in common ADI header for remaining command/environment setup
include/configs/bf518f-ezbrd.h +1 -1
@@ -155,7 +155,7 @@#define CONFIG_MISC_INIT_R #define CONFIG_RTC_BFIN #define CONFIG_UART_CONSOLE 0 - +#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED /* * Pull in common ADI header for remaining command/environment setup
include/configs/bf526-ezbrd.h +1 -0
@@ -153,6 +153,7 @@#define CONFIG_MISC_INIT_R #define CONFIG_RTC_BFIN #define CONFIG_UART_CONSOLE 1 +#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED /* define to enable run status via led */ /* #define CONFIG_STATUS_LED */
include/configs/bf527-ad7160-eval.h +1 -1
@@ -136,7 +136,7 @@*/ #define CONFIG_MISC_INIT_R #define CONFIG_UART_CONSOLE 0 - +#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED /* * Pull in common ADI header for remaining command/environment setup
include/configs/bf527-ezkit.h +1 -1
@@ -179,7 +179,7 @@#define CONFIG_MISC_INIT_R #define CONFIG_RTC_BFIN #define CONFIG_UART_CONSOLE 1 - +#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED /* * Pull in common ADI header for remaining command/environment setup
include/configs/bf527-sdp.h +1 -1
@@ -112,7 +112,7 @@*/ #define CONFIG_MISC_INIT_R #define CONFIG_UART_CONSOLE 0 - +#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED /* * Pull in common ADI header for remaining command/environment setup
include/configs/bf533-ezkit.h +1 -1
@@ -110,7 +110,7 @@#define CONFIG_MISC_INIT_R #define CONFIG_RTC_BFIN #define CONFIG_UART_CONSOLE 0 - +#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED /* * Pull in common ADI header for remaining command/environment setup
include/configs/bf533-stamp.h +1 -0
@@ -185,6 +185,7 @@*/ #define CONFIG_RTC_BFIN #define CONFIG_UART_CONSOLE 0 +#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED /* FLASH/ETHERNET uses the same async bank */ #define SHARED_RESOURCES 1
include/configs/bf537-stamp.h +1 -0
@@ -254,6 +254,7 @@#define CONFIG_MISC_INIT_R #define CONFIG_RTC_BFIN #define CONFIG_UART_CONSOLE 0 +#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED /* Define if want to do post memory test */ #undef CONFIG_POST
include/configs/bf538f-ezkit.h +1 -1
@@ -134,7 +134,7 @@*/ #define CONFIG_RTC_BFIN #define CONFIG_UART_CONSOLE 0 - +#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED /* * Pull in common ADI header for remaining command/environment setup
include/configs/bf548-ezkit.h +1 -0
@@ -181,6 +181,7 @@#define CONFIG_RTC_BFIN #define CONFIG_UART_CONSOLE 1#define CONFIG_BFIN_SPI_IMG_SIZE 0x50000 +#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED #define CONFIG_ADI_GPIO2
include/configs/bf561-acvilon.h +1 -1
@@ -160,7 +160,7 @@#define CONFIG_UART_CONSOLE 0#define CONFIG_BAUDRATE 57600#define CONFIG_SYS_PROMPT "Acvilon> " - +#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED /* * Pull in common ADI header for remaining command/environment setup
include/configs/bf561-ezkit.h +1 -0
@@ -102,6 +102,7 @@* Misc Settings */ #define CONFIG_UART_CONSOLE 0 +#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED /* * Run core 1 from L1 SRAM start address when init uboot on core 0
include/configs/br4.h +1 -1
@@ -135,7 +135,7 @@#define CONFIG_BOOTCOMMAND "run nandboot"#define CONFIG_BOOTDELAY 2#define CONFIG_LOADADDR 0x2000000 - +#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED /* * Pull in common ADI header for remaining command/environment setup
include/configs/cm-bf527.h +1 -1
@@ -128,7 +128,7 @@#define FLASHBOOT_ENV_SETTINGS \ "flashboot=flread 20040000 1000000 300000;" \ "bootm 0x1000000\0" - +#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED /* * Pull in common ADI header for remaining command/environment setup
include/configs/cm-bf533.h +1 -1
@@ -97,7 +97,7 @@#define CONFIG_UART_CONSOLE 0#define CONFIG_BOOTCOMMAND "run flashboot"#define FLASHBOOT_ENV_SETTINGS "flashboot=bootm 0x20040000\0" - +#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED /* * Pull in common ADI header for remaining command/environment setup
include/configs/cm-bf537e.h +1 -0
@@ -146,6 +146,7 @@"flashboot=flread 20040000 1000000 3c0000;" \ "bootm 0x1000000\0"#define CONFIG_BOARD_SIZE_LIMIT $$((384 * 1024)) +#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED /* * Pull in common ADI header for remaining command/environment setup
include/configs/cm-bf537u.h +1 -1
@@ -143,7 +143,7 @@"flashboot=flread 20040000 1000000 300000;" \ "bootm 0x1000000\0"#define CONFIG_BOARD_SIZE_LIMIT $$((384 * 1024)) - +#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED /* * Pull in common ADI header for remaining command/environment setup
include/configs/cm-bf548.h +1 -0
@@ -117,6 +117,7 @@#define CONFIG_UART_CONSOLE 1#define CONFIG_BOOTCOMMAND "run flashboot"#define FLASHBOOT_ENV_SETTINGS "flashboot=bootm 0x20040000\0" +#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED #define CONFIG_ADI_GPIO2
include/configs/cm-bf561.h +1 -1
@@ -99,7 +99,7 @@#define CONFIG_UART_CONSOLE 0#define CONFIG_BOOTCOMMAND "run flashboot"#define FLASHBOOT_ENV_SETTINGS "flashboot=bootm 0x20040000\0" - +#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED /* * Pull in common ADI header for remaining command/environment setup
include/configs/ip04.h +1 -0
@@ -132,6 +132,7 @@#define CONFIG_BAUDRATE 115200#define CONFIG_MISC_INIT_R /* needed for MAC address */ #define CONFIG_UART_CONSOLE 0 +#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED #undef CONFIG_SHOW_BOOT_PROGRESS/* Enable this if bootretry required; currently it's disabled */
include/configs/pr1.h +1 -1
@@ -135,7 +135,7 @@#define CONFIG_BOOTCOMMAND "run nandboot"#define CONFIG_BOOTDELAY 2#define CONFIG_LOADADDR 0x2000000 - +#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED /* * Pull in common ADI header for remaining command/environment setup
include/configs/tcm-bf518.h +1 -1
@@ -116,7 +116,7 @@#define CONFIG_UART_CONSOLE 0#define CONFIG_BOOTCOMMAND "run flashboot"#define FLASHBOOT_ENV_SETTINGS "flashboot=bootm 0x20040000\0" - +#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED /* * Pull in common ADI header for remaining command/environment setup
include/configs/tcm-bf537.h +1 -1
@@ -145,7 +145,7 @@"flashboot=flread 20040000 1000000 300000;" \ "bootm 0x1000000\0"#define CONFIG_BOARD_SIZE_LIMIT $$((384 * 1024)) - +#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED /* * Pull in common ADI header for remaining command/environment setup
lib/Makefile +2 -0
@@ -65,3 +65,5 @@ obj-y += vsprintf.o obj-$(CONFIG_RANDOM_MACADDR) += rand.o obj-$(CONFIG_BOOTP_RANDOM_DELAY) += rand.o obj-$(CONFIG_CMD_LINK_LOCAL) += rand.o + +subdir-ccflags-$(CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED) += -O2
Signature · 1 line
1.8.3.2
PATCH v3 1/4 kbuild, blackfin: Add CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED
Hi Masahiro,
Quoted 12 lines · Masahiro Yamada
Many (but not all) of Blackfin boards give -O2 option to compile under
lib/directory.
That meanslib/should be speed-optimized, whereas other parts should be size-optimized.We want to keep the same behavior,
but do not want to parseboard/*/config.mkagain and again. We've got no choice but to invent a new method.
CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED, if it is enabled, gives -O2 flag only for building underlib/directory.
Quoted 7 lines
Dirty codes which I had marked as "FIX ME" in
board/${BOARD}/config.mkhave been deleted. Instead,CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEEDhas been defined ininclude/configs/${BOARD}.h.Signed-off-by Masahiro Yamada <[email protected]>Cc Sonic Zhang <[email protected]>
lib/Makefile obj-y += vsprintf.o · line 69
Quoted 10 lines
lib/Makefile +2
-0@@ -65,3 +65,5 @@ obj-y += vsprintf.o obj-$(CONFIG_RANDOM_MACADDR) += rand.o obj-$(CONFIG_BOOTP_RANDOM_DELAY) += rand.o obj-$(CONFIG_CMD_LINK_LOCAL) += rand.o + +subdir-ccflags-$(CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED) += -O2
I guess this gets added after the -Os so supersedes it. I wonder what happens if debugging is enabled? Still this is the same as before I think.
Regards,
Simon
PATCH v3 1/4 kbuild, blackfin: Add CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED
In reply to Masahiro YamadaQuoted 12 lines · Masahiro Yamada
Many (but not all) of Blackfin boards give -O2 option to compile under
lib/directory.
That meanslib/should be speed-optimized, whereas other parts should be size-optimized.We want to keep the same behavior,
but do not want to parseboard/*/config.mkagain and again. We've got no choice but to invent a new method.
CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED, if it is enabled, gives -O2 flag only for building underlib/directory.
Quoted 7 lines
Dirty codes which I had marked as "FIX ME" in
board/${BOARD}/config.mkhave been deleted. Instead,CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEEDhas been defined ininclude/configs/${BOARD}.h.Signed-off-by Masahiro Yamada <[email protected]>Cc Sonic Zhang <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140307/9bd9d496/attachment.pgp>
PATCH v3 2/4 kbuild: add CONFIG_ prefix to USE_PRIVATE_LIBGCC
In reply to Masahiro YamadaBefore this commit, USE_PRIVATE_LIBGCC was defined in arch-specific config.mk and referenced in arch/$(ARCH)/lib/Makefile.
We are not happy about parsing config.mk again and again. We have to keep the same behavior with a different way.
By adding "CONFIG_" prefix, this macro appears
in include/autoconf.mk, include/spl-autoconf.mk.
(And treating USE_PRIVATE_LIBGCC as CONFIG macro
is reasonable enough.)
Tegra SoC family defined USE_PRIVATE_LIBGCC as "yes"
in arch/arm/cpu/arm720t/tegra*/config.mk,
whereas did not define it in arch/arm/cpu/armv7/tegra*/config.mk.
It means Tegra enables PRIVATE_LIBGCC only for SPL. We can describe the same behavior by adding
#ifdef CONFIG_SPL_BUILD # define CONFIG_USE_PRIVATE_LIBGCC #endif
to include/configs/tegra-common.h.
---
Changes in v3: None
Changes in v2:
- Fix the subject and commit description
s/USE_PRIVATE_LIBS/USE_PRIVATE_LIBGCC/
Makefile | 6 +++--- arch/arm/cpu/arm720t/tegra114/config.mk | 19 ------------------- arch/arm/cpu/arm720t/tegra124/config.mk | 7 ------- arch/arm/cpu/arm720t/tegra20/config.mk | 10 ---------- arch/arm/cpu/arm720t/tegra30/config.mk | 19 ------------------- arch/arm/lib/Makefile | 13 ++----------- arch/mips/lib/Makefile | 7 +------ arch/powerpc/lib/Makefile | 6 +----- arch/sh/lib/Makefile | 14 ++------------ arch/x86/config.mk | 2 +- include/configs/tegra-common.h | 4 ++++ spl/Makefile | 2 +- 12 files changed, 15 insertions(+), 94 deletions(-) delete mode 100644 arch/arm/cpu/arm720t/tegra114/config.mk delete mode 100644 arch/arm/cpu/arm720t/tegra124/config.mk delete mode 100644 arch/arm/cpu/arm720t/tegra20/config.mk delete mode 100644 arch/arm/cpu/arm720t/tegra30/config.mk
Makefile +3 -3
@@ -651,11 +651,11 @@ u-boot-main := $(libs-y) # Add GCC lib -ifdef USE_PRIVATE_LIBGCC -ifeq ("$(USE_PRIVATE_LIBGCC)", "yes") +ifdef CONFIG_USE_PRIVATE_LIBGCC +ifeq ($(CONFIG_USE_PRIVATE_LIBGCC),y) PLATFORM_LIBGCC = arch/$(ARCH)/lib/lib.a else -PLATFORM_LIBGCC = -L $(USE_PRIVATE_LIBGCC) -lgcc +PLATFORM_LIBGCC = -L $(CONFIG_USE_PRIVATE_LIBGCC) -lgcc endif else PLATFORM_LIBGCC := -L $(shell dirname `$(CC) $(c_flags) -print-libgcc-file-name`) -lgcc
arch/arm/cpu/arm720t/tegra114/config.mk deleted +0 -19
@@ -1,19 +0,0 @@ -# -# Copyright (c) 2010-2013, NVIDIA CORPORATION. All rights reserved. -# -# (C) Copyright 2002 -# Gary Jennejohn, DENX Software Engineering, <[email protected]> -# -# This program is free software; you can redistribute it and/or modify it -# under the terms and conditions of the GNU General Public License, -# version 2, as published by the Free Software Foundation. -# -# This program is distributed in the hope it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -# more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. -# -USE_PRIVATE_LIBGCC = yes
arch/arm/cpu/arm720t/tegra124/config.mk deleted +0 -7
@@ -1,7 +0,0 @@ -# -# (C) Copyright 2010-2013 -# NVIDIA Corporation <www.nvidia.com> -# -# SPDX-License-Identifier: GPL-2.0+ -#/ -USE_PRIVATE_LIBGCC = yes
arch/arm/cpu/arm720t/tegra20/config.mk deleted +0 -10
@@ -1,10 +0,0 @@ -# -# (C) Copyright 2010,2011 -# NVIDIA Corporation <www.nvidia.com> -# -# (C) Copyright 2002 -# Gary Jennejohn, DENX Software Engineering, <[email protected]> -# -# SPDX-License-Identifier: GPL-2.0+ -# -USE_PRIVATE_LIBGCC = yes
arch/arm/cpu/arm720t/tegra30/config.mk deleted +0 -19
@@ -1,19 +0,0 @@ -# -# Copyright (c) 2010-2012, NVIDIA CORPORATION. All rights reserved. -# -# (C) Copyright 2002 -# Gary Jennejohn, DENX Software Engineering, <[email protected]> -# -# This program is free software; you can redistribute it and/or modify it -# under the terms and conditions of the GNU General Public License, -# version 2, as published by the Free Software Foundation. -# -# This program is distributed in the hope it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -# more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. -# -USE_PRIVATE_LIBGCC = yes
arch/arm/lib/Makefile +2 -11
@@ -5,17 +5,8 @@ # SPDX-License-Identifier: GPL-2.0+ # -# Build private libgcc only when asked for -ifdef USE_PRIVATE_LIBGCC -lib-y += _ashldi3.o -lib-y += _ashrdi3.o -lib-y += _divsi3.o -lib-y += _lshrdi3.o -lib-y += _modsi3.o -lib-y += _udivsi3.o -lib-y += _umodsi3.o -lib-y += div0.o -endif +lib-$(CONFIG_USE_PRIVATE_LIBGCC) += _ashldi3.o _ashrdi3.o _divsi3.o \ + _lshrdi3.o _modsi3.o _udivsi3.o _umodsi3.o div0.o ifdef CONFIG_ARM64 obj-y += crt0_64.o
arch/mips/lib/Makefile +1 -6
@@ -8,9 +8,4 @@ obj-y += board.o obj-$(CONFIG_CMD_BOOTM) += bootm.o -# Build private libgcc only when asked for -ifdef USE_PRIVATE_LIBGCC -lib-y += ashldi3.o -lib-y += ashrdi3.o -lib-y += lshrdi3.o -endif +lib-$(CONFIG_USE_PRIVATE_LIBGCC) += ashldi3.o ashrdi3.o lshrdi3.o
arch/powerpc/lib/Makefile +1 -5
@@ -7,11 +7,7 @@ ## Build a couple of necessary functions into a private libgcc ## if the user asked for it -ifdef USE_PRIVATE_LIBGCC -lib-y += _ashldi3.o -lib-y += _ashrdi3.o -lib-y += _lshrdi3.o -endif +lib-$(CONFIG_USE_PRIVATE_LIBGCC) += _ashldi3.o _ashrdi3.o _lshrdi3.o MINIMAL=
arch/sh/lib/Makefile +2 -12
@@ -15,15 +15,5 @@ obj-y += time.o endif obj-$(CONFIG_CMD_SH_ZIMAGEBOOT) += zimageboot.o - - -# Build private libgcc only when asked for -ifdef USE_PRIVATE_LIBGCC -lib-y += ashiftrt.o -lib-y += ashiftlt.o -lib-y += lshiftrt.o -lib-y += ashldi3.o -lib-y += ashrsi3.o -lib-y += lshrdi3.o -lib-y += movmem.o -endif +lib-$(CONFIG_USE_PRIVATE_LIBGCC) += ashiftrt.o ashiftlt.o lshiftrt.o \ + ashldi3.o ashrsi3.o lshrdi3.o movmem.o
arch/x86/config.mk +1 -1
@@ -31,4 +31,4 @@ LDFLAGS_FINAL += --wrap=__moddi3 --wrap=__umoddi3 export NORMAL_LIBGCC = $(shell $(CC) $(CFLAGS) -print-libgcc-file-name) PREFIXED_LIBGCC = $(OBJTREE)/arch/$(ARCH)/lib/$(shell basename $(NORMAL_LIBGCC)) -export USE_PRIVATE_LIBGCC=$(shell dirname $(PREFIXED_LIBGCC)) +CONFIG_USE_PRIVATE_LIBGCC=$(shell dirname $(PREFIXED_LIBGCC))
include/configs/tegra-common.h +4 -0
@@ -151,6 +151,10 @@#define CONFIG_SPL_SERIAL_SUPPORT #define CONFIG_SPL_GPIO_SUPPORT +#ifdef CONFIG_SPL_BUILD +# define CONFIG_USE_PRIVATE_LIBGCC +#endif +#define CONFIG_SYS_GENERIC_BOARD /* Misc utility code */
spl/Makefile +1 -1
@@ -132,7 +132,7 @@ u-boot-spl-dirs := $(patsubst %/,%,$(filter %/, $(libs-y))) libs-y := $(patsubst %/, %/built-in.o, $(libs-y)) # Add GCC lib -ifeq ("$(USE_PRIVATE_LIBGCC)", "yes") +ifeq ($(CONFIG_USE_PRIVATE_LIBGCC),y) PLATFORM_LIBGCC = arch/$(ARCH)/lib/lib.a PLATFORM_LIBS := $(filter-out %/lib.a, $(filter-out -lgcc, $(PLATFORM_LIBS))) $(PLATFORM_LIBGCC) endif
Signature · 1 line
1.8.3.2
PATCH v3 2/4 kbuild: add CONFIG_ prefix to USE_PRIVATE_LIBGCC
Quoted 23 lines · Masahiro Yamada
Before this commit,
USE_PRIVATE_LIBGCCwas defined in arch-specific config.mk and referenced in arch/$(ARCH)/lib/Makefile.We are not happy about parsing config.mk again and again. We have to keep the same behavior with a different way.
By adding "
CONFIG_" prefix, this macro appears
ininclude/autoconf.mk,include/spl-autoconf.mk. (And treatingUSE_PRIVATE_LIBGCCas CONFIG macro is reasonable enough.)Tegra SoC family defined
USE_PRIVATE_LIBGCCas "yes"
inarch/arm/cpu/arm720t/tegra*/config.mk,
whereas did not define it inarch/arm/cpu/armv7/tegra*/config.mk.It means Tegra enables
PRIVATE_LIBGCConly for SPL. We can describe the same behavior by adding#ifdef CONFIG_SPL_BUILD # define CONFIG_USE_PRIVATE_LIBGCC #endif
Quoted 6 lines
to
include/configs/tegra-common.h.Signed-off-by Masahiro Yamada <[email protected]>Cc Tom Warren <[email protected]>Cc Simon Glass <[email protected]>Acked-by Stephen Warren <[email protected]>
PATCH v3 2/4 kbuild: add CONFIG_ prefix to USE_PRIVATE_LIBGCC
In reply to Masahiro YamadaQuoted 23 lines · Masahiro Yamada
Before this commit,
USE_PRIVATE_LIBGCCwas defined in arch-specific config.mk and referenced in arch/$(ARCH)/lib/Makefile.We are not happy about parsing config.mk again and again. We have to keep the same behavior with a different way.
By adding "
CONFIG_" prefix, this macro appears
ininclude/autoconf.mk,include/spl-autoconf.mk. (And treatingUSE_PRIVATE_LIBGCCas CONFIG macro is reasonable enough.)Tegra SoC family defined
USE_PRIVATE_LIBGCCas "yes"
inarch/arm/cpu/arm720t/tegra*/config.mk,
whereas did not define it inarch/arm/cpu/armv7/tegra*/config.mk.It means Tegra enables
PRIVATE_LIBGCConly for SPL. We can describe the same behavior by adding#ifdef CONFIG_SPL_BUILD # define CONFIG_USE_PRIVATE_LIBGCC #endif
Quoted 6 lines
to
include/configs/tegra-common.h.Signed-off-by Masahiro Yamada <[email protected]>Cc Tom Warren <[email protected]>Cc Simon Glass <[email protected]>Acked-by Stephen Warren <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140307/8e80c71c/attachment.pgp>
PATCH v3 3/4 config.mk: specify the exact path to standalone linker script
In reply to Masahiro YamadaWe want to change the build system to include config.mk only from ./Makefile and spl/Makefile.
We must prepare for that in this commit.
$(src) is a moving target and not handy for our purpose. We must replace it with a fixed path.
---
Changes in v3: None
Changes in v2: None
arch/mips/cpu/mips32/config.mk | 3 ++- arch/mips/cpu/mips64/config.mk | 3 ++- arch/mips/cpu/xburst/config.mk | 3 ++- arch/nds32/config.mk | 3 ++- arch/sparc/config.mk | 2 +- 5 files changed, 9 insertions(+), 5 deletions(-)
arch/mips/cpu/mips32/config.mk +2 -1
@@ -21,4 +21,5 @@ else PLATFORM_LDFLAGS += -m elf32ltsmip endif -CONFIG_STANDALONE_LOAD_ADDR ?= 0x80200000 -T $(srctree)/$(src)/mips.lds +CONFIG_STANDALONE_LOAD_ADDR ?= 0x80200000 \ + -T $(srctree)/examples/standalone/mips.lds
arch/mips/cpu/mips64/config.mk +2 -1
@@ -21,4 +21,5 @@ else PLATFORM_LDFLAGS += -m elf64ltsmip endif -CONFIG_STANDALONE_LOAD_ADDR ?= 0xffffffff80200000 -T $(srctree)/$(src)/mips64.lds +CONFIG_STANDALONE_LOAD_ADDR ?= 0xffffffff80200000 \ + -T $(srctree)/examples/standalone/mips64.lds
arch/mips/cpu/xburst/config.mk +2 -1
@@ -12,4 +12,5 @@ else PLATFORM_LDFLAGS += -m elf32ltsmip endif -CONFIG_STANDALONE_LOAD_ADDR ?= 0x80200000 -T $(srctree)/$(src)/mips.lds +CONFIG_STANDALONE_LOAD_ADDR ?= 0x80200000 \ + -T $(srctree)/examples/standalone/mips.lds
arch/nds32/config.mk +2 -1
@@ -12,7 +12,8 @@ ifeq ($(CROSS_COMPILE),) CROSS_COMPILE := nds32le-linux- endif -CONFIG_STANDALONE_LOAD_ADDR = 0x300000 -T $(srctree)/$(src)/nds32.lds +CONFIG_STANDALONE_LOAD_ADDR = 0x300000 \ + -T $(srctree)/examples/standalone/nds32.lds PLATFORM_RELFLAGS += -fno-strict-aliasing -fno-common -mrelax PLATFORM_RELFLAGS += -gdwarf-2
arch/sparc/config.mk +1 -1
@@ -10,6 +10,6 @@ CROSS_COMPILE := sparc-elf- endif CONFIG_STANDALONE_LOAD_ADDR ?= 0x00000000 -L $(gcclibdir) \ - -T $(srctree)/$(src)/sparc.lds + -T $(srctree)/examples/standalone/sparc.lds PLATFORM_CPPFLAGS += -DCONFIG_SPARC -D__sparc__
Signature · 1 line
1.8.3.2
PATCH v3 3/4 config.mk: specify the exact path to standalone linker script
Quoted 8 lines · Masahiro Yamada
We want to change the build system to include config.mk only from ./Makefile and spl/Makefile.
We must prepare for that in this commit.$(src) is a moving target and not handy for our purpose. We must replace it with a fixed path.
Signed-off-by Masahiro Yamada <[email protected]>
PATCH v3 3/4 config.mk: specify the exact path to standalone linker script
In reply to Masahiro YamadaQuoted 8 lines · Masahiro Yamada
We want to change the build system to include config.mk only from ./Makefile and spl/Makefile.
We must prepare for that in this commit.$(src) is a moving target and not handy for our purpose. We must replace it with a fixed path.
Signed-off-by Masahiro Yamada <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140307/6ca4348b/attachment.pgp>
PATCH v3 4/4 kbuild: improve Kbuild speed
In reply to Masahiro YamadaKbuild brought about many advantages for us but a significant performance regression was reported by Simon Glass.
After some discussions and analysis, it turned out its main cause is in $(call cc-option,...).
Historically, U-Boot parses all config.mk (arch/*/config.mk and board/*/config.mk)
every time descending into subdirectories.
That means cc-options are evaluated over and over again.
$(call cc-option,...) is useful but costly.
So we want to evaluate them only in ./Makefile
and spl/Makefile and export compiler flags.
This commit changes the build system as follows:
- Modify scripts/Makefile.build to not include config.mk
Instead, add $(PLATFORM_CPPFLAGS) to asflags-y, ccflags-y,
cppflags-y. - Export many variables
Going forward, Kbuild will not parse config.mk files when it descends into subdirectories.
If we want to set variables in config.mk and use them in subdirectories, they must be exported.
This is the list of variables to get exported:
PLATFORM_CPPFLAGS
CPUDIR
BOARDDIR
OBJCOPYFLAGS
LDFLAGS
LDFLAGS_FINAL
(used in nand_spl/board/*/*/Makefile)
CONFIG_STANDALONE_LOAD_ADDR
(used in examples/standalone/Makefile)
SYM_PREFIX
(used in examples/standalone/Makefile)
RELFLAGS
(used in examples/standalone/Makefile)
- Delete CPPFLAGS
This variable has been replaced with PLATFORM_CPPFLAGS
- Copy gcclibdir from example/standalone/Makefile to arch/sparc/config.mk
The reference in CONFIG_STANDALONE_LOAD_ADDR must be resolved before it is exported.
---
Changes in v3:
- Modify spl/Makefile:
Move
KBUILD_CFLAGS += -ffunction-sections -fdata-sections
LDFLAGS_FINAL += --gc-sections
after
include $(TOPDIR)/config.mk
because $(TOPDIR)/config.mk resets the state of LDFLAGS_FINAL.
Otherwise, microblaze-generic board will be broken.Changes in v2: None
Makefile | 7 ++++--- arch/blackfin/config.mk | 1 + arch/sparc/config.mk | 2 ++ config.mk | 28 ++++++++++++++++++++-------- examples/standalone/Makefile | 5 ++--- scripts/Makefile.build | 10 +++++----- scripts/Makefile.lib | 7 +++---- spl/Makefile | 15 +++++++-------- 8 files changed, 44 insertions(+), 31 deletions(-)
Makefile +4 -3
@@ -358,13 +358,13 @@ UBOOTRELEASE = $(shell cat include/config/uboot.release 2> /dev/null) UBOOTVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION) export VERSION PATCHLEVEL SUBLEVEL UBOOTRELEASE UBOOTVERSION -export ARCH CPU BOARD VENDOR SOC +export ARCH CPU BOARD VENDOR SOC CPUDIR BOARDDIR export CONFIG_SHELL HOSTCC HOSTCFLAGS HOSTLDFLAGS CROSS_COMPILE AS LD CC export CPP AR NM LDR STRIP OBJCOPY OBJDUMP export MAKE AWK export DTC CHECK CHECKFLAGS -export KBUILD_CPPFLAGS NOSTDINC_FLAGS UBOOTINCLUDE +export KBUILD_CPPFLAGS NOSTDINC_FLAGS UBOOTINCLUDE OBJCOPYFLAGS LDFLAGS export KBUILD_CFLAGS KBUILD_AFLAGS # When compiling out-of-tree modules, put MODVERDIR in the module
@@ -567,7 +567,8 @@ NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include) CHECKFLAGS += $(NOSTDINC_FLAGS) # FIX ME -cpp_flags := $(KBUILD_CPPFLAGS) $(CPPFLAGS) $(UBOOTINCLUDE) $(NOSTDINC_FLAGS) +cpp_flags := $(KBUILD_CPPFLAGS) $(PLATFORM_CPPFLAGS) $(UBOOTINCLUDE) \ + $(NOSTDINC_FLAGS) c_flags := $(KBUILD_CFLAGS) $(cpp_flags) #########################################################################
arch/blackfin/config.mk +1 -0
@@ -43,6 +43,7 @@ CREATE_LDR_ENV = endif SYM_PREFIX = _ +export SYM_PREFIX LDR_FLAGS-y := LDR_FLAGS-$(CONFIG_BFIN_BOOTROM_USES_EVT1) += -J
arch/sparc/config.mk +2 -0
@@ -9,6 +9,8 @@ ifeq ($(CROSS_COMPILE),) CROSS_COMPILE := sparc-elf- endif +gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`) + CONFIG_STANDALONE_LOAD_ADDR ?= 0x00000000 -L $(gcclibdir) \ -T $(srctree)/examples/standalone/sparc.lds
config.mk +20 -8
@@ -6,11 +6,18 @@ # ######################################################################### -# clean the slate ... -PLATFORM_RELFLAGS = -PLATFORM_CPPFLAGS = -PLATFORM_LDFLAGS = - +# This file is included from ./Makefile and spl/Makefile. +# Clean the state to avoid the same flags added twice. +# +# (Tegra needs different flags for SPL. +# That's the reason why this file must be included from spl/Makefile too. +# If we did not have Tegra SoCs, build system would be much simpler...) +PLATFORM_RELFLAGS := +PLATFORM_CPPFLAGS := +PLATFORM_LDFLAGS := +LDFLAGS := +LDFLAGS_FINAL := +OBJCOPYFLAGS := ######################################################################### # Some architecture config.mk files need to know what CPUDIR is set to,
@@ -41,12 +48,17 @@ endif ######################################################################### -RELFLAGS= $(PLATFORM_RELFLAGS) +RELFLAGS := $(PLATFORM_RELFLAGS) OBJCOPYFLAGS += --gap-fill=0xff -CPPFLAGS = $(RELFLAGS) -CPPFLAGS += -pipe $(PLATFORM_CPPFLAGS) +PLATFORM_CPPFLAGS += $(RELFLAGS) +PLATFORM_CPPFLAGS += -pipe LDFLAGS += $(PLATFORM_LDFLAGS) LDFLAGS_FINAL += -Bstatic + +export PLATFORM_CPPFLAGS +export RELFLAGS +export LDFLAGS_FINAL +export CONFIG_STANDALONE_LOAD_ADDR
examples/standalone/Makefile +2 -3
@@ -44,9 +44,8 @@ gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`) # relocatable executable. The relocation data is not needed, and # also causes the entry point of the standalone application to be # inconsistent. -ifeq ($(ARCH),powerpc) -# FIX ME -CPPFLAGS := $(filter-out $(RELFLAGS), $(CPPFLAGS)) +ifeq ($(CONFIG_PPC),y) +PLATFORM_CPPFLAGS := $(filter-out $(RELFLAGS),$(PLATFORM_CPPFLAGS)) endif # We don't want gcc reordering functions if possible. This ensures that an
scripts/Makefile.build +5 -5
@@ -55,11 +55,6 @@ endif include scripts/Kbuild.include -# Added for U-Boot -# We must include config.mk after Kbuild.include -# so that some config.mk can use cc-option. -include config.mk - # For backward compatibility check that these variables do not change save-cflags := $(CFLAGS)
@@ -68,6 +63,11 @@ kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src)) kbuild-file := $(if $(wildcard $(kbuild-dir)/Kbuild),$(kbuild-dir)/Kbuild,$(kbuild-dir)/Makefile) include $(kbuild-file) +# Added for U-Boot +asflags-y += $(PLATFORM_CPPFLAGS) +ccflags-y += $(PLATFORM_CPPFLAGS) +cppflags-y += $(PLATFORM_CPPFLAGS) + # If the save-* variables changed error out ifeq ($(KBUILD_NOPEDANTIC),) ifneq ("$(save-cflags)","$(CFLAGS)")
scripts/Makefile.lib +3 -4
@@ -101,13 +101,12 @@ basename_flags = -D"KBUILD_BASENAME=KBUILD_STR($(call name-fix,$(basetarget)))" modname_flags = $(if $(filter 1,$(words $(modname))),\ -D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))") -# U-Boot also uses $(CPPFLAGS) -orig_c_flags = $(KBUILD_CPPFLAGS) $(CPPFLAGS) $(KBUILD_CFLAGS) $(KBUILD_SUBDIR_CCFLAGS) \ +orig_c_flags = $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(KBUILD_SUBDIR_CCFLAGS) \ $(ccflags-y) $(CFLAGS_$(basetarget).o) _c_flags = $(filter-out $(CFLAGS_REMOVE_$(basetarget).o), $(orig_c_flags)) -_a_flags = $(KBUILD_CPPFLAGS) $(CPPFLAGS) $(KBUILD_AFLAGS) $(KBUILD_SUBDIR_ASFLAGS) \ +_a_flags = $(KBUILD_CPPFLAGS) $(KBUILD_AFLAGS) $(KBUILD_SUBDIR_ASFLAGS) \ $(asflags-y) $(AFLAGS_$(basetarget).o) -_cpp_flags = $(KBUILD_CPPFLAGS) $(CPPFLAGS) $(cppflags-y) $(CPPFLAGS_$(@F)) +_cpp_flags = $(KBUILD_CPPFLAGS) $(cppflags-y) $(CPPFLAGS_$(@F)) # # Enable gcov profiling flags for a file, directory or for all files depending
spl/Makefile +7 -8
@@ -29,10 +29,6 @@ ifeq ($(CONFIG_TPL_BUILD),y) KBUILD_CPPFLAGS += -DCONFIG_TPL_BUILD endif -# Enable garbage collection of un-used sections for SPL -KBUILD_CFLAGS += -ffunction-sections -fdata-sections -LDFLAGS_FINAL += --gc-sections - ifeq ($(CONFIG_TPL_BUILD),y) export CONFIG_TPL_BUILD SPL_BIN := u-boot-tpl
@@ -50,8 +46,14 @@ endif include $(TOPDIR)/config.mk +# Enable garbage collection of un-used sections for SPL +KBUILD_CFLAGS += -ffunction-sections -fdata-sections +LDFLAGS_FINAL += --gc-sections + # FIX ME -c_flags := $(KBUILD_CFLAGS) $(KBUILD_CPPFLAGS) $(CPPFLAGS) $(UBOOTINCLUDE) $(NOSTDINC_FLAGS) +cpp_flags := $(KBUILD_CPPFLAGS) $(PLATFORM_CPPFLAGS) $(UBOOTINCLUDE) \ + $(NOSTDINC_FLAGS) +c_flags := $(KBUILD_CFLAGS) $(cpp_flags) # Auto-generate the spl-autoconf.mk file (which is included by all makefiles for SPL) quiet_cmd_autoconf = GEN $@
@@ -228,9 +230,6 @@ PHONY += $(u-boot-spl-dirs) $(u-boot-spl-dirs): $(Q)$(MAKE) $(build)=$@ -# FIX ME -cpp_flags := $(KBUILD_CPPFLAGS) $(CPPFLAGS) $(UBOOTINCLUDE) $(NOSTDINC_FLAGS) - quiet_cmd_cpp_lds = LDS $@ cmd_cpp_lds = $(CPP) $(cpp_flags) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ \ -x assembler-with-cpp -P -o $@ $<
Signature · 1 line
1.8.3.2
PATCH v3 4/4 kbuild: improve Kbuild speed
Quoted 50 lines · Masahiro Yamada
Kbuildbrought about many advantages for us but a significant performance regression was reported by Simon Glass.After some discussions and analysis, it turned out its main cause is in $(call cc-option,...).
Historically, U-Boot parses all config.mk (
arch/*/config.mkandboard/*/config.mk)
every time descending into subdirectories.
That means cc-options are evaluated over and over again.$(call cc-option,...) is useful but costly.
So we want to evaluate them only in ./Makefile
and spl/Makefile and export compiler flags.This commit changes the build system as follows:
- Modify
scripts/Makefile.buildto not include config.mkInstead, add $(PLATFORM_CPPFLAGS) to asflags-y, ccflags-y, cppflags-y.- Export many variables
Going forward,Kbuildwill not parse config.mk files when it descends into subdirectories.
If we want to set variables in config.mk and use them in subdirectories, they must be exported.This is the list of variables to get exported:
PLATFORM_CPPFLAGS
CPUDIR
BOARDDIR
OBJCOPYFLAGS
LDFLAGS
LDFLAGS_FINAL
(used in nand_spl/board/*/*/Makefile)
CONFIG_STANDALONE_LOAD_ADDR
(used in examples/standalone/Makefile)
SYM_PREFIX
(used in examples/standalone/Makefile)
RELFLAGS
(used in examples/standalone/Makefile)- Delete CPPFLAGS
This variable has been replaced withPLATFORM_CPPFLAGS- Copy gcclibdir from example/standalone/Makefile to
arch/sparc/config.mk
The reference inCONFIG_STANDALONE_LOAD_ADDRmust be resolved before it is exported.
Quoted 5 lines
Signed-off-by Masahiro Yamada <[email protected]>Reported-by Simon Glass <[email protected]>Acked-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140307/a1513c4f/attachment.pgp>