summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@oarcorp.com>2014-04-22 13:08:14 -0500
committerJoel Sherrill <joel.sherrill@oarcorp.com>2014-04-22 15:12:11 -0500
commit25c3208aef2de6df5de36ac62af22ded80d7690e (patch)
tree47fb96299ef4638e1ea3205895ed66d62b5c9e48
parentgensh2: Correct linking for C++ (diff)
downloadrtems-25c3208aef2de6df5de36ac62af22ded80d7690e.tar.bz2
gensh4: Correct linking for C++
-rw-r--r--c/src/lib/libbsp/sh/gensh4/bsp_specs6
-rw-r--r--c/src/lib/libbsp/sh/gensh4/startup/linkcmds44
2 files changed, 8 insertions, 42 deletions
diff --git a/c/src/lib/libbsp/sh/gensh4/bsp_specs b/c/src/lib/libbsp/sh/gensh4/bsp_specs
index 34d002b88f..975c0b2b51 100644
--- a/c/src/lib/libbsp/sh/gensh4/bsp_specs
+++ b/c/src/lib/libbsp/sh/gensh4/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/gensh4/startup/linkcmds b/c/src/lib/libbsp/sh/gensh4/startup/linkcmds
index e2e3a993a2..7ddb95d9db 100644
--- a/c/src/lib/libbsp/sh/gensh4/startup/linkcmds
+++ b/c/src/lib/libbsp/sh/gensh4/startup/linkcmds
@@ -40,10 +40,6 @@ MEMORY
SECTIONS
{
/* Read-only sections, merged into text segment: */
- .init :
- {
- KEEP (*(.init))
- } =0
.text :
{
_start = .;
@@ -83,10 +79,10 @@ SECTIONS
} >ram
_etext = .;
PROVIDE (etext = .);
- .fini :
- {
- KEEP (*(.fini))
- } =0
+ .init . : { KEEP(*(.init)) } > ram =0
+ .fini . : { KEEP(*(.fini)) } > ram =0
+ .ctors . : { KEEP(*(.ctors)) } > ram =0
+ .dtors . : { KEEP(*(.dtors)) } > ram =0
.rodata :
{
*(.rodata)
@@ -109,38 +105,6 @@ SECTIONS
__TLS_BSS_size = __TLS_BSS_end - __TLS_BSS_begin;
__TLS_Size = __TLS_BSS_end - __TLS_Data_begin;
__TLS_Alignment = MAX (ALIGNOF (.tdata), ALIGNOF (.tbss));
- .ctors :
- {
- ___ctors = .;
- /* gcc uses crtbegin.o to find the start of
- the constructors, so we make sure it is
- first. Because this is a wildcard, it
- doesn't matter if the user does not
- actually link against crtbegin.o; the
- linker won't look for a file to match a
- wildcard. The wildcard also means that it
- doesn't matter which directory crtbegin.o
- is in. */
- KEEP (*crtbegin.o(.ctors))
- /* We don't want to include the .ctor section from
- from the crtend.o file until after the sorted ctors.
- The .ctor section from the crtend file contains the
- end of ctors marker and it must be last */
- KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors))
- KEEP (*(SORT(.ctors.*)))
- KEEP (*(.ctors))
- ___ctors_end = .;
- } > ram
- .dtors :
- {
- ___dtors = .;
- KEEP (*crtbegin.o(.dtors))
- KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors))
- KEEP (*(SORT(.dtors.*)))
- KEEP (*(.dtors))
- ___dtors_end = .;
- copy_start_in_rom = .;
- } > ram
/* Adjust the address for the data segment. We want to adjust up to
the same address within the page on the next page up. */