summaryrefslogtreecommitdiffstats
path: root/payloads/coreinfo
diff options
context:
space:
mode:
Diffstat (limited to 'payloads/coreinfo')
-rw-r--r--payloads/coreinfo/Kconfig9
-rw-r--r--payloads/coreinfo/Makefile6
2 files changed, 14 insertions, 1 deletions
diff --git a/payloads/coreinfo/Kconfig b/payloads/coreinfo/Kconfig
index eafb8793638f..2c1f91c8746c 100644
--- a/payloads/coreinfo/Kconfig
+++ b/payloads/coreinfo/Kconfig
@@ -42,6 +42,15 @@ config PAYLOAD_INFO_VERSION
help
The version number of this payload.
+config LTO
+ bool "Use link time optimization (LTO)"
+ default n
+ help
+ Compile with link time optimization. This can often decrease the
+ final binary size, but may increase compilation time. This option
+ is most effective when LTO is also enabled in libpayload, which
+ is done separately.
+
endmenu
menu "Modules"
diff --git a/payloads/coreinfo/Makefile b/payloads/coreinfo/Makefile
index d842b469c401..cd58f392dde9 100644
--- a/payloads/coreinfo/Makefile
+++ b/payloads/coreinfo/Makefile
@@ -76,9 +76,13 @@ ifneq ($(strip $(HAVE_DOTCONFIG)),)
include $(src)/.config
real-all: $(TARGET)
+ifeq ($(CONFIG_LTO),y)
+CFLAGS += -flto
+endif
+
$(TARGET): $(src)/.config $(coreinfo_obj)/config.h $(OBJS) libpayload
printf " LPCC $(subst $(CURDIR)/,,$(@)) (LINK)\n"
- $(LPCC) -o $@ $(OBJS)
+ $(LPCC) $(CFLAGS) -o $@ $(OBJS)
$(OBJCOPY) --only-keep-debug $@ $(TARGET).debug
$(OBJCOPY) --strip-debug $@
$(OBJCOPY) --add-gnu-debuglink=$(TARGET).debug $@