gensh4: Correct linking for C++

This commit is contained in:
Joel Sherrill
2014-04-22 13:08:14 -05:00
parent 851e64321b
commit 25c3208aef
2 changed files with 8 additions and 42 deletions

View File

@@ -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}

View File

@@ -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. */