diff options
-rw-r--r-- | config/libc/picolibc.in | 29 | ||||
-rw-r--r-- | scripts/build/companion_libs/340-picolibc.sh | 24 |
2 files changed, 42 insertions, 11 deletions
diff --git a/config/libc/picolibc.in b/config/libc/picolibc.in index 6c4c6cac..c3014b11 100644 --- a/config/libc/picolibc.in +++ b/config/libc/picolibc.in @@ -40,31 +40,47 @@ config LIBC_PICOLIBC_IO_C99FMT config LIBC_PICOLIBC_REGISTER_FINI bool - prompt "Enable finalization function registration using atexit" + prompt "Enable finalization function registration using atexit [unused]" help Enable finalization function registration using atexit. + This would be used when building with the legacy newlib exit + handling code which cannot be enabled in crosstool-ng, so + this option doesn't do anything. + config LIBC_PICOLIBC_ATEXIT_DYNAMIC_ALLOC bool - prompt "Enable dynamic allocation of atexit entries" + prompt "Enable dynamic allocation of atexit entries [unused]" help Enable dynamic allocation of atexit entries. + This would be used when building with the legacy newlib exit + handling code which cannot be enabled in crosstool-ng, so + this option doesn't do anything. + config LIBC_PICOLIBC_GLOBAL_ATEXIT bool - prompt "Enable atexit data structure as global variable" + prompt "Enable atexit data structure as global variable [unused]" help Enable atexit data structure as global variable, instead of being thread-local. + This would be used when building with the legacy newlib exit + handling code which cannot be enabled in crosstool-ng, so + this option doesn't do anything. + config LIBC_PICOLIBC_LITE_EXIT bool - prompt "Enable lite exit" + prompt "Enable lite exit [unused]" 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. + This would be used when building with the legacy newlib exit + handling code which cannot be enabled in crosstool-ng, so + this option doesn't do anything. + config LIBC_PICOLIBC_MULTITHREAD bool prompt "Enable support for multiple threads" @@ -74,12 +90,15 @@ config LIBC_PICOLIBC_MULTITHREAD config LIBC_PICOLIBC_RETARGETABLE_LOCKING bool - prompt "Enable retargetable locking" + prompt "Enable retargetable locking [unused]" default y help Enable retargetable locking to allow the operating system to override the dummy lock functions defined within picolibc. + This value was always required to match + LIBC_PICOLIBC_MULTITHREAD, so it is no longer used. + config LIBC_PICOLIBC_EXTRA_SECTIONS bool prompt "Place each function & data element in their own section" diff --git a/scripts/build/companion_libs/340-picolibc.sh b/scripts/build/companion_libs/340-picolibc.sh index 94bdaad9..bef72e0f 100644 --- a/scripts/build/companion_libs/340-picolibc.sh +++ b/scripts/build/companion_libs/340-picolibc.sh @@ -26,13 +26,7 @@ do_picolibc_common_install() { yn_args="IO_C99FMT:io-c99-formats IO_LL:io-long-long -REGISTER_FINI:newlib-register-fini NANO_MALLOC:newlib-nano-malloc -ATEXIT_DYNAMIC_ALLOC:newlib-atexit-dynamic-alloc -GLOBAL_ATEXIT:newlib-global-atexit -LITE_EXIT:lite-exit -MULTITHREAD:newlib-multithread -RETARGETABLE_LOCKING:newlib-retargetable-locking " for ynarg in $yn_args; do @@ -48,6 +42,24 @@ RETARGETABLE_LOCKING:newlib-retargetable-locking fi done + # Check how picolibc wants threading support to be specified + + if grep -q single-thread "${CT_SRC_DIR}/picolibc/meson_options.txt"; then + if [ "${CT_LIBC_PICOLIBC_MULTITHREAD}" = "y" ]; then + picolibc_opts+=("-Dsingle-thread=false") + else + picolibc_opts+=("-Dsingle-thread=true") + fi + else + if [ "${CT_LIBC_PICOLIBC_MULTITHREAD}" = "y" ]; then + picolibc_opts+=("-Dnewlib-retargetable-locking=true") + picolibc_opts+=("-Dnewlib-multithread=true") + else + picolibc_opts+=("-Dnewlib-retargetable-locking=false") + picolibc_opts+=("-Dnewlib-multithread=false") + fi + fi + [ "${CT_LIBC_PICOLIBC_EXTRA_SECTIONS}" = "y" ] && \ CT_LIBC_PICOLIBC_TARGET_CFLAGS="${CT_LIBC_PICOLIBC_TARGET_CFLAGS} -ffunction-sections -fdata-sections" |