sandbox: make LTO available
authorMarek Behún <marek.behun@nic.cz>
Thu, 20 May 2021 11:24:07 +0000 (13:24 +0200)
committerTom Rini <trini@konsulko.com>
Mon, 24 May 2021 18:21:30 +0000 (14:21 -0400)
Make LTO available for sandbox architecture.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
arch/Kconfig
arch/sandbox/config.mk

index 6c4b81a4866f88129877b0a0fa0c50891d801314..c5c03d438ceb3b6934e816c6b56f2e13cfc44a63 100644 (file)
@@ -101,6 +101,7 @@ config RISCV
 
 config SANDBOX
        bool "Sandbox"
+       select ARCH_SUPPORTS_LTO
        select BOARD_LATE_INIT
        select BZIP2
        select CMD_POWEROFF
index 2149771324cb41c3c429a922d025fff56b13ea50..1f8cb61c8bfb94fb0a438d42c47074c7ba112aa4 100644 (file)
@@ -17,16 +17,20 @@ PLATFORM_CPPFLAGS += $(shell $(SDL_CONFIG) --cflags)
 endif
 
 cmd_u-boot__ = $(CC) -o $@ -Wl,-T u-boot.lds $(u-boot-init) \
+       $(LTO_FINAL_LDFLAGS) \
        -Wl,--whole-archive \
                $(u-boot-main) \
+               $(u-boot-keep-syms-lto) \
        -Wl,--no-whole-archive \
        $(PLATFORM_LIBS) -Wl,-Map -Wl,u-boot.map
 
 cmd_u-boot-spl = (cd $(obj) && $(CC) -o $(SPL_BIN) -Wl,-T u-boot-spl.lds \
+       $(LTO_FINAL_LDFLAGS) \
        $(patsubst $(obj)/%,%,$(u-boot-spl-init)) \
        -Wl,--whole-archive \
                $(patsubst $(obj)/%,%,$(u-boot-spl-main)) \
                $(patsubst $(obj)/%,%,$(u-boot-spl-platdata)) \
+               $(patsubst $(obj)/%,%,$(u-boot-spl-keep-syms-lto)) \
        -Wl,--no-whole-archive \
        $(PLATFORM_LIBS) -Wl,-Map -Wl,u-boot-spl.map -Wl,--gc-sections)