[rtems commit] nios2/nios2_iss: 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:    1909efdb58d5c20e5e2f9be94147ce40e34c9b66
Changeset: http://git.rtems.org/rtems/commit/?id=1909efdb58d5c20e5e2f9be94147ce40e34c9b66

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

nios2/nios2_iss: Add per-section compilation and linking support

updates #2577.

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

   text	   data	    bss	    	  dec	    	  hex	filename
 198692	   6672	   6068	 211432	  339e8	ticker.exe
  75408	   1924	   1892	  79224	  13578	minimum.exe
1044536	  36308	  14032	1094876	 10b4dc	cxx_iostream.exe
 877164	  68972	  19300	 965436	  ebb3c	fileio.exe
 703628	  48772	  37196	 789596	  c0c5c	pppd.exe
 336340	  19532	   8972	 364844	  5912c	capture.exe
 216196	   6912	   6148	 229256	  37f88	nsecs.exe
 319236	  18048	   6632	 343916	  53f6c	paranoia.exe
 317556	  12944	   7020	 337520	  52670	cdtest.exe
 192980	   6476	   6036	 205492	  322b4	base_sp.exe
 198068	   6680	   9876	 214624	  34660	unlimited.exe
 206628	   4856	   6036	 217520	  351b0	hello.exe
 459304	  19208	  13368	 491880	  78168	loopback.exe

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

   text	   data	    bss	    	  dec	    	  hex	filename
 187044	   6560	   6048	 199652	  30be4	ticker.exe
  50944	    828	   1880	  53652	   d194	minimum.exe
 731956	  27876	  13228	 773060	  bcbc4	cxx_iostream.exe
 848108	  67272	  19020	 934400	  e4200	fileio.exe
 645152	  47968	  36464	 729584	  b21f0	pppd.exe
 315092	  18792	   8952	 342836	  53b34	capture.exe
 205588	   6780	   6128	 218496	  35580	nsecs.exe
 305684	  17916	   6612	 330212	  509e4	paranoia.exe
 305360	  11476	   7000	 323836	  4f0fc	cdtest.exe
 179428	   6364	   6016	 191808	  2ed40	base_sp.exe
 182036	   6548	   9856	 198440	  30728	unlimited.exe
 189908	   4708	   6016	 200632	  30fb8	hello.exe
 421696	  18772	  13280	 453748	  6ec74	loopback.exe

---

 c/src/lib/libbsp/nios2/nios2_iss/make/custom/nios2_iss.cfg | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/c/src/lib/libbsp/nios2/nios2_iss/make/custom/nios2_iss.cfg b/c/src/lib/libbsp/nios2/nios2_iss/make/custom/nios2_iss.cfg
index 8254eec..2bec4b1 100644
--- a/c/src/lib/libbsp/nios2/nios2_iss/make/custom/nios2_iss.cfg
+++ b/c/src/lib/libbsp/nios2/nios2_iss/make/custom/nios2_iss.cfg
@@ -19,6 +19,9 @@ CPU_CFLAGS = -mno-hw-mul -mno-hw-div
 # optimize flag: typically -O2
 # ATM, doesn't work with optimization levels > 0
 CFLAGS_OPTIMIZE_V = -O0 -g
+CFLAGS_OPTIMIZE_V += -ffunction-sections -fdata-sections
+
+LDFLAGS = -Wl,--gc-sections
 
 define bsp-post-link
 	$(OBJCOPY) -O binary --strip-all $(basename $@)$(EXEEXT) \



More information about the vc mailing list