Files
rt-thread/components/libc/cplusplus/Kconfig
T
seteiro 3577e7a6ed [components][libc] run .init_array constructors in cplusplus_system_init
Newer GCC emits C++ global constructors into .init_array, which many
linker scripts keep outside [__ctors_start__, __ctors_end__), so they
never ran. Walk __init_array_start/__init_array_end (weak) as well,
skipping entries already covered by the ctors range.

Add RT_USING_CPP_CRT_INIT for ports whose startup runtime already runs
.init_array, default on for the simulator. With it set, only the
.init_array walk is skipped; the ctors range is still walked.

Renesas RA/RA_WIRELESS/RZ families select it when C++ is enabled: FSP
SystemInit() already walks .init_array, so boards whose linker script
only provides __init_array_* would run constructors twice. Boards that
fold .init_array into the ctors range (ra6m3-hmi-board, ra8d1, rz)
still run them once via RT-Thread.

Also source env.sh and restore RTT_EXEC_PATH in ToolsCI project generate
and dist steps so scons is on PATH (exit 127) and the ARM toolchain path
is not overwritten by env.sh.

Fixes #11778
2026-10-11 16:11:07 +08:00

37 lines
1.2 KiB
Plaintext

menuconfig RT_USING_CPLUSPLUS
bool "Enable C++ features"
default n
if RT_USING_CPLUSPLUS
config RT_USING_CPP_CRT_INIT
bool "Startup runtime already runs .init_array constructors"
default y if SOC_SIMULATOR
default n
help
Enable this for GCC ports whose startup runtime already walks the
.init_array section, so that RT-Thread skips it and does not run
the constructors twice. RT-Thread still walks the ctors range.
This option is usually set by the BSP; do not change it manually.
Leave this disabled when the startup code relies on the empty
__libc_init_array provided by RT-Thread's newlib port, which
defers constructors to RT-Thread.
config RT_USING_CPLUSPLUS11
bool "Enable C++11 standard multi-threading feature support"
default n
select RT_USING_POSIX_FS
select RT_USING_POSIX_STDIO
select RT_USING_PTHREADS
select RT_USING_RTC
config RT_USING_CPP_WRAPPER
bool "Enable RT-Thread APIs C++ wrapper"
default n
config RT_USING_CPP_EXCEPTIONS
bool "Enable C++ exceptions (will increase overhead)"
default n
endif