]> git.baikalelectronics.ru Git - uboot.git/commitdiff
ARM: don't use --gc-sections with LTO when using private libgcc
authorMarek Behún <marek.behun@nic.cz>
Thu, 20 May 2021 11:24:24 +0000 (13:24 +0200)
committerTom Rini <trini@konsulko.com>
Mon, 24 May 2021 18:21:30 +0000 (14:21 -0400)
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@nic.cz>
Reviewed-by: Simon Glass <sjg@chromium.org>
arch/arm/config.mk

index f556ee3329f612cde3044eeb1986b0442fdfb438..16c63e12667ebccbf3b891c67e4f9b005cecb7ca 100644 (file)
@@ -15,7 +15,9 @@ CFLAGS_NON_EFI := -fno-pic -ffixed-r9 -ffunction-sections -fdata-sections \
                  -fstack-protector-strong
 CFLAGS_EFI := -fpic -fshort-wchar
 
+ifneq ($(CONFIG_LTO)$(CONFIG_USE_PRIVATE_LIBGCC),yy)
 LDFLAGS_FINAL += --gc-sections
+endif
 
 ifndef CONFIG_LTO
 PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections