Skip to content

Commit 38be10c

Browse files
committed
[BSP] fix GCC compiling issue when enable C++ support
1 parent 796c493 commit 38be10c

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

bsp/lpc408x/rtconfig.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
CXX = PREFIX + 'g++'
3434
AS = PREFIX + 'gcc'
3535
AR = PREFIX + 'ar'
36-
LINK = PREFIX + 'gcc'
36+
LINK = PREFIX + 'g++'
3737
TARGET_EXT = 'elf'
3838
SIZE = PREFIX + 'size'
3939
OBJDUMP = PREFIX + 'objdump'

bsp/lpc408x/rtthread-lpc408x.ld

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,25 @@ SECTIONS
3838
__vsymtab_end = .;
3939
. = ALIGN(4);
4040

41+
PROVIDE(__ctors_start__ = .);
42+
/* old GCC version uses .ctors */
43+
KEEP(*(SORT(.ctors.*)))
44+
KEEP(*(.ctors))
45+
/* new GCC version uses .init_array */
46+
KEEP (*(SORT(.init_array.*)))
47+
KEEP (*(.init_array))
48+
PROVIDE(__ctors_end__ = .);
49+
4150
. = ALIGN(4);
4251
_etext = .;
4352
} > CODE = 0
4453

54+
.ARM.extab :
55+
{
56+
*(.ARM.extab*)
57+
} > CODE
58+
59+
/* The .ARM.exidx section is used for C++ exception handling. */
4560
/* .ARM.exidx is sorted, so has to go in its own output section. */
4661
__exidx_start = .;
4762
.ARM.exidx :
@@ -57,6 +72,12 @@ SECTIONS
5772

5873
.data : AT (_sidata)
5974
{
75+
. = ALIGN(4);
76+
PROVIDE(__dtors_start__ = .);
77+
KEEP(*(SORT(.dtors.*)))
78+
KEEP(*(.dtors))
79+
PROVIDE(__dtors_end__ = .);
80+
6081
. = ALIGN(4);
6182
/* This is used by the startup in order to initialize the .data secion */
6283
_sdata = . ;
@@ -68,7 +89,7 @@ SECTIONS
6889
. = ALIGN(4);
6990
/* This is used by the startup in order to initialize the .data secion */
7091
_edata = . ;
71-
} >DATA
92+
} > DATA
7293

7394
.stack :
7495
{

0 commit comments

Comments
 (0)