aboutsummaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2022-08-03 12:13:08 -0600
committerTom Rini <trini@konsulko.com>2022-09-02 16:20:11 -0400
commita55014d09b29d7bc2cbaeb8e41a155c9a257a183 (patch)
tree7651a422b0d01a6a8ed0375e8f1a6eff3065df3f /arch
parent583f1b2f10be36f86a2da3686d406bfd90cfbc70 (diff)
downloadu-boot-a55014d09b29d7bc2cbaeb8e41a155c9a257a183.zip
u-boot-a55014d09b29d7bc2cbaeb8e41a155c9a257a183.tar.gz
u-boot-a55014d09b29d7bc2cbaeb8e41a155c9a257a183.tar.bz2
Makefile: Allow LTO to be disabled for a build
LTO (Link-Time Optimisation) is an very useful feature which can significantly reduce the size of U-Boot binaries. So far it has been made available for selected ARM boards and sandbox. However, incremental builds are much slower when LTO is used. For example, an incremental build of sandbox takes 2.1 seconds on my machine, but 6.7 seconds with LTO enabled. Add a NO_LTO parameter to the build, similar to NO_SDL, so it can be disabled during development if needed, for faster builds. Add some documentation about LTO while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/config.mk4
-rw-r--r--arch/arm/include/asm/global_data.h2
2 files changed, 3 insertions, 3 deletions
diff --git a/arch/arm/config.mk b/arch/arm/config.mk
index b3548ce..2065438 100644
--- a/arch/arm/config.mk
+++ b/arch/arm/config.mk
@@ -15,11 +15,11 @@ CFLAGS_NON_EFI := -fno-pic -ffixed-r9 -ffunction-sections -fdata-sections \
-fstack-protector-strong
CFLAGS_EFI := -fpic -fshort-wchar
-ifneq ($(CONFIG_LTO)$(CONFIG_USE_PRIVATE_LIBGCC),yy)
+ifneq ($(LTO_ENABLE)$(CONFIG_USE_PRIVATE_LIBGCC),yy)
LDFLAGS_FINAL += --gc-sections
endif
-ifndef CONFIG_LTO
+ifneq ($(LTO_ENABLE),y)
PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections
endif
diff --git a/arch/arm/include/asm/global_data.h b/arch/arm/include/asm/global_data.h
index 6ee2a76..cd6112d 100644
--- a/arch/arm/include/asm/global_data.h
+++ b/arch/arm/include/asm/global_data.h
@@ -101,7 +101,7 @@ struct arch_global_data {
#include <asm-generic/global_data.h>
-#if defined(__clang__) || defined(CONFIG_LTO)
+#if defined(__clang__) || defined(LTO_ENABLE)
#define DECLARE_GLOBAL_DATA_PTR
#define gd get_gd()