[rtems commit] gensh1: Correct linking for C++

Joel Sherrill joel at rtems.org
Tue Apr 22 20:04:24 UTC 2014


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

Author:    Joel Sherrill <joel.sherrill at oarcorp.com>
Date:      Tue Apr 22 13:07:44 2014 -0500

gensh1: Correct linking for C++

---

 c/src/lib/libbsp/sh/gensh1/bsp_specs        |    6 ++++--
 c/src/lib/libbsp/sh/gensh1/startup/linkcmds |   18 ++++--------------
 2 files changed, 8 insertions(+), 16 deletions(-)

diff --git a/c/src/lib/libbsp/sh/gensh1/bsp_specs b/c/src/lib/libbsp/sh/gensh1/bsp_specs
index 34d002b..975c0b2 100644
--- a/c/src/lib/libbsp/sh/gensh1/bsp_specs
+++ b/c/src/lib/libbsp/sh/gensh1/bsp_specs
@@ -4,8 +4,10 @@
 
 *startfile:
 %{!qrtems: %(old_startfile)} \
-%{!nostdlib: %{qrtems: start.o%s -e _start}}
+%{!nostdlib: %{qrtems: start.o%s crti.o%s crtbegin.o%s -e _start}}
 
 *link:
-%(old_link) %{qrtems: -dc -dp -N}
+%{!qrtems: %(old_link)} %{qrtems: -dc -dp -N}
 
+*endfile:
+%{!qrtems: %(old_endfile)} %{qrtems: crtend.o%s crtn.o%s}
diff --git a/c/src/lib/libbsp/sh/gensh1/startup/linkcmds b/c/src/lib/libbsp/sh/gensh1/startup/linkcmds
index 62e5584..80a241c 100644
--- a/c/src/lib/libbsp/sh/gensh1/startup/linkcmds
+++ b/c/src/lib/libbsp/sh/gensh1/startup/linkcmds
@@ -102,7 +102,6 @@ SECTIONS
   .rel.fini      : { *(.rel.fini)	}
   .rel.bss       : { *(.rel.bss)		}
   .rel.plt       : { *(.rel.plt)		}
-  .init          : { *(.init)	} =0
   .plt      	 : { *(.plt)	}
   .text   .   	 :
   {
@@ -128,7 +127,10 @@ SECTIONS
   } > ram
   _etext = .;
   PROVIDE (etext = .);
-  .fini    .  : { *(.fini)    } > ram =0
+  .init    .  : { KEEP(*(.init))    } > ram =0
+  .fini    .  : { KEEP(*(.fini))    } > ram =0
+  .ctors   .  : { KEEP(*(.ctors))    } > ram =0
+  .dtors   .  : { KEEP(*(.dtors))    } > ram =0
   .rodata  .  : { *(.rodata*) *(.gnu.linkonce.r*) } > ram
   .rodata1 .  : { *(.rodata1) } > ram
   .tdata : {
@@ -163,18 +165,6 @@ SECTIONS
     CONSTRUCTORS
   } > ram
   .data1  . : { *(.data1) }
-  .ctors  .       :
-  {
-    ___ctors = .;
-    *(.ctors)
-    ___ctors_end = .;
-  }
-  .dtors  .       :
-  {
-    ___dtors = .;
-    *(.dtors)
-    ___dtors_end = .;
-  }
   .got     .      : { *(.got.plt) *(.got) }
   .dynamic .      : { *(.dynamic) }
   /* We want the small data sections together, so single-instruction offsets




More information about the vc mailing list