diff mbox series

[u-boot,v2,37/38] ARM: don't use --gc-sections with LTO when using private libgcc

Message ID 20210312103429.25895-38-marek.behun@nic.cz
State Superseded
Delegated to: Tom Rini
Headers show
Series U-Boot LTO (Sandbox + Some ARM boards) | expand

Commit Message

Marek BehĂșn March 12, 2021, 10:34 a.m. UTC
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>
---
 arch/arm/config.mk | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/arch/arm/config.mk b/arch/arm/config.mk
index 2b2c6ad2e5..68745d489f 100644
--- a/arch/arm/config.mk
+++ b/arch/arm/config.mk
@@ -14,7 +14,9 @@  endif
 CFLAGS_NON_EFI := -fno-pic -ffixed-r9 -ffunction-sections -fdata-sections
 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