From 851e64321b3b704f106556d5d34eb6e2d31fe504 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Tue, 22 Apr 2014 13:07:56 -0500 Subject: gensh2: Correct linking for C++ --- c/src/lib/libbsp/sh/gensh2/bsp_specs | 6 ++++-- c/src/lib/libbsp/sh/gensh2/startup/linkcmds | 18 ++++-------------- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/c/src/lib/libbsp/sh/gensh2/bsp_specs b/c/src/lib/libbsp/sh/gensh2/bsp_specs index 34d002b88f..975c0b2b51 100644 --- a/c/src/lib/libbsp/sh/gensh2/bsp_specs +++ b/c/src/lib/libbsp/sh/gensh2/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/gensh2/startup/linkcmds b/c/src/lib/libbsp/sh/gensh2/startup/linkcmds index ab7e31e5d0..e9f73f9397 100644 --- a/c/src/lib/libbsp/sh/gensh2/startup/linkcmds +++ b/c/src/lib/libbsp/sh/gensh2/startup/linkcmds @@ -115,7 +115,6 @@ SECTIONS .rel.fini : { *(.rel.fini) } .rel.bss : { *(.rel.bss) } .rel.plt : { *(.rel.plt) } - .init : { *(.init) } =0 .plt : { *(.plt) } .text . : { @@ -139,7 +138,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 : { @@ -174,18 +176,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 -- cgit v1.2.3