From 5e6c30bc421757a11ec6f7c1f730bf36c7de1b57 Mon Sep 17 00:00:00 2001 From: Jacob Garber Date: Wed, 2 Oct 2019 18:55:23 -0600 Subject: coreinfo: Add support for link time optimization MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This introduces a Kconfig option for compiling coreinfo with LTO. This option can be used independently of LTO in libpayload, though will benefit most if that is enabled as well. If both are enabled, the final size of coreinfo.elf is reduced from 95 KiB to 92 KiB. Tested in QEMU and on Thinkpad T500. Change-Id: I6feacdb911b52b946869bff369e03dcf72897c9f Signed-off-by: Jacob Garber Reviewed-on: https://review.coreboot.org/c/coreboot/+/38293 Reviewed-by: Michael Niewöhner Reviewed-by: Martin Roth Tested-by: build bot (Jenkins) --- payloads/coreinfo/Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'payloads/coreinfo/Makefile') diff --git a/payloads/coreinfo/Makefile b/payloads/coreinfo/Makefile index d842b469c4..cd58f392dd 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 $@ -- cgit v1.2.3