diff mbox series

[U-Boot] arc: Eliminate unused code and data with GCC's garbage collector

Message ID 20180125180757.16167-1-abrodkin@synopsys.com
State Accepted, archived
Delegated to: Alexey Brodkin
Headers show
Series [U-Boot] arc: Eliminate unused code and data with GCC's garbage collector | expand

Commit Message

Alexey Brodkin Jan. 25, 2018, 6:07 p.m. UTC
Finally GCC's garbage collector works on ARC so let's use it.
That's what I may see for HSDK:

Before:
   text	   data	    bss	    dec	    hex	filename
 290153	  10068	 222616	 522837	  7fa55	u-boot

After:
   text	   data	    bss	    dec	    hex	filename
 261999	   9460	 222360	 493819	  788fb	u-boot

Overall ~5% of memory footprint saved.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
---
 arch/arc/config.mk | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/arch/arc/config.mk b/arch/arc/config.mk
index 13676bd0c8e1..a19c188dbcfa 100644
--- a/arch/arc/config.mk
+++ b/arch/arc/config.mk
@@ -51,9 +51,10 @@  PLATFORM_CPPFLAGS += -mcpu=archs
 endif
 
 PLATFORM_CPPFLAGS += -ffixed-r25 -D__ARC__ -gdwarf-2
+PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections
 
 # Needed for relocation
-LDFLAGS_FINAL += -pie
+LDFLAGS_FINAL += -pie --gc-sections
 
 # Load address for standalone apps
 CONFIG_STANDALONE_LOAD_ADDR ?= 0x82000000