mirror of
https://github.com/crosstool-ng/crosstool-ng.git
synced 2025-05-04 18:12:58 +00:00
picolibc: Build libstdc++ against picolibc if requested
This uses the gcc support for building libstdc++ using alternate lib header files. Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
parent
43f5079382
commit
27b18d2fc7
@ -10,6 +10,16 @@
|
|||||||
## help conglomeration of several library parts, all under BSD-compatible software
|
## help conglomeration of several library parts, all under BSD-compatible software
|
||||||
## help licenses that make them easily usable on embedded products.
|
## help licenses that make them easily usable on embedded products.
|
||||||
|
|
||||||
|
config LIBC_PICOLIBC_GCC_LIBSTDCXX
|
||||||
|
bool
|
||||||
|
prompt "Compile libstdc++ picolibc variant"
|
||||||
|
default y
|
||||||
|
depends on CC_LANG_CXX
|
||||||
|
help
|
||||||
|
This option compiles an additional target libstdc++ for use with
|
||||||
|
picolibc. This version is linked when "--specs=picolibcpp.specs"
|
||||||
|
is specified.
|
||||||
|
|
||||||
config LIBC_PICOLIBC_CXA_ATEXIT
|
config LIBC_PICOLIBC_CXA_ATEXIT
|
||||||
def_bool y
|
def_bool y
|
||||||
select LIBC_PROVIDES_CXA_ATEXIT
|
select LIBC_PROVIDES_CXA_ATEXIT
|
||||||
|
@ -8,3 +8,4 @@ CT_CC_GCC_CONFIG_TLS=y
|
|||||||
CT_TARGET_CFLAGS="-ftls-model=local-exec"
|
CT_TARGET_CFLAGS="-ftls-model=local-exec"
|
||||||
CT_CC_GCC_MULTILIB_LIST="rmprofile"
|
CT_CC_GCC_MULTILIB_LIST="rmprofile"
|
||||||
CT_COMP_LIBS_PICOLIBC=y
|
CT_COMP_LIBS_PICOLIBC=y
|
||||||
|
CT_CC_LANG_CXX=y
|
||||||
|
@ -22,6 +22,50 @@ do_picolibc_extract() {
|
|||||||
CT_ExtractPatch PICOLIBC
|
CT_ExtractPatch PICOLIBC
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Build an additional target libstdc++ with "-Os" (optimise for speed) option
|
||||||
|
# flag for libstdc++ "picolibc" variant.
|
||||||
|
do_cc_libstdcxx_picolibc()
|
||||||
|
{
|
||||||
|
local -a final_opts
|
||||||
|
local final_backend
|
||||||
|
|
||||||
|
if [ "${CT_LIBC_PICOLIBC_GCC_LIBSTDCXX}" = "y" ]; then
|
||||||
|
final_opts+=( "host=${CT_HOST}" )
|
||||||
|
final_opts+=( "libstdcxx_name=picolibc" )
|
||||||
|
final_opts+=( "prefix=${CT_PREFIX_DIR}" )
|
||||||
|
final_opts+=( "complibs=${CT_HOST_COMPLIBS_DIR}" )
|
||||||
|
final_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
|
||||||
|
final_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" )
|
||||||
|
final_opts+=( "lang_list=c,c++" )
|
||||||
|
final_opts+=( "build_step=libstdcxx" )
|
||||||
|
final_opts+=( "extra_config+=('--enable-stdio=stdio_pure')" )
|
||||||
|
if [ "${CT_LIBC_PICOLIBC_ENABLE_TARGET_OPTSPACE}" = "y" ]; then
|
||||||
|
final_opts+=( "enable_optspace=yes" )
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${CT_BARE_METAL}" = "y" ]; then
|
||||||
|
final_opts+=( "mode=baremetal" )
|
||||||
|
final_opts+=( "build_libgcc=yes" )
|
||||||
|
final_opts+=( "build_libstdcxx=yes" )
|
||||||
|
final_opts+=( "build_libgfortran=yes" )
|
||||||
|
if [ "${CT_STATIC_TOOLCHAIN}" = "y" ]; then
|
||||||
|
final_opts+=( "build_staticlinked=yes" )
|
||||||
|
fi
|
||||||
|
final_backend=do_gcc_core_backend
|
||||||
|
else
|
||||||
|
final_backend=do_gcc_backend
|
||||||
|
fi
|
||||||
|
|
||||||
|
CT_DoStep INFO "Installing libstdc++ picolibc"
|
||||||
|
CT_mkdir_pushd "${CT_BUILD_DIR}/build-cc-libstdcxx-picolibc"
|
||||||
|
"${final_backend}" "${final_opts[@]}"
|
||||||
|
CT_Popd
|
||||||
|
|
||||||
|
CT_EndStep
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
do_picolibc_for_target() {
|
do_picolibc_for_target() {
|
||||||
local -a picolibc_opts
|
local -a picolibc_opts
|
||||||
local cflags_for_target
|
local cflags_for_target
|
||||||
@ -119,6 +163,8 @@ EOF
|
|||||||
|
|
||||||
CT_Popd
|
CT_Popd
|
||||||
CT_EndStep
|
CT_EndStep
|
||||||
|
|
||||||
|
do_cc_libstdcxx_picolibc
|
||||||
}
|
}
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user