ARM: don't use --gc-sections with LTO when using private libgcc

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>
This commit is contained in:
Marek Behún 2021-05-20 13:24:24 +02:00 committed by Tom Rini
parent 75c7d10c1f
commit 34ccadcd33
1 changed files with 2 additions and 0 deletions

View 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