[rtems commit] v850/gdbv850sim: 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:    a29aa2171b909bed7c849990a13b162941b0fe63
Changeset: http://git.rtems.org/rtems/commit/?id=a29aa2171b909bed7c849990a13b162941b0fe63

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

v850/gdbv850sim: Add per-section compilation and linking support

updates #2577.

Had to add .rtemsroset to the linkcmds following the arm to get it
to link after turning on the per-secton options.

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

   text	   data	    bss	    	  dec	    	  hex	filename
  76940	   6456	   4944	  88340	  15914	ticker.exe
  21896	   1860	    760	  24516	   5fc4	minimum.exe
 802270	  45832	  12837	 860939	  d230b	cxx_iostream.exe
 473916	  65152	  18156	 557224	  880a8	fileio.exe
 384288	  45724	  34148	 464160	  71520	pppd.exe
 161648	  18416	   7840	 187904	  2de00	capture.exe
  90856	   6740	   5021	 102617	  190d9	nsecs.exe
 158424	  17512	   5508	 181444	  2c4c4	paranoia.exe
 152938	  12948	   5821	 171707	  29ebb	cdtest.exe
  73808	   6296	   4912	  85016	  14c18	base_sp.exe
  77420	   6528	   8756	  92704	  16a20	unlimited.exe
  89692	   4792	   4916	  99400	  18448	hello.exe
 236138	  18396	  12240	 266774	  41216	loopback.exe

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

   text	   data	    bss	    	  dec	    	  hex	filename
  76739	   1552	   4920	  83211	  1450b	ticker.exe
  13682	    228	    748	  14658	   3942	minimum.exe
 491284	   6508	  12026	 509818	  7c77a	cxx_iostream.exe
 517952	   5632	  17859	 541443	  84303	fileio.exe
 379732	   8864	  33308	 421904	  67010	pppd.exe
 169182	   2176	   7815	 179173	  2bbe5	capture.exe
  91307	   1640	   4997	  97944	  17e98	nsecs.exe
 167431	   1920	   5484	 174835	  2aaf3	paranoia.exe
 156322	   1936	   5797	 164055	  280d7	cdtest.exe
  72591	   1548	   4888	  79027	  134b3	base_sp.exe
  76215	   1576	   8732	  86523	  151fb	unlimited.exe
  86346	   1520	   4892	  92758	  16a56	hello.exe
 221810	   2800	  12076	 236686	  39c8e	loopback.exe

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

   text	   data	    bss	    	  dec	    	  hex	filename
  69788	   6452	   4948	  81188	  13d24	ticker.exe
  20972	   1856	    788	  23616	   5c40	minimum.exe
 795748	  45828	  12841	 854417	  d0991	cxx_iostream.exe
 440586	  64864	  18160	 523610	  7fd5a	fileio.exe
 352650	  45644	  34152	 432446	  6993e	pppd.exe
 151172	  18400	   7844	 177416	  2b508	capture.exe
  84028	   6736	   5025	  95789	  1762d	nsecs.exe
 148268	  17500	   5512	 171280	  29d10	paranoia.exe
 145916	  12936	   5825	 164677	  28345	cdtest.exe
  67124	   6292	   4916	  78332	  131fc	base_sp.exe
  70452	   6508	   8760	  85720	  14ed8	unlimited.exe
  83800	   4788	   4920	  93508	  16d44	hello.exe
 221216	  18372	  12244	 251832	  3d7b8	loopback.exe

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

   text	   data	    bss	    	  dec	    	  hex	filename
  70155	   1552	   4924	  76631	  12b57	ticker.exe
  14156	    932	    776	  15864	   3df8	minimum.exe
 485650	   6508	  12030	 504188	  7b17c	cxx_iostream.exe
 485398	   5632	  17863	 508893	  7c3dd	fileio.exe
 351418	   8864	  33312	 393594	  6017a	pppd.exe
 159510	   2176	   7819	 169505	  29621	capture.exe
  84989	   1640	   5001	  91630	  165ee	nsecs.exe
 157973	   1920	   5488	 165381	  28605	paranoia.exe
 149880	   1936	   5801	 157617	  267b1	cdtest.exe
  66529	   1548	   4892	  72969	  11d09	base_sp.exe
  69847	   1576	   8736	  80159	  1391f	unlimited.exe
  81134	   1520	   4896	  87550	  155fe	hello.exe
 208878	   2800	  12080	 223758	  36a0e	loopback.exe

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

   text	   data	    bss	    	  dec	    	  hex	filename
  69784	   6452	   4948	  81184	  13d20	ticker.exe
  20972	   1856	    788	  23616	   5c40	minimum.exe
 791378	  45808	  12841	 850027	  cf86b	cxx_iostream.exe
 436576	  64848	  18160	 519584	  7eda0	fileio.exe
 348982	  45624	  34152	 428758	  68ad6	pppd.exe
 147420	  18380	   7844	 173644	  2a64c	capture.exe
  84020	   6736	   5025	  95781	  17625	nsecs.exe
 148736	  17480	   5512	 171728	  29ed0	paranoia.exe
 142216	  12916	   5825	 160957	  274bd	cdtest.exe
  67120	   6292	   4916	  78328	  131f8	base_sp.exe
  70448	   6508	   8760	  85716	  14ed4	unlimited.exe
  80048	   4768	   4920	  89736	  15e88	hello.exe
 217432	  18352	  12244	 248028	  3c8dc	loopback.exe

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

   text	   data	    bss	    	  dec	    	  hex	filename
  70151	   1552	   4924	  76627	  12b53	ticker.exe
  14156	    932	    776	  15864	   3df8	minimum.exe
 481408	   6508	  12030	 499946	  7a0ea	cxx_iostream.exe
 481378	   5632	  17863	 504873	  7b429	fileio.exe
 347740	   8864	  33312	 389916	  5f31c	pppd.exe
 155736	   2176	   7819	 165731	  28763	capture.exe
  84981	   1640	   5001	  91622	  165e6	nsecs.exe
 158331	   1920	   5488	 165739	  2876b	paranoia.exe
 146164	   1936	   5801	 153901	  2592d	cdtest.exe
  66525	   1548	   4892	  72965	  11d05	base_sp.exe
  69843	   1576	   8736	  80155	  1391b	unlimited.exe
  77363	   1520	   4896	  83779	  14743	hello.exe
 205082	   2800	  12080	 219962	  35b3a	loopback.exe

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

   text	   data	    bss	    	  dec	    	  hex	filename
  69626	   6452	   4948	  81026	  13c82	ticker.exe
  20920	   1856	    788	  23564	   5c0c	minimum.exe
 794782	  45828	  12841	 853451	  d05cb	cxx_iostream.exe
 440110	  64860	  18160	 523130	  7fb7a	fileio.exe
 351798	  45644	  34152	 431594	  695ea	pppd.exe
 150816	  18400	   7844	 177060	  2b3a4	capture.exe
  83850	   6736	   5025	  95611	  1757b	nsecs.exe
 147962	  17500	   5512	 170974	  29bde	paranoia.exe
 145458	  12936	   5825	 164219	  2817b	cdtest.exe
  66958	   6292	   4916	  78166	  13156	base_sp.exe
  70286	   6508	   8760	  85554	  14e32	unlimited.exe
  83606	   4788	   4920	  93314	  16c82	hello.exe
 220770	  18372	  12244	 251386	  3d5fa	loopback.exe

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

   text	   data	    bss	    	  dec	    	  hex	filename
  69971	   1552	   4924	  76447	  12a9f	ticker.exe
  14108	    932	    776	  15816	   3dc8	minimum.exe
 484692	   6508	  12030	 503230	  7adbe	cxx_iostream.exe
 484894	   5632	  17863	 508389	  7c1e5	fileio.exe
 350548	   8864	  33312	 392724	  5fe14	pppd.exe
 159138	   2176	   7819	 169133	  294ad	capture.exe
  84791	   1640	   5001	  91432	  16528	nsecs.exe
 157655	   1920	   5488	 165063	  284c7	paranoia.exe
 149416	   1936	   5801	 157153	  265e1	cdtest.exe
  66349	   1548	   4892	  72789	  11c55	base_sp.exe
  69669	   1576	   8736	  79981	  1386d	unlimited.exe
  80928	   1520	   4896	  87344	  15530	hello.exe
 208424	   2800	  12080	 223304	  36848	loopback.exe

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

   text	   data	    bss	    	  dec	    	  hex	filename
  76940	   6456	   4944	  88340	  15914	ticker.exe
  21896	   1860	    760	  24516	   5fc4	minimum.exe
 802270	  45832	  12837	 860939	  d230b	cxx_iostream.exe
 473916	  65152	  18156	 557224	  880a8	fileio.exe
 384288	  45724	  34148	 464160	  71520	pppd.exe
 161648	  18416	   7840	 187904	  2de00	capture.exe
  90856	   6740	   5021	 102617	  190d9	nsecs.exe
 158424	  17512	   5508	 181444	  2c4c4	paranoia.exe
 152938	  12948	   5821	 171707	  29ebb	cdtest.exe
  73808	   6296	   4912	  85016	  14c18	base_sp.exe
  77420	   6528	   8756	  92704	  16a20	unlimited.exe
  89692	   4792	   4916	  99400	  18448	hello.exe
 236138	  18396	  12240	 266774	  41216	loopback.exe

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

   text	   data	    bss	    	  dec	    	  hex	filename
  76739	   1552	   4920	  83211	  1450b	ticker.exe
  13682	    228	    748	  14658	   3942	minimum.exe
 491284	   6508	  12026	 509818	  7c77a	cxx_iostream.exe
 517952	   5632	  17859	 541443	  84303	fileio.exe
 379732	   8864	  33308	 421904	  67010	pppd.exe
 169182	   2176	   7815	 179173	  2bbe5	capture.exe
  91307	   1640	   4997	  97944	  17e98	nsecs.exe
 167431	   1920	   5484	 174835	  2aaf3	paranoia.exe
 156322	   1936	   5797	 164055	  280d7	cdtest.exe
  72591	   1548	   4888	  79027	  134b3	base_sp.exe
  76215	   1576	   8732	  86523	  151fb	unlimited.exe
  86346	   1520	   4892	  92758	  16a56	hello.exe
 221810	   2800	  12076	 236686	  39c8e	loopback.exe

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

   text	   data	    bss	    	  dec	    	  hex	filename
  79246	   6456	   4944	  90646	  16216	ticker.exe
  22440	   1860	    760	  25060	   61e4	minimum.exe
 874792	  46172	  12837	 933801	  e3fa9	cxx_iostream.exe
 484218	  65164	  18156	 567538	  8a8f2	fileio.exe
 396364	  45736	  34148	 476248	  74458	pppd.exe
 167214	  18416	   7840	 193470	  2f3be	capture.exe
  95154	   6744	   5021	 106919	  1a1a7	nsecs.exe
 162778	  17512	   5508	 185798	  2d5c6	paranoia.exe
 161270	  12984	   5821	 180075	  2bf6b	cdtest.exe
  76114	   6296	   4912	  87322	  1551a	base_sp.exe
  79726	   6528	   8756	  95010	  17322	unlimited.exe
  93578	   4792	   4916	 103286	  19376	hello.exe
 242848	  18396	  12240	 273484	  42c4c	loopback.exe

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

   text	   data	    bss	    	  dec	    	  hex	filename
  79045	   1552	   4920	  85517	  14e0d	ticker.exe
  13674	    228	    748	  14650	   393a	minimum.exe
 526914	   6508	  12026	 545448	  852a8	cxx_iostream.exe
 528264	   5632	  17859	 551755	  86b4b	fileio.exe
 391652	   8864	  33308	 433824	  69ea0	pppd.exe
 174748	   2176	   7815	 184739	  2d1a3	capture.exe
  95605	   1640	   4997	 102242	  18f62	nsecs.exe
 171785	   1920	   5484	 179189	  2bbf5	paranoia.exe
 164414	   1936	   5797	 172147	  2a073	cdtest.exe
  74897	   1548	   4888	  81333	  13db5	base_sp.exe
  78521	   1576	   8732	  88829	  15afd	unlimited.exe
  90232	   1520	   4892	  96644	  17984	hello.exe
 228424	   2800	  12076	 243300	  3b664	loopback.exe

