[rtems commit] sh/gensh2: Add per-section compilation and linking support

Joel Sherrill joel at rtems.org
Fri Mar 11 20:14:54 UTC 2016


Module:    rtems
Branch:    master
Commit:    5d75bb6b27d9b220ef5fe048dd965c4379c164c5
Changeset: http://git.rtems.org/rtems/commit/?id=5d75bb6b27d9b220ef5fe048dd965c4379c164c5

Author:    Joel Sherrill <joel at rtems.org>
Date:      Thu Mar 10 16:49:33 2016 -0600

sh/gensh2: Add per-section compilation and linking support

updates #2577.

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

   text	   data	    bss	    	  dec	    	  hex	filename
  61906	   7550	   6784	  76240	  129d0	ticker.exe
  24082	   3134	   2876	  30092	   758c	minimum.exe
 336698	  47742	  36256	 420696	  66b58	pppd.exe
 140210	  20034	   9684	 169928	  297c8	capture.exe
  75058	   7962	   6861	  89881	  15f19	nsecs.exe
 128850	  18446	   7352	 154648	  25c18	paranoia.exe
 142898	  22794	   7844	 173536	  2a5e0	cdtest.exe
  59618	   6734	   6752	  73104	  11d90	base_sp.exe
  62066	   6970	  10576	  79612	  136fc	unlimited.exe
  76066	   5322	   6732	  88120	  15838	hello.exe
 200630	  19846	  14080	 234556	  3943c	loopback.exe

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

   text	   data	    bss	    	  dec	    	  hex	filename
  58402	   7030	   6768	  72200	  11a08	ticker.exe
  13218	   1502	   1844	  16564	   40b4	minimum.exe
 298562	  40502	  35448	 374512	  5b6f0	pppd.exe
 133826	  19250	   9660	 162736	  27bb0	capture.exe
  71826	   7422	   6833	  86081	  15041	nsecs.exe
 124050	  17902	   7328	 149280	  24720	paranoia.exe
 138658	  11998	   7832	 158488	  26b18	cdtest.exe
  55330	   6210	   6724	  68264	  10aa8	base_sp.exe
  52898	   5398	   9516	  67812	  108e4	unlimited.exe
  66482	   3738	   5684	  75904	  12880	hello.exe
 179618	  14182	  13916	 207716	  32b64	loopback.exe

---

 c/src/lib/libbsp/sh/gensh2/make/custom/gensh2.cfg | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/c/src/lib/libbsp/sh/gensh2/make/custom/gensh2.cfg b/c/src/lib/libbsp/sh/gensh2/make/custom/gensh2.cfg
index 00d0fbf..40038e6 100644
--- a/c/src/lib/libbsp/sh/gensh2/make/custom/gensh2.cfg
+++ b/c/src/lib/libbsp/sh/gensh2/make/custom/gensh2.cfg
@@ -13,8 +13,10 @@ RTEMS_CPU_MODEL=sh7045
 
 #  This contains the compiler options necessary to select the CPU model
 #  and (hopefully) optimize for it.
-#
 CPU_CFLAGS = -m2
 
 # optimize flag: typically -O2
 CFLAGS_OPTIMIZE_V = -O2 -g 
+CFLAGS_OPTIMIZE_V += -ffunction-sections -fdata-sections
+
+LDFLAGS = -Wl,--gc-sections



More information about the vc mailing list