Add option to re-enable ˋlibstdc++ˋ on avr targets.

Due to the small flash space on AVR devices the library containing the
standard types in C++ (ˋlibstdc++ˋ) does not get built normally when
enabling the C++ language support.

This option is an easy way to go back to the PC-way where ˋlibstdc++ˋ is
built.

Signed-off-by: Quentin Boswank <qubos@outlook.de>
This commit is contained in:
Quentin Boswank 2023-08-12 20:11:58 +02:00 committed by Chris Packham
parent cd8a5b72b5
commit fd04f43617
3 changed files with 61 additions and 18 deletions

View File

@ -54,6 +54,15 @@ config CC_GCC_ENABLE_CXX_FLAGS
Note: just pass in the option _value_, that is only the part that goes
after the '=' sign.
config CC_GCC_EXTRA_LIBSTDCXX
bool "Re-enable libstdcxx"
default n
depends on LIBC_AVR_LIBC
select CC_CORE_PASS_2_NEEDED
help
libstdcxx is normally disabled on avr systems due to size limitations.
Set this option to re-enable libstdcxx support.
config CC_GCC_CORE_EXTRA_CONFIG_ARRAY
string "Core gcc extra config"
default ""

View File

@ -1052,6 +1052,8 @@ do_gcc_backend() {
if [ "${build_libstdcxx}" = "no" ]; then
extra_config+=(--disable-libstdcxx)
elif [ "${CT_CC_GCC_EXTRA_LIBSTDCXX}" = "y" ]; then
extra_config+=(--enable-libstdcxx)
fi
if [ "${CT_LIBC_PICOLIBC}" = "y" ]; then

View File

@ -2,28 +2,60 @@
avr_libc_post_cc()
{
CT_DoStep INFO "Installing C library"
if [ "${CT_CC_CORE_PASS_2_NEEDED}" != "y" ]; then
CT_DoStep INFO "Installing C library"
CT_DoLog EXTRA "Copying sources to build directory"
CT_DoExecLog ALL cp -av "${CT_SRC_DIR}/avr-libc/." \
"${CT_BUILD_DIR}/build-libc-post-cc"
cd "${CT_BUILD_DIR}/build-libc-post-cc"
CT_DoLog EXTRA "Copying sources to build directory"
CT_DoExecLog ALL cp -av "${CT_SRC_DIR}/avr-libc/." \
"${CT_BUILD_DIR}/build-libc-post-cc"
cd "${CT_BUILD_DIR}/build-libc-post-cc"
CT_DoLog EXTRA "Configuring C library"
CT_DoLog EXTRA "Configuring C library"
CT_DoExecLog CFG \
${CONFIG_SHELL} \
./configure \
--build=${CT_BUILD} \
--host=${CT_TARGET} \
--prefix=${CT_PREFIX_DIR} \
"${CT_LIBC_AVR_LIBC_EXTRA_CONFIG_ARRAY[@]}"
CT_DoExecLog CFG \
${CONFIG_SHELL} \
./configure \
--build=${CT_BUILD} \
--host=${CT_TARGET} \
--prefix=${CT_PREFIX_DIR} \
"${CT_LIBC_AVR_LIBC_EXTRA_CONFIG_ARRAY[@]}"
CT_DoLog EXTRA "Building C library"
CT_DoExecLog ALL make ${CT_JOBSFLAGS}
CT_DoLog EXTRA "Building C library"
CT_DoExecLog ALL make ${CT_JOBSFLAGS}
CT_DoLog EXTRA "Installing C library"
CT_DoExecLog ALL make install
CT_DoLog EXTRA "Installing C library"
CT_DoExecLog ALL make install
CT_EndStep
CT_EndStep
fi
}
avr_libc_main()
{
if [ "${CT_CC_CORE_PASS_2_NEEDED}" = "y" ]; then
CT_DoStep INFO "Installing C library"
CT_DoLog EXTRA "Copying sources to build directory"
CT_DoExecLog ALL cp -av "${CT_SRC_DIR}/avr-libc/." \
"${CT_BUILD_DIR}/build-libc"
cd "${CT_BUILD_DIR}/build-libc"
CT_DoLog EXTRA "Configuring C library"
CT_DoExecLog CFG \
${CONFIG_SHELL} \
./configure \
--build=${CT_BUILD} \
--host=${CT_TARGET} \
--prefix=${CT_PREFIX_DIR} \
"${CT_LIBC_AVR_LIBC_EXTRA_CONFIG_ARRAY[@]}"
CT_DoLog EXTRA "Building C library"
CT_DoExecLog ALL make ${CT_JOBSFLAGS}
CT_DoLog EXTRA "Installing C library"
CT_DoExecLog ALL make install
CT_EndStep
fi
}