---

 c/src/lib/libbsp/v850/gdbv850sim/make/custom/v850sim.inc |  3 +++
 c/src/lib/libbsp/v850/gdbv850sim/startup/linkcmds        | 12 +++++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/c/src/lib/libbsp/v850/gdbv850sim/make/custom/v850sim.inc b/c/src/lib/libbsp/v850/gdbv850sim/make/custom/v850sim.inc
index 50de3fa..21eba79 100644
--- a/c/src/lib/libbsp/v850/gdbv850sim/make/custom/v850sim.inc
+++ b/c/src/lib/libbsp/v850/gdbv850sim/make/custom/v850sim.inc
@@ -10,3 +10,6 @@ RTEMS_CPU_MODEL=v850
 
 # 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/v850/gdbv850sim/startup/linkcmds b/c/src/lib/libbsp/v850/gdbv850sim/startup/linkcmds
index fcffb95..fe0390d 100644
--- a/c/src/lib/libbsp/v850/gdbv850sim/startup/linkcmds
+++ b/c/src/lib/libbsp/v850/gdbv850sim/startup/linkcmds
@@ -89,8 +89,18 @@ SECTIONS
     *(.call_table_text)
   }
   .fini		: { KEEP (*(.fini)) } =0
-  .rodata	: { *(.rodata .rodata.* .gnu.linkonce.r.*) KEEP (*(SORT(.rtemsroset.*))) }
+  .rodata	: { *(.rodata .rodata.* .gnu.linkonce.r.*) }
   .rodata1	: { *(.rodata1) }
+  .rtemsroset : {
+    /* for pre rtems-libbsd FreeBSD code */
+    ___start_set_sysctl_set = .;
+    *(set_sysctl_*);
+    ___stop_set_sysctl_set = .;
+    *(set_domain_*);
+    *(set_pseudo_*);
+
+    KEEP (*(SORT(.rtemsroset.*)))
+  } =0xff
   .tdata : {
     __TLS_Data_begin = .;
     *(.tdata .tdata.* .gnu.linkonce.td.*)




More information about the vc mailing list