mirror of
https://github.com/crosstool-ng/crosstool-ng.git
synced 2024-12-24 06:56:40 +00:00
picolibc: Add configuration to select picolibc as the system libc
This moves the picolibc configuration values under C-library -> picolibc so that they will be more easily discovered. Signed-off-by: Joakim Nohlgård <joakim@nohlgard.se>
This commit is contained in:
parent
9e13e83068
commit
1a362b5607
@ -1,6 +1,9 @@
|
|||||||
# picolibc options
|
# picolibc companion library options
|
||||||
|
|
||||||
|
## no-package
|
||||||
## depends on BARE_METAL && CONFIGURE_has_meson && CONFIGURE_has_ninja
|
## depends on BARE_METAL && CONFIGURE_has_meson && CONFIGURE_has_ninja
|
||||||
|
## depends on !LIBC_PICOLIBC
|
||||||
|
## select LIBC_PICOLIBC_SHOW
|
||||||
|
|
||||||
## help This option adds Picolibc to an existing configuration which may have
|
## help This option adds Picolibc to an existing configuration which may have
|
||||||
## help a C library, allowing you to install both and select between them
|
## help a C library, allowing you to install both and select between them
|
||||||
@ -9,124 +12,21 @@
|
|||||||
## help Picolibc is a C library intended for use on embedded systems. It is a
|
## help Picolibc is a C library intended for use on embedded systems. It is a
|
||||||
## 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.
|
||||||
|
## help
|
||||||
|
## help Configuration for picolibc can be found under:
|
||||||
|
## help -> C-library
|
||||||
|
## help -> picolibc
|
||||||
|
|
||||||
config LIBC_PICOLIBC_GCC_LIBSTDCXX
|
config LIBC_PICOLIBC_GCC_LIBSTDCXX
|
||||||
bool
|
bool
|
||||||
prompt "Compile libstdc++ picolibc variant"
|
prompt "Compile companion libstdc++ picolibc variant"
|
||||||
default y
|
default y
|
||||||
depends on CC_LANG_CXX
|
depends on CC_LANG_CXX
|
||||||
help
|
help
|
||||||
This option compiles an additional target libstdc++ for use with
|
This option compiles an additional target libstdc++ for use with
|
||||||
picolibc. This version is linked when "--specs=picolibcpp.specs"
|
the picolibc companion library. This version is linked when
|
||||||
is specified.
|
"--specs=picolibcpp.specs" is specified.
|
||||||
|
|
||||||
config LIBC_PICOLIBC_CXA_ATEXIT
|
comment "Configuration for picolibc can be found under"
|
||||||
def_bool y
|
comment "* -> C-library"
|
||||||
select LIBC_PROVIDES_CXA_ATEXIT
|
comment "* -> picolibc"
|
||||||
|
|
||||||
config LIBC_PICOLIBC_TARGET_CFLAGS
|
|
||||||
string
|
|
||||||
prompt "Target CFLAGS for picolibc"
|
|
||||||
default ""
|
|
||||||
help
|
|
||||||
Used to add specific options when compiling the target libraries
|
|
||||||
(eg. -ffunction-sections -fdata-sections), which can't be defined
|
|
||||||
in global TARGET_CFLAGS, because they shall be not used for the
|
|
||||||
gcc target libraries.
|
|
||||||
Note: Both TARGET_CFLAGS and LIBC_PICOLIBC_TARGET_CFLAGS are used
|
|
||||||
to compile the libraries.
|
|
||||||
|
|
||||||
Leave blank if you don't know better.
|
|
||||||
|
|
||||||
config LIBC_PICOLIBC_IO_C99FMT
|
|
||||||
bool
|
|
||||||
prompt "Enable IOs on C99 formats"
|
|
||||||
default y
|
|
||||||
help
|
|
||||||
Enable support for IOs on C99 formats.
|
|
||||||
|
|
||||||
config LIBC_PICOLIBC_REGISTER_FINI
|
|
||||||
bool
|
|
||||||
prompt "Enable finalization function registration using atexit"
|
|
||||||
help
|
|
||||||
Enable finalization function registration using atexit.
|
|
||||||
|
|
||||||
config LIBC_PICOLIBC_ATEXIT_DYNAMIC_ALLOC
|
|
||||||
bool
|
|
||||||
prompt "Enable dynamic allocation of atexit entries"
|
|
||||||
help
|
|
||||||
Enable dynamic allocation of atexit entries.
|
|
||||||
|
|
||||||
config LIBC_PICOLIBC_GLOBAL_ATEXIT
|
|
||||||
bool
|
|
||||||
prompt "Enable atexit data structure as global variable"
|
|
||||||
help
|
|
||||||
Enable atexit data structure as global variable, instead
|
|
||||||
of being thread-local.
|
|
||||||
|
|
||||||
config LIBC_PICOLIBC_LITE_EXIT
|
|
||||||
bool
|
|
||||||
prompt "Enable lite exit"
|
|
||||||
default y
|
|
||||||
help
|
|
||||||
Enable lite exit, a size-reduced implementation of exit that doesn't
|
|
||||||
invoke clean-up functions such as _fini or global destructors.
|
|
||||||
|
|
||||||
config LIBC_PICOLIBC_MULTITHREAD
|
|
||||||
bool
|
|
||||||
prompt "Enable support for multiple threads"
|
|
||||||
default y
|
|
||||||
help
|
|
||||||
Enable support for multiple threads.
|
|
||||||
|
|
||||||
config LIBC_PICOLIBC_RETARGETABLE_LOCKING
|
|
||||||
bool
|
|
||||||
prompt "Enable retargetable locking"
|
|
||||||
default y
|
|
||||||
help
|
|
||||||
Enable retargetable locking to allow the operating system to override
|
|
||||||
the dummy lock functions defined within picolibc.
|
|
||||||
|
|
||||||
config LIBC_PICOLIBC_EXTRA_SECTIONS
|
|
||||||
bool
|
|
||||||
prompt "Place each function & data element in their own section"
|
|
||||||
help
|
|
||||||
Place each function & data symbol in their own section. This allows
|
|
||||||
the linker to garbage collect unused symbols at link time.
|
|
||||||
|
|
||||||
config LIBC_PICOLIBC_ENABLE_TARGET_OPTSPACE
|
|
||||||
bool
|
|
||||||
prompt "Optimize picolibc for size"
|
|
||||||
default y
|
|
||||||
help
|
|
||||||
Pass --enable-target-optspace to picolibc configure.
|
|
||||||
|
|
||||||
This will compile picolibc with -Os.
|
|
||||||
|
|
||||||
config LIBC_PICOLIBC_LTO
|
|
||||||
bool
|
|
||||||
prompt "Enable Link Time Optimization"
|
|
||||||
depends on CC_GCC_USE_LTO
|
|
||||||
help
|
|
||||||
Builds the libraries with -flto to enable more aggressive link time
|
|
||||||
optimization. You will need to add -flto-partition=one to your
|
|
||||||
application's link line to keep the RETURN assembler macro together
|
|
||||||
with it's consumers.
|
|
||||||
|
|
||||||
config LIBC_PICOLIBC_NANO_MALLOC
|
|
||||||
bool
|
|
||||||
prompt "Enable Nano Malloc"
|
|
||||||
default y
|
|
||||||
help
|
|
||||||
PICOLIBC has two implementations of malloc family's functions, one in
|
|
||||||
`mallocr.c' and the other one in `nano-mallocr.c'. This options
|
|
||||||
enables the nano-malloc implementation, which is for small systems
|
|
||||||
with very limited memory. Note that this implementation does not
|
|
||||||
support `--enable-malloc-debugging' any more.
|
|
||||||
|
|
||||||
config LIBC_PICOLIBC_EXTRA_CONFIG_ARRAY
|
|
||||||
string
|
|
||||||
prompt "Extra config for picolibc"
|
|
||||||
default ""
|
|
||||||
help
|
|
||||||
Extra flags to pass to meson when configuring picolibc.
|
|
||||||
|
125
config/libc/picolibc.in
Normal file
125
config/libc/picolibc.in
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
# picolibc options
|
||||||
|
|
||||||
|
## depends on BARE_METAL && CONFIGURE_has_meson && CONFIGURE_has_ninja
|
||||||
|
## select CC_CORE_NEEDED
|
||||||
|
## select LIBC_SUPPORT_THREADS_NATIVE
|
||||||
|
|
||||||
|
## help Picolibc is a C library intended for use on embedded systems. It is a
|
||||||
|
## help conglomeration of several library parts, all under BSD-compatible software
|
||||||
|
## help licenses that make them easily usable on embedded products.
|
||||||
|
## help
|
||||||
|
## help This requres GCC with picolibc support which is only available
|
||||||
|
## help for GCC version 12.2.0 or later. A crosstool-ng dependency conflict
|
||||||
|
## help prevents that from being managed automatically.
|
||||||
|
##
|
||||||
|
|
||||||
|
config LIBC_PICOLIBC_CXA_ATEXIT
|
||||||
|
def_bool y
|
||||||
|
select LIBC_PROVIDES_CXA_ATEXIT
|
||||||
|
|
||||||
|
config LIBC_PICOLIBC_TARGET_CFLAGS
|
||||||
|
string
|
||||||
|
prompt "Target CFLAGS for picolibc"
|
||||||
|
default ""
|
||||||
|
help
|
||||||
|
Used to add specific options when compiling the target libraries
|
||||||
|
(eg. -ffunction-sections -fdata-sections), which can't be defined
|
||||||
|
in global TARGET_CFLAGS, because they shall be not used for the
|
||||||
|
gcc target libraries.
|
||||||
|
Note: Both TARGET_CFLAGS and LIBC_PICOLIBC_TARGET_CFLAGS are used
|
||||||
|
to compile the libraries.
|
||||||
|
|
||||||
|
Leave blank if you don't know better.
|
||||||
|
|
||||||
|
config LIBC_PICOLIBC_IO_C99FMT
|
||||||
|
bool
|
||||||
|
prompt "Enable IOs on C99 formats"
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
Enable support for IOs on C99 formats.
|
||||||
|
|
||||||
|
config LIBC_PICOLIBC_REGISTER_FINI
|
||||||
|
bool
|
||||||
|
prompt "Enable finalization function registration using atexit"
|
||||||
|
help
|
||||||
|
Enable finalization function registration using atexit.
|
||||||
|
|
||||||
|
config LIBC_PICOLIBC_ATEXIT_DYNAMIC_ALLOC
|
||||||
|
bool
|
||||||
|
prompt "Enable dynamic allocation of atexit entries"
|
||||||
|
help
|
||||||
|
Enable dynamic allocation of atexit entries.
|
||||||
|
|
||||||
|
config LIBC_PICOLIBC_GLOBAL_ATEXIT
|
||||||
|
bool
|
||||||
|
prompt "Enable atexit data structure as global variable"
|
||||||
|
help
|
||||||
|
Enable atexit data structure as global variable, instead
|
||||||
|
of being thread-local.
|
||||||
|
|
||||||
|
config LIBC_PICOLIBC_LITE_EXIT
|
||||||
|
bool
|
||||||
|
prompt "Enable lite exit"
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
Enable lite exit, a size-reduced implementation of exit that doesn't
|
||||||
|
invoke clean-up functions such as _fini or global destructors.
|
||||||
|
|
||||||
|
config LIBC_PICOLIBC_MULTITHREAD
|
||||||
|
bool
|
||||||
|
prompt "Enable support for multiple threads"
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
Enable support for multiple threads.
|
||||||
|
|
||||||
|
config LIBC_PICOLIBC_RETARGETABLE_LOCKING
|
||||||
|
bool
|
||||||
|
prompt "Enable retargetable locking"
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
Enable retargetable locking to allow the operating system to override
|
||||||
|
the dummy lock functions defined within picolibc.
|
||||||
|
|
||||||
|
config LIBC_PICOLIBC_EXTRA_SECTIONS
|
||||||
|
bool
|
||||||
|
prompt "Place each function & data element in their own section"
|
||||||
|
help
|
||||||
|
Place each function & data symbol in their own section. This allows
|
||||||
|
the linker to garbage collect unused symbols at link time.
|
||||||
|
|
||||||
|
config LIBC_PICOLIBC_ENABLE_TARGET_OPTSPACE
|
||||||
|
bool
|
||||||
|
prompt "Optimize picolibc for size"
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
Pass --enable-target-optspace to picolibc configure.
|
||||||
|
|
||||||
|
This will compile picolibc with -Os.
|
||||||
|
|
||||||
|
config LIBC_PICOLIBC_LTO
|
||||||
|
bool
|
||||||
|
prompt "Enable Link Time Optimization"
|
||||||
|
depends on CC_GCC_USE_LTO
|
||||||
|
help
|
||||||
|
Builds the libraries with -flto to enable more aggressive link time
|
||||||
|
optimization. You will need to add -flto-partition=one to your
|
||||||
|
application's link line to keep the RETURN assembler macro together
|
||||||
|
with it's consumers.
|
||||||
|
|
||||||
|
config LIBC_PICOLIBC_NANO_MALLOC
|
||||||
|
bool
|
||||||
|
prompt "Enable Nano Malloc"
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
PICOLIBC has two implementations of malloc family's functions, one in
|
||||||
|
`mallocr.c' and the other one in `nano-mallocr.c'. This options
|
||||||
|
enables the nano-malloc implementation, which is for small systems
|
||||||
|
with very limited memory. Note that this implementation does not
|
||||||
|
support `--enable-malloc-debugging' any more.
|
||||||
|
|
||||||
|
config LIBC_PICOLIBC_EXTRA_CONFIG_ARRAY
|
||||||
|
string
|
||||||
|
prompt "Extra config for picolibc"
|
||||||
|
default ""
|
||||||
|
help
|
||||||
|
Extra flags to pass to meson when configuring picolibc.
|
@ -11,71 +11,13 @@ do_picolibc_for_build() { :; }
|
|||||||
do_picolibc_for_host() { :; }
|
do_picolibc_for_host() { :; }
|
||||||
do_picolibc_for_target() { :; }
|
do_picolibc_for_target() { :; }
|
||||||
|
|
||||||
if [ "${CT_COMP_LIBS_PICOLIBC}" = "y" ]; then
|
if [ "${CT_LIBC_PICOLIBC}" = "y" -o "${CT_COMP_LIBS_PICOLIBC}" = "y" ]; then
|
||||||
|
|
||||||
# Download picolibc
|
do_picolibc_common_install() {
|
||||||
do_picolibc_get() {
|
|
||||||
CT_Fetch PICOLIBC
|
|
||||||
}
|
|
||||||
|
|
||||||
do_picolibc_extract() {
|
|
||||||
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')" )
|
|
||||||
final_opts+=( "extra_config+=('--disable-wchar_t')" )
|
|
||||||
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() {
|
|
||||||
local -a picolibc_opts
|
local -a picolibc_opts
|
||||||
local cflags_for_target
|
local cflags_for_target
|
||||||
|
|
||||||
CT_DoStep INFO "Installing Picolibc library"
|
CT_DoLog EXTRA "Configuring C library"
|
||||||
|
|
||||||
CT_mkdir_pushd "${CT_BUILD_DIR}/build-picolibc-build-${CT_BUILD}"
|
|
||||||
|
|
||||||
CT_DoLog EXTRA "Configuring Picolibc library"
|
|
||||||
|
|
||||||
# Multilib is the default, so if it is not enabled, disable it.
|
# Multilib is the default, so if it is not enabled, disable it.
|
||||||
if [ "${CT_MULTILIB}" != "y" ]; then
|
if [ "${CT_MULTILIB}" != "y" ]; then
|
||||||
@ -106,9 +48,6 @@ RETARGETABLE_LOCKING:newlib-retargetable-locking
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
[ "${CT_USE_SYSROOT}" = "y" ] && \
|
|
||||||
picolibc_opts+=( "-Dsysroot-install=true" )
|
|
||||||
|
|
||||||
[ "${CT_LIBC_PICOLIBC_EXTRA_SECTIONS}" = "y" ] && \
|
[ "${CT_LIBC_PICOLIBC_EXTRA_SECTIONS}" = "y" ] && \
|
||||||
CT_LIBC_PICOLIBC_TARGET_CFLAGS="${CT_LIBC_PICOLIBC_TARGET_CFLAGS} -ffunction-sections -fdata-sections"
|
CT_LIBC_PICOLIBC_TARGET_CFLAGS="${CT_LIBC_PICOLIBC_TARGET_CFLAGS} -ffunction-sections -fdata-sections"
|
||||||
|
|
||||||
@ -145,13 +84,24 @@ needs_exe_wrapper = true
|
|||||||
skip_sanity_check = true
|
skip_sanity_check = true
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
local picolibc_sysroot_dir
|
||||||
|
local picolibc_lib_dir
|
||||||
|
if [ "${CT_LIBC_PICOLIBC}" = 'y' ]; then
|
||||||
|
picolibc_sysroot_dir="${CT_SYSROOT_DIR}"
|
||||||
|
picolibc_lib_dir="${CT_SYSROOT_DIR}/lib"
|
||||||
|
picolibc_opts+=( '-Dsystem-libc=true' )
|
||||||
|
else
|
||||||
|
picolibc_sysroot_dir="${CT_PREFIX_DIR}/picolibc"
|
||||||
|
picolibc_lib_dir="${picolibc_sysroot_dir}/${CT_TARGET}/lib"
|
||||||
|
fi
|
||||||
|
|
||||||
CT_DoExecLog CFG \
|
CT_DoExecLog CFG \
|
||||||
meson \
|
meson \
|
||||||
--cross-file picolibc-cross.txt \
|
--cross-file picolibc-cross.txt \
|
||||||
--prefix="${CT_PREFIX_DIR}" \
|
--prefix="${picolibc_sysroot_dir}" \
|
||||||
-Dincludedir=picolibc/include \
|
-Dincludedir=include \
|
||||||
-Dlibdir=picolibc/${CT_TARGET}/lib \
|
-Dlibdir="${picolibc_lib_dir}" \
|
||||||
-Dspecsdir="${CT_SYSROOT_DIR}"/lib \
|
-Dspecsdir="${CT_SYSROOT_DIR}/lib" \
|
||||||
"${CT_SRC_DIR}/picolibc" \
|
"${CT_SRC_DIR}/picolibc" \
|
||||||
"${picolibc_opts[@]}" \
|
"${picolibc_opts[@]}" \
|
||||||
"${CT_LIBC_PICOLIBC_EXTRA_CONFIG_ARRAY[@]}"
|
"${CT_LIBC_PICOLIBC_EXTRA_CONFIG_ARRAY[@]}"
|
||||||
@ -161,11 +111,75 @@ EOF
|
|||||||
|
|
||||||
CT_DoLog EXTRA "Installing C library"
|
CT_DoLog EXTRA "Installing C library"
|
||||||
CT_DoExecLog ALL ninja install
|
CT_DoExecLog ALL ninja install
|
||||||
|
}
|
||||||
|
|
||||||
|
fi # CT_LIBC_PICOLIBC -o CT_COMP_LIBS_PICOLIBC
|
||||||
|
|
||||||
|
if [ "${CT_COMP_LIBS_PICOLIBC}" = "y" ]; then
|
||||||
|
|
||||||
|
do_cc_libstdcxx_picolibc() { :; }
|
||||||
|
|
||||||
|
# Download picolibc
|
||||||
|
do_picolibc_get() {
|
||||||
|
CT_Fetch PICOLIBC
|
||||||
|
}
|
||||||
|
|
||||||
|
do_picolibc_extract() {
|
||||||
|
CT_ExtractPatch PICOLIBC
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ "${CT_LIBC_PICOLIBC_GCC_LIBSTDCXX}" = "y" ]; then
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# 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
|
||||||
|
|
||||||
|
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')" )
|
||||||
|
final_opts+=( "extra_config+=('--disable-wchar_t')" )
|
||||||
|
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 # CT_LIBC_PICOLIBC_GCC_LIBSTDCXX
|
||||||
|
|
||||||
|
do_picolibc_for_target() {
|
||||||
|
CT_DoStep INFO "Installing Picolibc library"
|
||||||
|
CT_mkdir_pushd "${CT_BUILD_DIR}/build-picolibc-build-${CT_BUILD}"
|
||||||
|
do_picolibc_common_install
|
||||||
CT_Popd
|
CT_Popd
|
||||||
CT_EndStep
|
CT_EndStep
|
||||||
|
|
||||||
do_cc_libstdcxx_picolibc
|
do_cc_libstdcxx_picolibc
|
||||||
}
|
}
|
||||||
|
|
||||||
fi
|
fi # CT_COMP_LIBS_PICOLIBC
|
||||||
|
29
scripts/build/libc/picolibc.sh
Normal file
29
scripts/build/libc/picolibc.sh
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
# This file adds functions to use the Picolibc library as the system libc
|
||||||
|
# Copyright © 2022 Joakim Nohlgård
|
||||||
|
# Licensed under the GPL v2 or later. See COPYING in the root of this package
|
||||||
|
|
||||||
|
picolibc_get()
|
||||||
|
{
|
||||||
|
CT_Fetch PICOLIBC
|
||||||
|
}
|
||||||
|
|
||||||
|
picolibc_extract()
|
||||||
|
{
|
||||||
|
CT_ExtractPatch PICOLIBC
|
||||||
|
}
|
||||||
|
|
||||||
|
picolibc_headers()
|
||||||
|
{
|
||||||
|
CT_DoStep INFO "Installing C library headers"
|
||||||
|
CT_DoExecLog ALL cp -a "${CT_SRC_DIR}/picolibc/newlib/libc/include/." "${CT_HEADERS_DIR}"
|
||||||
|
CT_EndStep
|
||||||
|
}
|
||||||
|
|
||||||
|
picolibc_main()
|
||||||
|
{
|
||||||
|
CT_DoStep INFO "Installing C library"
|
||||||
|
CT_mkdir_pushd "${CT_BUILD_DIR}/build-libc"
|
||||||
|
do_picolibc_common_install
|
||||||
|
CT_Popd
|
||||||
|
CT_EndStep
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user