build: add a config knob to enable gc-sections for all packages

This enables the linker's garbage collection for all packages which haven't
opted-out.

Signed-off-by: Andre Heider <a.heider@gmail.com>
This commit is contained in:
Andre Heider
2023-02-03 13:15:43 +01:00
committed by Christian Marangi
parent 07730ff346
commit aef8bab9d7
2 changed files with 9 additions and 1 deletions

View File

@@ -51,7 +51,7 @@ ifdef CONFIG_USE_MIPS16
TARGET_CXXFLAGS += -mips16 -minterlink-mips16
endif
endif
ifeq ($(call pkg_build_flag,gc-sections,0),1)
ifeq ($(call pkg_build_flag,gc-sections,$(if $(CONFIG_USE_GC_SECTIONS),1,0)),1)
TARGET_CFLAGS+= -ffunction-sections -fdata-sections
TARGET_CXXFLAGS+= -ffunction-sections -fdata-sections
TARGET_LDFLAGS+= -Wl,--gc-sections