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

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


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

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

shsim: Correct linking for C++

---

 c/src/lib/libbsp/sh/shsim/bsp_specs        |    6 ++++--
 c/src/lib/libbsp/sh/shsim/startup/linkcmds |   23 +++++++++--------------
 2 files changed, 13 insertions(+), 16 deletions(-)

diff --git a/c/src/lib/libbsp/sh/shsim/bsp_specs b/c/src/lib/libbsp/sh/shsim/bsp_specs
index 34d002b..975c0b2 100644
--- a/c/src/lib/libbsp/sh/shsim/bsp_specs
+++ b/c/src/lib/libbsp/sh/shsim/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/shsim/startup/linkcmds b/c/src/lib/libbsp/sh/shsim/startup/linkcmds
index addeac4..3f7ea0e 100644
--- a/c/src/lib/libbsp/sh/shsim/startup/linkcmds
+++ b/c/src/lib/libbsp/sh/shsim/startup/linkcmds
@@ -99,7 +99,6 @@ SECTIONS
   .rel.fini      : { *(.rel.fini)	}
   .rel.bss       : { *(.rel.bss)		}
   .rel.plt       : { *(.rel.plt)		}
-  .init          : { *(.init)	} =0
   .plt      	 : { *(.plt)	}
   .text   .   	 :
   {
@@ -121,10 +120,14 @@ SECTIONS
     *(.gnu.warning)
     *(.gnu.linkonce.t*)
   } > ram
+  .init           :
+  {
+    KEEP (*(.init))
+  } >ram
   .fini           :
   {
     KEEP (*(.fini))
-  } =0
+  } >ram
   _etext = .;
   PROVIDE (etext = .);
   .rodata  .  : { *(.rodata*) .rodata.* *(.gnu.linkonce.r*) } > ram
@@ -139,6 +142,10 @@ SECTIONS
     *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon)
     __TLS_BSS_end = .;
   } > ram
+  .init    .  : { KEEP(*(.init))    } > ram =0
+  .fini    .  : { KEEP(*(.fini))    } > ram =0
+  .ctors   .  : { KEEP(*(.ctors))    } > ram =0
+  .dtors   .  : { KEEP(*(.dtors))    } > ram =0
   __TLS_Data_size = __TLS_Data_end - __TLS_Data_begin;
   __TLS_Data_begin = __TLS_Data_size != 0 ? __TLS_Data_begin : __TLS_BSS_begin;
   __TLS_Data_end = __TLS_Data_size != 0 ? __TLS_Data_end : __TLS_BSS_begin;
@@ -161,18 +168,6 @@ SECTIONS
     CONSTRUCTORS
   } > ram
   .data1  . : { *(.data1) }
-  .ctors  .       :
-  {
-    ___ctors = .;
-    *(.ctors)
-    ___ctors_end = .;
-  }
-  .dtors  .       :
-  {
-    ___dtors = .;
-    *(.dtors)
-    ___dtors_end = .;
-  }
   .rtemsroset : {
     /* for pre rtems-libbsd FreeBSD code */
     __start_set_sysctl_set = .;




More information about the vc mailing list