[rtems commit] sh/simsh: 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:    f34c41a2539d04c0b7a2900cd7e7a94dbe7cf76e
Changeset: http://git.rtems.org/rtems/commit/?id=f34c41a2539d04c0b7a2900cd7e7a94dbe7cf76e

Author:    Joel Sherrill <joel at rtems.org>
Date:      Thu Mar 10 17:09:20 2016 -0600

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

updates #2577.

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

   text	   data	    bss	    	  dec	    	  hex	filename
  73984	   7220	   7036	  88240	  158b0	ticker.exe
  21284	   6388	   2856	  30528	   7740	minimum.exe
 368616	  17820	  36256	 422692	  67324	pppd.exe
 162660	   7876	   9936	 180472	  2c0f8	capture.exe
  87812	   7308	   7121	 102241	  18f61	nsecs.exe
 152564	   7592	   7604	 167760	  28f50	paranoia.exe
 161260	  16640	   8108	 186008	  2d698	cdtest.exe
  71256	   7220	   7012	  85488	  14df0	base_sp.exe
  73852	   7248	  10852	  91952	  16730	unlimited.exe
  86888	   7192	   7016	 101096	  18ae8	hello.exe
 219504	  11712	  14332	 245548	  3bf2c	loopback.exe

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

   text	   data	    bss	    	  dec	    	  hex	filename
  68260	   5688	   5984	  79932	  1383c	ticker.exe
  11724	   4364	   1824	  17912	   45f8	minimum.exe
 331732	  13000	  34424	 379156	  5c914	pppd.exe
 153408	   6312	   8892	 168612	  292a4	capture.exe
  82804	   5776	   6073	  94653	  171bd	nsecs.exe
 145108	   6056	   6560	 157724	  2681c	paranoia.exe
 153036	   6196	   7060	 166292	  28994	cdtest.exe
  64236	   5684	   5964	  75884	  1286c	base_sp.exe
  66684	   5712	   9808	  82204	  1411c	unlimited.exe
  79304	   5656	   5956	  90916	  16324	hello.exe
 193844	   6936	  13148	 213928	  343a8	loopback.exe

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

   text	   data	    bss	    	  dec	    	  hex	filename
  71344	   7168	   7040	  85552	  14e30	ticker.exe
  19156	   6352	   2860	  28368	   6ed0	minimum.exe
 366744	  17768	  36244	 420756	  66b94	pppd.exe
 160612	   7824	   9940	 178376	  2b8c8	capture.exe
  85156	   7256	   7125	  99537	  184d1	nsecs.exe
 149796	   7540	   7608	 164944	  28450	paranoia.exe
 158908	  16588	   8112	 183608	  2cd38	cdtest.exe
  69112	   7168	   7016	  83296	  14560	base_sp.exe
  71692	   7196	  10856	  89744	  15e90	unlimited.exe
  84792	   7140	   7020	  98952	  18288	hello.exe
 217488	  11660	  14336	 243484	  3b71c	loopback.exe

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

   text	   data	    bss	    	  dec	    	  hex	filename
  66404	   5688	   5984	  78076	  130fc	ticker.exe
  11340	   4364	   1824	  17528	   4478	minimum.exe
 331044	  13000	  34424	 378468	  5c664	pppd.exe
 152640	   6312	   8892	 167844	  28fa4	capture.exe
  80580	   5776	   6073	  92429	  1690d	nsecs.exe
 143652	   6056	   6560	 156268	  2626c	paranoia.exe
 151980	   6196	   7060	 165236	  28574	cdtest.exe
  63404	   5684	   5964	  75052	  1252c	base_sp.exe
  65836	   5712	   9808	  81356	  13dcc	unlimited.exe
  78616	   5656	   5956	  90228	  16074	hello.exe
 193140	   6936	  13148	 213224	  340e8	loopback.exe

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

   text	   data	    bss	    	  dec	    	  hex	filename
  72736	   6140	   7040	  85916	  14f9c	ticker.exe
  19156	   5324	   2860	  27340	   6acc	minimum.exe
 368864	  16740	  36252	 421856	  66fe0	pppd.exe
 159756	   6796	   9932	 176484	  2b164	capture.exe
  88228	   6228	   7109	 101565	  18cbd	nsecs.exe
 122684	   6460	   7380	 136524	  2154c	paranoia.exe
 157508	  15740	   8100	 181348	  2c464	cdtest.exe
  70504	   6140	   7000	  83644	  146bc	base_sp.exe
  73116	   6168	  10856	  90140	  1601c	unlimited.exe
  81616	   6112	   7012	  94740	  17214	hello.exe
 217336	  10632	  14328	 242296	  3b278	loopback.exe

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

   text	   data	    bss	    	  dec	    	  hex	filename
  67956	   5688	   5984	  79628	  1370c	ticker.exe
  11404	   4364	   1824	  17592	   44b8	minimum.exe
 333228	  13000	  34416	 380644	  5cee4	pppd.exe
 151864	   6312	   8884	 167060	  28c94	capture.exe
  83828	   5776	   6073	  95677	  175bd	nsecs.exe
 116764	   6004	   6332	 129100	  1f84c	paranoia.exe
 150740	   6196	   7052	 163988	  28094	cdtest.exe
  64940	   5684	   5964	  76588	  12b2c	base_sp.exe
  67404	   5712	   9808	  82924	  143ec	unlimited.exe
  75616	   5656	   5964	  87236	  154c4	hello.exe
 192956	   6936	  13156	 213048	  34038	loopback.exe

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

   text	   data	    bss	    	  dec	    	  hex	filename
  73104	   6052	   7172	  86328	  15138	ticker.exe
  19908	   5280	   2996	  28184	   6e18	minimum.exe
 369572	  16652	  36380	 422604	  672cc	pppd.exe
 160384	   6708	  10076	 177168	  2b410	capture.exe
  88628	   6140	   7257	 102025	  18e89	nsecs.exe
 133776	   6424	   7744	 147944	  241e8	paranoia.exe
 157496	  15616	   8248	 181360	  2c470	cdtest.exe
  70920	   6052	   7148	  84120	  14898	base_sp.exe
  73532	   6080	  10988	  90600	  161e8	unlimited.exe
  82180	   6024	   7156	  95360	  17480	hello.exe
 217852	  10544	  14472	 242868	  3b4b4	loopback.exe

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

   text	   data	    bss	    	  dec	    	  hex	filename
  68388	   5688	   6120	  80196	  13944	ticker.exe
  12572	   4364	   1960	  18896	   49d0	minimum.exe
 333776	  13000	  34548	 381324	  5d18c	pppd.exe
 152444	   6312	   9016	 167772	  28f5c	capture.exe
  84276	   5776	   6209	  96261	  17805	nsecs.exe
 127888	   6056	   6684	 140628	  22554	paranoia.exe
 150632	   6196	   7184	 164012	  280ac	cdtest.exe
  65500	   5684	   6100	  77284	  12de4	base_sp.exe
  67964	   5712	   9944	  83620	  146a4	unlimited.exe
  76260	   5656	   6096	  88012	  157cc	hello.exe
 193280	   6936	  13288	 213504	  34200	loopback.exe

