[PATCH u-boot v4 35/36] ARM: don't use --gc-sections with LTO when using private libgcc

Marek Behún marek.behun at nic.cz
Thu May 20 13:24:24 CEST 2021

When using LTO, we can throw away the --gc-sections flag, but only if
using private libgcc.

When using system's libgcc, --gc-sections is still needed, otherwise
linking will fail due to undefined references to libc's symbols.

Signed-off-by: Marek Behún <marek.behun at nic.cz>
 arch/arm/config.mk | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/config.mk b/arch/arm/config.mk
index f556ee3329..16c63e1266 100644
--- a/arch/arm/config.mk
+++ b/arch/arm/config.mk
@@ -15,7 +15,9 @@ CFLAGS_NON_EFI := -fno-pic -ffixed-r9 -ffunction-sections -fdata-sections \
 CFLAGS_EFI := -fpic -fshort-wchar
 LDFLAGS_FINAL += --gc-sections
 ifndef CONFIG_LTO
 PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections

More information about the U-Boot mailing list