[PATCH 27/32] sh/gensh4: Add per-section compilation and linking support

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


updates #2577.

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

   text	   data	    bss	    	  dec	    	  hex	filename
  75538	  10666	   7264	  93468	  16d1c	ticker.exe
  21810	   6166	   3008	  30984	   7908	minimum.exe
 424370	  69762	  20476	 514608	  7da30	fileio.exe
 342538	  50782	  36468	 429788	  68edc	pppd.exe
 150930	  23130	  10168	 184228	  2cfa4	capture.exe
  90578	  11078	   7348	 109004	  1a9cc	nsecs.exe
 125010	  22190	   7824	 155024	  25d90	paranoia.exe
 153282	  26686	   8328	 188296	  2df88	cdtest.exe
  73426	  10498	   7232	  91156	  16414	base_sp.exe
  75186	  10734	  11072	  96992	  17ae0	unlimited.exe
  85650	   9070	   7224	 101944	  18e38	hello.exe
 212390	  22942	  14556	 249888	  3d020	loopback.exe

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

   text	   data	    bss	    	  dec	    	  hex	filename
  70418	  10214	   7228	  87860	  15734	ticker.exe
  14514	   4886	   2984	  22384	   5770	minimum.exe
 411234	  67894	  20184	 499312	  79e70	fileio.exe
 309906	  43666	  35668	 389240	  5f078	pppd.exe
 143074	  22414	  10132	 175620	  2ae04	capture.exe
  86130	  10606	   7312	 104048	  19670	nsecs.exe
 118978	  21714	   7804	 148496	  24410	paranoia.exe
 147778	  15814	   8292	 171884	  29f6c	cdtest.exe
  67890	  10042	   7196	  85128	  14c88	base_sp.exe
  69010	  10254	  11036	  90300	  160bc	unlimited.exe
  78850	   8578	   7204	  94632	  171a8	hello.exe
 189586	  17346	  14392	 221324	  3608c	loopback.exe
---
 c/src/lib/libbsp/sh/gensh4/make/custom/gensh4.cfg | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/c/src/lib/libbsp/sh/gensh4/make/custom/gensh4.cfg b/c/src/lib/libbsp/sh/gensh4/make/custom/gensh4.cfg
index dd1a9f7..4eb20f9 100644
--- a/c/src/lib/libbsp/sh/gensh4/make/custom/gensh4.cfg
+++ b/c/src/lib/libbsp/sh/gensh4/make/custom/gensh4.cfg
@@ -23,4 +23,7 @@ RTEMS_CPU_MODEL=sh7750
 CPU_CFLAGS = -m4 -ml
 
 # optimize flag: typically -O2
-CFLAGS_OPTIMIZE_V = -O2 -g 
+CFLAGS_OPTIMIZE_V = -O2 -g
+CFLAGS_OPTIMIZE_V += -ffunction-sections -fdata-sections
+
+LDFLAGS = -Wl,--gc-sections
-- 
1.8.3.1




More information about the devel mailing list