newlib: Add libstdc++ nano-specific CXXFLAGS

This commit adds a new config that can be used to specify the target
CXXFLAGS specific to the libstdc++ newlib-nano variant.

By default, this config is set to specify the `-fno-exceptions` option,
which disables C++ exception handling support and greatly reduces the
compiled binary size.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
This commit is contained in:
Stephanos Ioannidis 2021-06-07 15:13:19 +09:00
parent fffa4c5aa5
commit 7144b5f275
2 changed files with 11 additions and 0 deletions

View File

@ -18,6 +18,14 @@ config NEWLIB_NANO_GCC_LIBSTDCXX
This option compiles an additional target libstdc++ for use with
newlib-nano.
config NEWLIB_NANO_GCC_LIBSTDCXX_TARGET_CXXFLAGS
string
prompt "Target CXXFLAGS for libstdc++ newlib-nano variant"
default "-fno-exceptions"
help
Used to add extra CXXFLAGS when compiling the target libstdc++
newlib-nano library (e.g. -fno-exceptions).
config NEWLIB_NANO_INSTALL_IN_TARGET
bool
prompt "Additionally install newlib-nano libs into TARGET dir"

View File

@ -67,6 +67,9 @@ do_cc_libstdcxx_newlib_nano()
if [ "${CT_LIBC_NEWLIB_NANO_ENABLE_TARGET_OPTSPACE}" = "y" ]; then
final_opts+=( "enable_optspace=yes" )
fi
if [ -n "${CT_NEWLIB_NANO_GCC_LIBSTDCXX_TARGET_CXXFLAGS}" ]; then
final_opts+=( "extra_cxxflags_for_target=${CT_NEWLIB_NANO_GCC_LIBSTDCXX_TARGET_CXXFLAGS}" )
fi
if [ "${CT_BARE_METAL}" = "y" ]; then
final_opts+=( "mode=baremetal" )