[PATCH 19/32] lm32/lm32_evr: Add per-section compilation and linking support

Joel Sherrill joel at rtems.org
Fri Mar 11 00:15:24 UTC 2016


updates #2577.

For the milkymist BSP variant without this option sample executables
sizes were as follows:

   text	   data	    bss	    	  dec	    	  hex	filename
 101160	   9044	  13333	 123537	  1e291	ticker.exe
  30888	   2676	   9169	  42733	   a6ed	minimum.exe
 592200	  90020	  26557	 708777	  ad0a9	fileio.exe
 456048	  64528	  42565	 563141	  897c5	pppd.exe
 203752	  25404	  16241	 245397	  3be95	capture.exe
 118216	  10704	  13437	 142357	  22c15	nsecs.exe
 197848	  22468	  13981	 234297	  39339	paranoia.exe
  97496	   8760	  13301	 119557	  1d305	base_sp.exe
 100392	   9120	  17141	 126653	  1eebd	unlimited.exe
 121032	   7720	  13309	 142061	  22aed	hello.exe
 289340	  28120	  20653	 338113	  528c1	loopback.exe

For the milkymist BSP variant with this option sample executables
sizes were as follows:

   text	   data	    bss	    	  dec	    	  hex	filename
  93464	   8748	  13333	 115545	  1c359	ticker.exe
  17144	   1308	   9133	  27585	   6bc1	minimum.exe
 574024	  87296	  26301	 687621	  a7e05	fileio.exe
 415668	  60652	  41837	 518157	  7e80d	pppd.exe
 190920	  24712	  16233	 231865	  389b9	capture.exe
 111800	  10404	  13405	 135609	  211b9	nsecs.exe
 187272	  22064	  13949	 223285	  36835	paranoia.exe
  87656	   8440	  13301	 109397	  1ab55	base_sp.exe
  89048	   8736	  17149	 114933	  1c0f5	unlimited.exe
 108888	   7316	  13309	 129513	  1f9e9	hello.exe
 262820	  26764	  20557	 310141	  4bb7d	loopback.exe
---
 c/src/lib/libbsp/lm32/milkymist/make/custom/milkymist.cfg | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/c/src/lib/libbsp/lm32/milkymist/make/custom/milkymist.cfg b/c/src/lib/libbsp/lm32/milkymist/make/custom/milkymist.cfg
index ae691eb..97fcb9e 100644
--- a/c/src/lib/libbsp/lm32/milkymist/make/custom/milkymist.cfg
+++ b/c/src/lib/libbsp/lm32/milkymist/make/custom/milkymist.cfg
@@ -19,6 +19,9 @@ CPU_CFLAGS = -mbarrel-shift-enabled -mmultiply-enabled \
 
 # optimize flag: typically -O2
 CFLAGS_OPTIMIZE_V = -O2 -g
+CFLAGS_OPTIMIZE_V += -ffunction-sections -fdata-sections
+
+LDFLAGS = -Wl,--gc-sections
 
 define bsp-post-link
 	$(OBJCOPY) -O binary --strip-all $(basename $@)$(EXEEXT) \
-- 
1.8.3.1




More information about the devel mailing list