[PATCH 29/32] powerpc/motorola_powerpc: Add per-section compilation and linking support

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


updates #2577.

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

   text	   data	    bss	    	  dec	    	  hex	filename
 188997	  29656	  48361	 267014	  41306	ticker.exe
 150693	  26116	  44681	 221490	  36132	minimum.exe
 939941	 217971	  55585	1213497	 128439	cxx_iostream.exe
 585125	  98042	  61033	 744200	  b5b08	fileio.exe
 506445	  72164	  76829	 655438	  a004e	pppd.exe
 253397	  40224	  50409	 344030	  53fde	capture.exe
 208597	  31236	  48437	 288270	  4660e	nsecs.exe
 218981	  42028	  48961	 309970	  4bad2	paranoia.exe
 275605	  47856	  48585	 372046	  5ad4e	cdtest.exe
 186309	  29488	  48329	 264126	  407be	base_sp.exe
 188517	  30424	  52105	 271046	  422c6	unlimited.exe
 174725	  28324	  48257	 251306	  3d5aa	hello.exe
 342601	  41628	  55433	 439662	  6b56e	loopback.exe

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

   text	   data	    bss	    	  dec	    	  hex	filename
 159345	  19612	  48329	 227286	  377d6	ticker.exe
 120417	  15516	  44649	 180582	  2c166	minimum.exe
 596905	  50686	  54737	 702328	  ab778	cxx_iostream.exe
 551185	  88466	  60745	 700396	  aafec	fileio.exe
 453101	  61848	  76093	 591042	  904c2	pppd.exe
 228033	  32444	  50381	 310858	  4be4a	capture.exe
 179585	  21168	  48405	 249158	  3cd46	nsecs.exe
 188785	  31176	  48933	 268894	  41a5e	paranoia.exe
 249561	  28688	  48553	 326802	  4fc92	cdtest.exe
 156401	  19444	  48297	 224142	  36b8e	base_sp.exe
 156977	  19592	  52073	 228642	  37d22	unlimited.exe
 142929	  17544	  48225	 208698	  32f3a	hello.exe
 302045	  33328	  55321	 390694	  5f626	loopback.exe

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

   text	   data	    bss	    	  dec	    	  hex	filename
 189317	  29640	  48361	 267318	  41436	ticker.exe
 150997	  26104	  44681	 221782	  36256	minimum.exe
 940581	 214151	  55585	1210317	 1277cd	cxx_iostream.exe
 585317	  98026	  61033	 744376	  b5bb8	fileio.exe
 506893	  72148	  76829	 655870	  a01fe	pppd.exe
 253813	  40208	  50409	 344430	  5416e	capture.exe
 208917	  31220	  48437	 288574	  4673e	nsecs.exe
 219301	  42012	  48961	 310274	  4bc02	paranoia.exe
 276021	  47700	  48585	 372306	  5ae52	cdtest.exe
 186629	  29472	  48329	 264430	  408ee	base_sp.exe
 188837	  30408	  52105	 271350	  423f6	unlimited.exe
 175045	  28312	  48257	 251614	  3d6de	hello.exe
 342953	  41612	  55433	 439998	  6b6be	loopback.exe

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

   text	   data	    bss	    	  dec	    	  hex	filename
 159345	  19612	  48329	 227286	  377d6	ticker.exe
 120385	  15516	  44649	 180550	  2c146	minimum.exe
 597097	  50686	  54737	 702520	  ab838	cxx_iostream.exe
 551121	  88466	  60745	 700332	  aafac	fileio.exe
 453197	  61848	  76093	 591138	  90522	pppd.exe
 228097	  32444	  50381	 310922	  4be8a	capture.exe
 179569	  21168	  48405	 249142	  3cd36	nsecs.exe
 188785	  31176	  48933	 268894	  41a5e	paranoia.exe
 249625	  28688	  48553	 326866	  4fcd2	cdtest.exe
 156369	  19444	  48297	 224110	  36b6e	base_sp.exe
 156945	  19592	  52073	 228610	  37d02	unlimited.exe
 142929	  17544	  48225	 208698	  32f3a	hello.exe
 302109	  33328	  55321	 390758	  5f666	loopback.exe

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

   text	   data	    bss	    	  dec	    	  hex	filename
 185285	  24424	  48361	 258070	  3f016	ticker.exe
 146997	  20880	  44681	 212558	  33e4e	minimum.exe
 936549	 208935	  55585	1201069	 1253ad	cxx_iostream.exe
 581285	  92810	  61033	 735128	  b3798	fileio.exe
 502861	  66932	  76829	 646622	  9ddde	pppd.exe
 249781	  34984	  50409	 335174	  51d46	capture.exe
 204917	  26004	  48437	 279358	  4433e	nsecs.exe
 215269	  36788	  48961	 301018	  497da	paranoia.exe
 271989	  42484	  48585	 363058	  58a32	cdtest.exe
 182597	  24256	  48329	 255182	  3e4ce	base_sp.exe
 184805	  25192	  52105	 262102	  3ffd6	unlimited.exe
 171045	  23088	  48257	 242390	  3b2d6	hello.exe
 338953	  36388	  55433	 430774	  692b6	loopback.exe

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

   text	   data	    bss	    	  dec	    	  hex	filename
 154449	  18328	  48329	 221106	  35fb2	ticker.exe
 115521	  14232	  44649	 174402	  2a942	minimum.exe
 592201	  49402	  54737	 696340	  aa014	cxx_iostream.exe
 546225	  87182	  60745	 694152	  a9788	fileio.exe
 448301	  60564	  76093	 584958	  8ecfe	pppd.exe
 223201	  31160	  50349	 304710	  4a646	capture.exe
 174673	  19884	  48405	 242962	  3b512	nsecs.exe
 183889	  29892	  48933	 262714	  4023a	paranoia.exe
 244729	  27404	  48553	 320686	  4e4ae	cdtest.exe
 151473	  18160	  48297	 217930	  3534a	base_sp.exe
 152049	  18308	  52073	 222430	  364de	unlimited.exe
 138033	  16260	  48225	 202518	  31716	hello.exe
 297213	  32044	  55321	 384578	  5de42	loopback.exe

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

   text	   data	    bss	    	  dec	    	  hex	filename
 189781	  29656	  48361	 267798	  41616	ticker.exe
 151221	  26124	  44681	 222026	  3634a	minimum.exe
 941701	 214035	  55585	1211321	 127bb9	cxx_iostream.exe
 586821	  98050	  61033	 745904	  b61b0	fileio.exe
 509309	  72164	  76829	 658302	  a0b7e	pppd.exe
 254341	  40232	  50409	 344982	  54396	capture.exe
 209493	  31236	  48437	 289166	  4698e	nsecs.exe
 219765	  42036	  48961	 310762	  4bdea	paranoia.exe
 276869	  47700	  48585	 373154	  5b1a2	cdtest.exe
 187061	  29488	  48329	 264878	  40aae	base_sp.exe
 189269	  30432	  52105	 271806	  425be	unlimited.exe
 175477	  28324	  48257	 252058	  3d89a	hello.exe
 343593	  41628	  55433	 440654	  6b94e	loopback.exe

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

   text	   data	    bss	    	  dec	    	  hex	filename
 159921	  19612	  48329	 227862	  37a16	ticker.exe
 120801	  15516	  44649	 180966	  2c2e6	minimum.exe
 598393	  50694	  54737	 703824	  abd50	cxx_iostream.exe
 552721	  88466	  60745	 701932	  ab5ec	fileio.exe
 455709	  61848	  76093	 593650	  90ef2	pppd.exe
 228817	  32444	  50381	 311642	  4c15a	capture.exe
 180257	  21176	  48405	 249838	  3cfee	nsecs.exe
 189361	  31184	  48933	 269478	  41ca6	paranoia.exe
 250665	  28688	  48553	 327906	  500e2	cdtest.exe
 156945	  19444	  48297	 224686	  36dae	base_sp.exe
 157521	  19592	  52073	 229186	  37f42	unlimited.exe
 143473	  17552	  48225	 209250	  33162	hello.exe
 302877	  33328	  55321	 391526	  5f966	loopback.exe

