From 3191b426817454f35b2e95bb9e91530c5f0545a4 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Tue, 22 Apr 2014 13:07:44 -0500 Subject: 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 34d002b88f..975c0b2b51 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 62e5584a3e..80a241c896 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 -- cgit v1.2.3