Browse Source

allow to choose ld garbage collector

Waldemar Brodkorb 11 years ago
parent
commit
f09c62954e
2 changed files with 11 additions and 0 deletions
  1. 6 0
      mk/vars.mk
  2. 5 0
      target/config/Config.in.toolchain

+ 6 - 0
mk/vars.mk

@@ -124,6 +124,12 @@ TARGET_CFLAGS+=		-fPIE
 TARGET_CXXFLAGS+=	-fPIE
 endif
 
+ifneq ($(ADK_TARGET_USE_LD_GC),)
+TARGET_CFLAGS+=		-fdata-sections -ffunction-sections
+TARGET_CXXFLAGS+=	-fdata-sections -ffunction-sections
+TARGET_LDFLAGS+=	-Wl,--gc-sections
+endif
+
 ifneq ($(ADK_TARGET_USE_LTO),)
 TARGET_CFLAGS+=		-flto
 TARGET_CXXFLAGS+=	-flto

+ 5 - 0
target/config/Config.in.toolchain

@@ -67,6 +67,11 @@ config ADK_TARGET_USE_LTO
 	select ADK_TOOLCHAIN_WITH_LTO
 	default n
 
+config ADK_TARGET_USE_LD_GC
+	prompt "Use LD garbage collection for all packages"
+	boolean
+	default n
+
 config ADK_TOOLCHAIN_WITH_GOLD
 	boolean
 	default n