You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: components/cplusplus/README.md
+25-24Lines changed: 25 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,50 +4,51 @@ This is the C++ component in RT-Thread RTOS. In order to support C++ language, t
4
4
implement a basic environment, such as new/delete operators.
5
5
6
6
Because RT-Thread RTOS is used in embedded system mostly, there are some rules for C++ applications:
7
+
7
8
1. DOES NOT use exception.
8
9
2. DOES NOT use Run-Time Type Information (RTTI).
9
10
3. Template is discouraged and it easily causes code text large.
10
11
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.
11
12
5. Multiple inheritance is strongly discouraged, as it can cause intolerable confusion.
12
13
13
-
*NOTE*: The libc must be enable.
14
+
*NOTE*: The libc (RT_USING_LIBC in rtconfig.h) must be enable.
14
15
15
16
About GNU GCC compiler
16
17
17
18
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.
31
19
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
+
32
34
/* The .ARM.exidx section is used for C++ exception handling. */
33
35
/* .ARM.exidx is sorted, so has to go in its own output section. */
34
36
__exidx_start = .;
35
-
.ARM.exidx :
37
+
ARM.exidx :
36
38
{
37
39
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
38
40
39
41
/* This is used by the startup in order to initialize the .data secion */
40
42
_sidata = .;
41
43
} > CODE
42
44
__exidx_end = .;
43
-
45
+
44
46
/* .data section which is used for initialized data */
0 commit comments