Skip to content

Commit abc58af

Browse files
committed
picolib: Add option to compile additional variant of stdc++
Compile additional variant of libstdc++ with exceptions disabled. Signed-off-by: Adrian Gielniewski <[email protected]>
1 parent 2e9ac05 commit abc58af

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

config/comp_libs/picolibc.in

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,16 @@ config LIBC_PICOLIBC_GCC_LIBSTDCXX
2020
picolibc. This version is linked when "--specs=picolibcpp.specs"
2121
is specified.
2222

23+
config LIBC_PICOLIBC_GCC_LIBSTDCXX_NOEXCEPT
24+
bool
25+
prompt "Compile libstdc++ picolibc variant with exceptions disabled"
26+
default y
27+
depends on CC_LANG_CXX
28+
help
29+
This option compiles an additional target libstdc++ for use with
30+
picolibc. This version is linked when "--specs=picolibcpp_noexcept.specs"
31+
is specified.
32+
2333
config LIBC_PICOLIBC_CXA_ATEXIT
2434
def_bool y
2535
select LIBC_PROVIDES_CXA_ATEXIT

samples/arm-picolibc-eabi/crosstool.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ CT_CC_GCC_MULTILIB_LIST="rmprofile"
99
CT_CC_GCC_CONFIG_TLS=y
1010
CT_CC_LANG_CXX=y
1111
CT_COMP_LIBS_PICOLIBC=y
12+
CT_LIBC_PICOLIBC_GCC_LIBSTDCXX_NOEXCEPT=y

scripts/build/companion_libs/340-picolibc.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ do_picolibc_extract() {
2727
# flag for libstdc++ "picolibc" variant.
2828
do_cc_libstdcxx_picolibc()
2929
{
30+
local variant="$1"
3031
local -a final_opts
3132
local final_backend
3233

@@ -46,6 +47,9 @@ do_cc_libstdcxx_picolibc()
4647
if [ "${CT_LIBC_PICOLIBC_ENABLE_TARGET_OPTSPACE}" = "y" ]; then
4748
final_opts+=( "enable_optspace=yes" )
4849
fi
50+
if [ "${variant}" = "noexcept" ]; then
51+
final_opts+=( "extra_cxxflags_for_target=-fno-exceptions" )
52+
fi
4953

5054
if [ "${CT_BARE_METAL}" = "y" ]; then
5155
final_opts+=( "mode=baremetal" )
@@ -170,6 +174,13 @@ EOF
170174

171175
do_cc_libstdcxx_picolibc
172176

177+
# TODO: suffix
178+
if [ "${CT_LIBC_PICOLIBC_GCC_LIBSTDCXX_NOEXCEPT}" = "y" ]; then
179+
CT_mkdir_pushd "${CT_BUILD_DIR}/build-picolibc-build-${CT_BUILD}-noexcept"
180+
do_cc_libstdcxx_picolibc noexcept
181+
CT_Popd
182+
fi
183+
173184
if [ "${CT_STRIP_TARGET_TOOLCHAIN_LIBRARIES}" = "y" ]; then
174185

175186
CT_DoStep INFO "Stripping Picolibc library"

0 commit comments

Comments
 (0)