Skip to content

Commit 3962937

Browse files
committed
Update README.md
1 parent cded27b commit 3962937

File tree

1 file changed

+25
-24
lines changed

1 file changed

+25
-24
lines changed

components/cplusplus/README.md

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,50 +4,51 @@ This is the C++ component in RT-Thread RTOS. In order to support C++ language, t
44
implement a basic environment, such as new/delete operators.
55

66
Because RT-Thread RTOS is used in embedded system mostly, there are some rules for C++ applications:
7+
78
1. DOES NOT use exception.
89
2. DOES NOT use Run-Time Type Information (RTTI).
910
3. Template is discouraged and it easily causes code text large.
1011
4. Static class variables are discouraged. The time and place to call their constructor function could not be precisely controlled and make multi-threaded programming a nightmare.
1112
5. Multiple inheritance is strongly discouraged, as it can cause intolerable confusion.
1213

13-
*NOTE*: The libc must be enable.
14+
*NOTE*: The libc (RT_USING_LIBC in rtconfig.h) must be enable.
1415

1516
About GNU GCC compiler
1617

1718
please add following string in your ld link script:
18-
// in your .text section
19-
PROVIDE(__ctors_start__ = .);
20-
/* old GCC version uses .ctors */
21-
KEEP(*(SORT(.ctors.*)))
22-
KEEP(*(.ctors))
23-
/* new GCC version uses .init_array */
24-
KEEP (*(SORT(.init_array.*)))
25-
KEEP (*(.init_array))
26-
PROVIDE(__ctors_end__ = .);
27-
28-
. = ALIGN(4);
29-
30-
// as a standalone section if you use ARM target.
3119

20+
// in your .text section
21+
PROVIDE(__ctors_start__ = .);
22+
/* old GCC version uses .ctors */
23+
KEEP(*(SORT(.ctors.*)))
24+
KEEP(*(.ctors))
25+
/* new GCC version uses .init_array */
26+
KEEP (*(SORT(.init_array.*)))
27+
KEEP (*(.init_array))
28+
PROVIDE(__ctors_end__ = .);
29+
30+
. = ALIGN(4);
31+
32+
// as a standalone section if you use ARM target.
33+
3234
/* The .ARM.exidx section is used for C++ exception handling. */
3335
/* .ARM.exidx is sorted, so has to go in its own output section. */
3436
__exidx_start = .;
35-
.ARM.exidx :
37+
ARM.exidx :
3638
{
3739
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
3840

3941
/* This is used by the startup in order to initialize the .data secion */
4042
_sidata = .;
4143
} > CODE
4244
__exidx_end = .;
43-
45+
4446
/* .data section which is used for initialized data */
4547

46-
// in your .data section
47-
PROVIDE(__dtors_start__ = .);
48-
KEEP(*(SORT(.dtors.*)))
49-
KEEP(*(.dtors))
50-
PROVIDE(__dtors_end__ = .);
51-
52-
. = ALIGN(4);
53-
48+
// in your .data section
49+
PROVIDE(__dtors_start__ = .);
50+
KEEP(*(SORT(.dtors.*)))
51+
KEEP(*(.dtors))
52+
PROVIDE(__dtors_end__ = .);
53+
54+
. = ALIGN(4);

0 commit comments

Comments
 (0)