[rtems commit] sparc all BSPs: Use function and data sections

Joel Sherrill joel at rtems.org
Fri Oct 25 14:41:16 UTC 2013


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

Author:    Joel Sherrill <joel.sherrill at oarcorp.com>
Date:      Thu Oct 24 18:37:17 2013 -0500

sparc all BSPs: Use function and data sections

This reduces the size of the RTEMS tests on average about 45%.

---

 c/src/lib/libbsp/sparc/erc32/make/custom/erc32.cfg |    3 +++
 c/src/lib/libbsp/sparc/leon2/make/custom/leon2.cfg |    3 +++
 c/src/lib/libbsp/sparc/leon3/make/custom/leon3.cfg |    3 +++
 .../lib/libbsp/sparc/shared/startup/linkcmds.base  |   17 +++++++++--------
 4 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/c/src/lib/libbsp/sparc/erc32/make/custom/erc32.cfg b/c/src/lib/libbsp/sparc/erc32/make/custom/erc32.cfg
index 3879d3d..2859372 100644
--- a/c/src/lib/libbsp/sparc/erc32/make/custom/erc32.cfg
+++ b/c/src/lib/libbsp/sparc/erc32/make/custom/erc32.cfg
@@ -13,3 +13,6 @@ CPU_CFLAGS = -mcpu=cypress
 
 # 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/sparc/leon2/make/custom/leon2.cfg b/c/src/lib/libbsp/sparc/leon2/make/custom/leon2.cfg
index de5a826..af1cb1b 100644
--- a/c/src/lib/libbsp/sparc/leon2/make/custom/leon2.cfg
+++ b/c/src/lib/libbsp/sparc/leon2/make/custom/leon2.cfg
@@ -13,3 +13,6 @@ CPU_CFLAGS = -mcpu=cypress -msoft-float
 
 # 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/sparc/leon3/make/custom/leon3.cfg b/c/src/lib/libbsp/sparc/leon3/make/custom/leon3.cfg
index ee053e0..58f2f07 100644
--- a/c/src/lib/libbsp/sparc/leon3/make/custom/leon3.cfg
+++ b/c/src/lib/libbsp/sparc/leon3/make/custom/leon3.cfg
@@ -13,3 +13,6 @@ CPU_CFLAGS = -mcpu=cypress -msoft-float
 
 # 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/sparc/shared/startup/linkcmds.base b/c/src/lib/libbsp/sparc/shared/startup/linkcmds.base
index e61a554..fd91085 100644
--- a/c/src/lib/libbsp/sparc/shared/startup/linkcmds.base
+++ b/c/src/lib/libbsp/sparc/shared/startup/linkcmds.base
@@ -3,6 +3,7 @@
 
 OUTPUT_ARCH(sparc)
 __DYNAMIC  =  0;
+ENTRY(start)
 
 /*
  * The memory map looks like this:
@@ -101,8 +102,8 @@ SECTIONS
 
     etext = ALIGN(0x10);
     _etext = .;
-    *(.init)
-    *(.fini)
+    KEEP(*(.init))
+    KEEP(*(.fini))
     *(.lit)
     *(.shdata)
     . = ALIGN (16);
@@ -110,22 +111,22 @@ SECTIONS
   .robsdsets : {
     /* for pre rtems-libbsd FreeBSD code */
     __start_set_sysctl_set = .;
-    *(set_sysctl_*);
+    KEEP(*(set_sysctl_*));
     __stop_set_sysctl_set = .;
-    *(set_domain_*);
-    *(set_pseudo_*);
+    KEEP(*(set_domain_*));
+    KEEP(*(set_pseudo_*));
 
     /* for rtems-libbsd FreeBSD code */
     _bsd__start_set_modmetadata_set = .;
-    *(_bsd_set_modmetadata_set);
+    KEEP(*(_bsd_set_modmetadata_set));
     _bsd__stop_set_modmetadata_set = .;
 
     _bsd__start_set_sysctl_set = .;
-    *(_bsd_set_sysctl_set);
+    KEEP(*(_bsd_set_sysctl_set));
     _bsd__stop_set_sysctl_set = .;
 
     _bsd__start_set_sysinit_set = .;
-    *(_bsd_set_sysinit_*);
+    KEEP(*(_bsd_set_sysinit_*));
     _bsd__stop_set_sysinit_set = .;
 
     . = ALIGN (16);




More information about the vc mailing list