For the qemuprep-altivec BSP variant without this option sample
executables sizes were as follows:

   text	   data	    bss	    	  dec	    	  hex	filename
 188533	  25288	  47629	 261450	  3fd4a	ticker.exe
 150149	  21740	  43981	 215870	  34b3e	minimum.exe
 940373	 213899	  54853	1209125	 127325	cxx_iostream.exe
 585013	  93674	  60333	 739020	  b46cc	fileio.exe
 506173	  67796	  76129	 650098	  9eb72	pppd.exe
 252965	  35848	  49677	 338490	  52a3a	capture.exe
 208133	  26868	  47705	 282706	  45052	nsecs.exe
 218517	  37652	  48261	 304430	  4a52e	paranoia.exe
 276165	  43792	  47853	 367810	  59cc2	cdtest.exe
 185845	  25120	  47597	 258562	  3f202	base_sp.exe
 188053	  26056	  51373	 265482	  40d0a	unlimited.exe
 174261	  23948	  47525	 245734	  3bfe6	hello.exe
 342233	  37252	  54701	 434186	  6a00a	loopback.exe

For the qemuprep-altivec BSP variant with this option sample
executables sizes were as follows:

   text	   data	    bss	    	  dec	    	  hex	filename
 161089	  21244	  47597	 229930	  3822a	ticker.exe
 122225	  17908	  43917	 184050	  2cef2	minimum.exe
 595689	  50718	  54005	 700412	  aaffc	cxx_iostream.exe
 548433	  87634	  60009	 696076	  a9f0c	fileio.exe
 450029	  61016	  75357	 586402	  8f2a2	pppd.exe
 224961	  31612	  49645	 306218	  4ac2a	capture.exe
 181329	  22808	  47673	 251810	  3d7a2	nsecs.exe
 190561	  33576	  48201	 272338	  427d2	paranoia.exe
 249593	  31072	  47821	 328486	  50326	cdtest.exe
 158145	  21076	  47565	 226786	  375e2	base_sp.exe
 158753	  21984	  51341	 232078	  38a8e	unlimited.exe
 144705	  19944	  47493	 212142	  33cae	hello.exe
 298941	  32496	  54585	 386022	  5e3e6	loopback.exe

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

   text	   data	    bss	    	  dec	    	  hex	filename
 186453	  24912	  47621	 258986	  3f3aa	ticker.exe
 147829	  21372	  43973	 213174	  340b6	minimum.exe
 937413	 213207	  54845	1205465	 1264d9	cxx_iostream.exe
 583237	  93306	  60325	 736868	  b3e64	fileio.exe
 505885	  67420	  76121	 649426	  9e8d2	pppd.exe
 250949	  35480	  49669	 336098	  520e2	capture.exe
 206037	  26492	  47697	 280226	  446a2	nsecs.exe
 216469	  37284	  48253	 302006	  49bb6	paranoia.exe
 273061	  43104	  47845	 364010	  58dea	cdtest.exe
 183733	  24744	  47589	 256066	  3e842	base_sp.exe
 185941	  25688	  51365	 262994	  40352	unlimited.exe
 172149	  23572	  47517	 243238	  3b626	hello.exe
 340201	  36876	  54693	 431770	  6969a	loopback.exe

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

   text	   data	    bss	    	  dec	    	  hex	filename
 153841	  18412	  47585	 219838	  35abe	ticker.exe
 114625	  14308	  43905	 172838	  2a326	minimum.exe
 591417	  49486	  53993	 694896	  a9a70	cxx_iostream.exe
 546353	  87266	  60001	 693620	  a9574	fileio.exe
 449469	  60648	  75349	 585466	  8eefa	pppd.exe
 222641	  31244	  49637	 303522	  4a1a2	capture.exe
 174049	  19968	  47661	 241678	  3b00e	nsecs.exe
 183313	  29976	  48189	 261478	  3fd66	paranoia.exe
 244073	  27488	  47809	 319370	  4df8a	cdtest.exe
 150865	  18244	  47553	 216662	  34e56	base_sp.exe
 151409	  18384	  51329	 221122	  35fc2	unlimited.exe
 137361	  16344	  47481	 201186	  311e2	hello.exe
 296733	  32128	  54577	 383438	  5d9ce	loopback.exe