---

 c/src/lib/libbsp/sh/shsim/make/custom/simsh1.cfg  | 5 ++++-
 c/src/lib/libbsp/sh/shsim/make/custom/simsh2.cfg  | 5 ++++-
 c/src/lib/libbsp/sh/shsim/make/custom/simsh2e.cfg | 5 ++++-
 c/src/lib/libbsp/sh/shsim/make/custom/simsh4.cfg  | 5 ++++-
 4 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/c/src/lib/libbsp/sh/shsim/make/custom/simsh1.cfg b/c/src/lib/libbsp/sh/shsim/make/custom/simsh1.cfg
index 86dc108..84e891a 100644
--- a/c/src/lib/libbsp/sh/shsim/make/custom/simsh1.cfg
+++ b/c/src/lib/libbsp/sh/shsim/make/custom/simsh1.cfg
@@ -13,4 +13,7 @@ RTEMS_CPU_MODEL=shgdb
 CPU_CFLAGS = -m1
 
 # 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
diff --git a/c/src/lib/libbsp/sh/shsim/make/custom/simsh2.cfg b/c/src/lib/libbsp/sh/shsim/make/custom/simsh2.cfg
index bf18cc6..8d23897 100644
--- a/c/src/lib/libbsp/sh/shsim/make/custom/simsh2.cfg
+++ b/c/src/lib/libbsp/sh/shsim/make/custom/simsh2.cfg
@@ -13,4 +13,7 @@ RTEMS_CPU_MODEL=shgdb
 CPU_CFLAGS = -m2
 
 # 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
diff --git a/c/src/lib/libbsp/sh/shsim/make/custom/simsh2e.cfg b/c/src/lib/libbsp/sh/shsim/make/custom/simsh2e.cfg
index 84f06e2..c47e40f 100644
--- a/c/src/lib/libbsp/sh/shsim/make/custom/simsh2e.cfg
+++ b/c/src/lib/libbsp/sh/shsim/make/custom/simsh2e.cfg
@@ -8,8 +8,11 @@ RTEMS_CPU=sh
 RTEMS_CPU_MODEL=shgdb
 
 #  This contains the compiler options necessary to select the CPU model
-#  and (hopefully) optimize for it. 
+#  and (hopefully) optimize for it.
 CPU_CFLAGS = -m2e -ml
 
 # optimize flag: typically -O2
 CFLAGS_OPTIMIZE_V = -O2 -g
+CFLAGS_OPTIMIZE_V += -ffunction-sections -fdata-sections
+
+LDFLAGS = -Wl,--gc-sections
diff --git a/c/src/lib/libbsp/sh/shsim/make/custom/simsh4.cfg b/c/src/lib/libbsp/sh/shsim/make/custom/simsh4.cfg
index 9245a85..076ba3d 100644
--- a/c/src/lib/libbsp/sh/shsim/make/custom/simsh4.cfg
+++ b/c/src/lib/libbsp/sh/shsim/make/custom/simsh4.cfg
@@ -8,8 +8,11 @@ RTEMS_CPU=sh
 RTEMS_CPU_MODEL=shgdb
 
 #  This contains the compiler options necessary to select the CPU model
-#  and (hopefully) optimize for it. 
+#  and (hopefully) optimize for it.
 CPU_CFLAGS = -m4 -ml
 
 # 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