[rtems commit] arm/raspberrypi: Add per-section compilation and linking suppo

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


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

Author:    Joel Sherrill <joel at rtems.org>
Date:      Thu Mar 10 12:31:37 2016 -0600

arm/raspberrypi: Add per-section compilation and linking suppo

updates #2577.

For the raspberrypi BSP variant without this option, sample executable
sizes were as follows:

   text	   data	    bss	    	  dec	    	  hex	filename
  91516	   1724	134080496	134173736	7ff5428	ticker.exe
  57809	   1480	134114460	134173749	7ff5435	minimum.exe
 816524	   2004	133355216	134173744	7ff5430	cxx_iostream.exe
 561132	   5808	133606812	134173752	7ff5438	fileio.exe
 444724	  12624	133716388	134173736	7ff5428	pppd.exe
 193344	   2360	133978052	134173756	7ff543c	capture.exe
 109682	   1812	134062236	134173730	7ff5422	nsecs.exe
 175408	   2100	133996244	134173752	7ff5438	paranoia.exe
 187108	   1756	133984880	134173744	7ff5430	cdtest.exe
  88548	   1724	134083488	134173760	7ff5440	base_sp.exe
  91432	   1748	134080552	134173732	7ff5424	unlimited.exe
 103652	   1700	134068384	134173736	7ff5428	hello.exe
 271116	   6508	133896112	134173736	7ff5428	loopback.exe

For the raspberrypi BSP variant with this option, sample executable
sizes were as follows:

   text	   data	    bss	    	  dec	    	  hex	filename
  85796	   1700	134086236	134173732	7ff5424	ticker.exe
  34428	   1408	134137896	134173732	7ff5424	minimum.exe
 508720	   1972	133663044	134173736	7ff5428	cxx_iostream.exe
 544516	   5776	133623452	134173744	7ff5430	fileio.exe
 409916	  12452	133751380	134173748	7ff5434	pppd.exe
 184020	   2320	133987416	134173756	7ff543c	capture.exe
 104486	   1788	134067476	134173750	7ff5436	nsecs.exe
 168504	   2068	134003164	134173736	7ff5428	paranoia.exe
 178740	   1732	133993272	134173744	7ff5430	cdtest.exe
  81988	   1692	134090068	134173748	7ff5434	base_sp.exe
  82460	   1716	134089568	134173744	7ff5430	unlimited.exe
  94316	   1636	134077800	134173752	7ff5438	hello.exe
 249228	   6388	133918144	134173760	7ff5440	loopback.exe

---

 c/src/lib/libbsp/arm/raspberrypi/make/custom/raspberrypi.inc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/c/src/lib/libbsp/arm/raspberrypi/make/custom/raspberrypi.inc b/c/src/lib/libbsp/arm/raspberrypi/make/custom/raspberrypi.inc
index 3b4fb50..a8b6f26 100644
--- a/c/src/lib/libbsp/arm/raspberrypi/make/custom/raspberrypi.inc
+++ b/c/src/lib/libbsp/arm/raspberrypi/make/custom/raspberrypi.inc
@@ -7,6 +7,9 @@ include $(RTEMS_ROOT)/make/custom/default.cfg
 RTEMS_CPU = arm
 
 CFLAGS_OPTIMIZE_V ?= -O2 -g
+CFLAGS_OPTIMIZE_V += -ffunction-sections -fdata-sections
+
+LDFLAGS = -Wl,--gc-sections
 
 # This defines the operations performed on the linked executable.
 # is currently required.




More information about the vc mailing list