---
 c/src/lib/libbsp/powerpc/motorola_powerpc/make/custom/mcp750.cfg   | 5 ++++-
 c/src/lib/libbsp/powerpc/motorola_powerpc/make/custom/mtx603e.cfg  | 5 ++++-
 c/src/lib/libbsp/powerpc/motorola_powerpc/make/custom/mvme2100.cfg | 5 ++++-
 c/src/lib/libbsp/powerpc/motorola_powerpc/make/custom/mvme2307.cfg | 7 +++++--
 .../powerpc/motorola_powerpc/make/custom/qemuprep-altivec.cfg      | 5 ++++-
 c/src/lib/libbsp/powerpc/motorola_powerpc/make/custom/qemuprep.cfg | 5 ++++-
 6 files changed, 25 insertions(+), 7 deletions(-)

diff --git a/c/src/lib/libbsp/powerpc/motorola_powerpc/make/custom/mcp750.cfg b/c/src/lib/libbsp/powerpc/motorola_powerpc/make/custom/mcp750.cfg
index 8ff97b3..98e8fd9 100644
--- a/c/src/lib/libbsp/powerpc/motorola_powerpc/make/custom/mcp750.cfg
+++ b/c/src/lib/libbsp/powerpc/motorola_powerpc/make/custom/mcp750.cfg
@@ -8,12 +8,15 @@ RTEMS_CPU=powerpc
 RTEMS_CPU_MODEL=mpc750
 
 #  This contains the compiler options necessary to select the CPU model
