Commit 34ccadcd3334 ("ARM: don't use --gc-sections with LTO when using
private libgcc") left out --gc-sections for LTO builds that use the
private libgcc. Since commit a55014d09b29 ("Makefile: Allow LTO to be
disabled for a build"), the condition tests LTO_ENABLE, which the top
Makefile sets only after it has read arch/arm/config.mk, so U-Boot
proper has been linked with --gc-sections ever since.Once the next patch sets LTO_ENABLE in time, the condition would take effect again. U-Boot proper would then keep the sections that nothing uses, such as the .discard.addressable section of keep-syms-lto.o. Keep --gc-sections for all builds. This changes no image on main. Signed-off-by: Josef Schlehofer <[email protected]> Cc: Tom Rini <[email protected]> Cc: Marek BehĂșn <[email protected]> Cc: Simon Glass <[email protected]> --- arch/arm/config.mk | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/arm/config.mk b/arch/arm/config.mk index 7e99e61ca82..6bbc7df3e5e 100644 --- a/arch/arm/config.mk +++ b/arch/arm/config.mk @@ -13,9 +13,7 @@ CFLAGS_NON_EFI := -fno-pic $(FIXED_REG) -ffunction-sections -fdata-sections \ -fstack-protector-strong CFLAGS_EFI := -fpic -fshort-wchar -ifneq ($(LTO_ENABLE)$(CONFIG_USE_PRIVATE_LIBGCC),yy) LDFLAGS_FINAL += --gc-sections -endif ifneq ($(LTO_ENABLE).$(CONFIG_ARM64)$(CONFIG_SKIP_RELOCATE_CODE),y.) PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections -- 2.54.0 (Apple Git-157)
