Skip to content

Commit 950d019

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 53b5327 commit 950d019

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-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: 12 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

@@ -44,6 +45,9 @@ do_cc_libstdcxx_picolibc()
4445
if [ "${CT_LIBC_PICOLIBC_ENABLE_TARGET_OPTSPACE}" = "y" ]; then
4546
final_opts+=( "enable_optspace=yes" )
4647
fi
48+
if [ "${variant}" = "noexcept" ]; then
49+
final_opts+=( "extra_cxxflags_for_target=-fno-exceptions" )
50+
fi
4751

4852
if [ "${CT_BARE_METAL}" = "y" ]; then
4953
final_opts+=( "mode=baremetal" )
@@ -168,6 +172,14 @@ EOF
168172

169173
do_cc_libstdcxx_picolibc
170174

175+
# TODO: suffix
176+
# TODO: specs
177+
if [ "${CT_LIBC_PICOLIBC_GCC_LIBSTDCXX_NOEXCEPT}" = "y" ]; then
178+
CT_mkdir_pushd noexcept
179+
do_cc_libstdcxx_picolibc noexcept
180+
CT_Popd
181+
fi
182+
171183
if [ "${CT_STRIP_TARGET_TOOLCHAIN_LIBRARIES}" = "y" ]; then
172184

173185
CT_DoStep INFO "Stripping Picolibc library"

0 commit comments

Comments
 (0)