-#  and (hopefully) optimize for it. 
+#  and (hopefully) optimize for it.
 #
 CPU_CFLAGS = -mcpu=750 -Dmpc750
 
 # optimize flag: typically -O2
 CFLAGS_OPTIMIZE_V = -O2 -g -mmultiple -mstring -mstrict-align
+CFLAGS_OPTIMIZE_V += -ffunction-sections -fdata-sections
+
+LDFLAGS = -Wl,--gc-sections
 
 define bsp-post-link
 	$(default-bsp-post-link)
diff --git a/c/src/lib/libbsp/powerpc/motorola_powerpc/make/custom/mtx603e.cfg b/c/src/lib/libbsp/powerpc/motorola_powerpc/make/custom/mtx603e.cfg
index 6c7f597..aa91b05 100644
--- a/c/src/lib/libbsp/powerpc/motorola_powerpc/make/custom/mtx603e.cfg
+++ b/c/src/lib/libbsp/powerpc/motorola_powerpc/make/custom/mtx603e.cfg
@@ -8,11 +8,14 @@ RTEMS_CPU=powerpc
 RTEMS_CPU_MODEL=mpc6xx
 
 #  This contains the compiler options necessary to select the CPU model
-#  and (hopefully) optimize for it. 
+#  and (hopefully) optimize for it.
 CPU_CFLAGS = -mcpu=603e -Dppc603e
 
 # optimize flag: typically -O2
 CFLAGS_OPTIMIZE_V = -O2 -g -mmultiple -mstring -mstrict-align
+CFLAGS_OPTIMIZE_V += -ffunction-sections -fdata-sections
+
+LDFLAGS = -Wl,--gc-sections
 
 define bsp-post-link
 	$(default-bsp-post-link)
diff --git a/c/src/lib/libbsp/powerpc/motorola_powerpc/make/custom/mvme2100.cfg b/c/src/lib/libbsp/powerpc/motorola_powerpc/make/custom/mvme2100.cfg
index d724b5d..dadb275 100644
--- a/c/src/lib/libbsp/powerpc/motorola_powerpc/make/custom/mvme2100.cfg
+++ b/c/src/lib/libbsp/powerpc/motorola_powerpc/make/custom/mvme2100.cfg
@@ -8,11 +8,14 @@ RTEMS_CPU=powerpc
 RTEMS_CPU_MODEL=mpc8240
 
 #  This contains the compiler options necessary to select the CPU model
-#  and (hopefully) optimize for it. 
+#  and (hopefully) optimize for it.
 CPU_CFLAGS = -mcpu=603e -Dppc603e
 
 # optimize flag: typically -O2
 CFLAGS_OPTIMIZE_V = -O2 -g -mmultiple -mstring -mstrict-align
