[BSP] fix GCC compiling issue when enable C++ support

This commit is contained in:
Bernard Xiong 2014-11-01 14:06:51 +08:00
parent 796c49347e
commit 38be10cf89
2 changed files with 23 additions and 2 deletions

View File

@ -33,7 +33,7 @@ if PLATFORM == 'gcc':
CXX = PREFIX + 'g++' CXX = PREFIX + 'g++'
AS = PREFIX + 'gcc' AS = PREFIX + 'gcc'
AR = PREFIX + 'ar' AR = PREFIX + 'ar'
LINK = PREFIX + 'gcc' LINK = PREFIX + 'g++'
TARGET_EXT = 'elf' TARGET_EXT = 'elf'
SIZE = PREFIX + 'size' SIZE = PREFIX + 'size'
OBJDUMP = PREFIX + 'objdump' OBJDUMP = PREFIX + 'objdump'

View File

@ -38,10 +38,25 @@ SECTIONS
__vsymtab_end = .; __vsymtab_end = .;
. = ALIGN(4); . = ALIGN(4);
PROVIDE(__ctors_start__ = .);
/* old GCC version uses .ctors */
KEEP(*(SORT(.ctors.*)))
KEEP(*(.ctors))
/* new GCC version uses .init_array */
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array))
PROVIDE(__ctors_end__ = .);
. = ALIGN(4); . = ALIGN(4);
_etext = .; _etext = .;
} > CODE = 0 } > CODE = 0
.ARM.extab :
{
*(.ARM.extab*)
} > CODE
/* The .ARM.exidx section is used for C++ exception handling. */
/* .ARM.exidx is sorted, so has to go in its own output section. */ /* .ARM.exidx is sorted, so has to go in its own output section. */
__exidx_start = .; __exidx_start = .;
.ARM.exidx : .ARM.exidx :
@ -57,6 +72,12 @@ SECTIONS
.data : AT (_sidata) .data : AT (_sidata)
{ {
. = ALIGN(4);
PROVIDE(__dtors_start__ = .);
KEEP(*(SORT(.dtors.*)))
KEEP(*(.dtors))
PROVIDE(__dtors_end__ = .);
. = ALIGN(4); . = ALIGN(4);
/* This is used by the startup in order to initialize the .data secion */ /* This is used by the startup in order to initialize the .data secion */
_sdata = . ; _sdata = . ;
@ -68,7 +89,7 @@ SECTIONS
. = ALIGN(4); . = ALIGN(4);
/* This is used by the startup in order to initialize the .data secion */ /* This is used by the startup in order to initialize the .data secion */
_edata = . ; _edata = . ;
} >DATA } > DATA
.stack : .stack :
{ {