+CFLAGS_OPTIMIZE_V += -ffunction-sections -fdata-sections
+
+LDFLAGS = -Wl,--gc-sections
 
 define bsp-post-link
 	$(default-bsp-post-link)
diff --git a/c/src/lib/libbsp/powerpc/motorola_powerpc/make/custom/mvme2307.cfg b/c/src/lib/libbsp/powerpc/motorola_powerpc/make/custom/mvme2307.cfg
index ee00561..cf2ab28 100644
--- a/c/src/lib/libbsp/powerpc/motorola_powerpc/make/custom/mvme2307.cfg
+++ b/c/src/lib/libbsp/powerpc/motorola_powerpc/make/custom/mvme2307.cfg
@@ -8,12 +8,15 @@ RTEMS_CPU=powerpc
 RTEMS_CPU_MODEL=mpc604
 
 #  This contains the compiler options necessary to select the CPU model
-#  and (hopefully) optimize for it. 
+#  and (hopefully) optimize for it.
 #
-CPU_CFLAGS = -mcpu=604 -mmultiple -mstring -mstrict-align -meabi 
+CPU_CFLAGS = -mcpu=604 -mmultiple -mstring -mstrict-align -meabi
 
 # optimize flag: typically -O2
 CFLAGS_OPTIMIZE_V = -O2 -g
+CFLAGS_OPTIMIZE_V += -ffunction-sections -fdata-sections
+
+LDFLAGS = -Wl,--gc-sections
 
 define bsp-post-link
 	$(default-bsp-post-link)
diff --git a/c/src/lib/libbsp/powerpc/motorola_powerpc/make/custom/qemuprep-altivec.cfg b/c/src/lib/libbsp/powerpc/motorola_powerpc/make/custom/qemuprep-altivec.cfg
index 1dd1744..87fbb25 100644
--- a/c/src/lib/libbsp/powerpc/motorola_powerpc/make/custom/qemuprep-altivec.cfg
+++ b/c/src/lib/libbsp/powerpc/motorola_powerpc/make/custom/qemuprep-altivec.cfg
@@ -8,12 +8,15 @@ RTEMS_CPU=powerpc
 RTEMS_CPU_MODEL=mpc7400
 
 #  This contains the compiler options necessary to select the CPU model
-#  and (hopefully) optimize for it. 
+#  and (hopefully) optimize for it.
 #
 CPU_CFLAGS = -mcpu=7400 -mmultiple -mstring -mstrict-align -D__ppc_generic
 
 # optimize flag: typically -O2
 CFLAGS_OPTIMIZE_V = -O2 -g
+CFLAGS_OPTIMIZE_V += -ffunction-sections -fdata-sections
+
+LDFLAGS = -Wl,--gc-sections
 
 ifdef PURE_BINARY
 define bsp-post-link
diff --git a/c/src/lib/libbsp/powerpc/motorola_powerpc/make/custom/qemuprep.cfg b/c/src/lib/libbsp/powerpc/motorola_powerpc/make/custom/qemuprep.cfg
index e5f11fc..36df4af 100644
--- a/c/src/lib/libbsp/powerpc/motorola_powerpc/make/custom/qemuprep.cfg
+++ b/c/src/lib/libbsp/powerpc/motorola_powerpc/make/custom/qemuprep.cfg
@@ -8,12 +8,15 @@ RTEMS_CPU=powerpc
 RTEMS_CPU_MODEL=mpc604
 
 #  This contains the compiler options necessary to select the CPU model
-#  and (hopefully) optimize for it. 
+#  and (hopefully) optimize for it.
 #
 CPU_CFLAGS = -mcpu=powerpc -mmultiple -mstring -mstrict-align -D__ppc_generic
 
 # optimize flag: typically -O2
 CFLAGS_OPTIMIZE_V = -O2 -g
+CFLAGS_OPTIMIZE_V += -ffunction-sections -fdata-sections
+
+LDFLAGS = -Wl,--gc-sections
 
 ifdef PURE_BINARY
 define bsp-post-link
-- 
1.8.3.1




More information about the devel mailing list