aboutsummaryrefslogtreecommitdiff
path: root/scripts/build
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2025-04-21 11:05:40 -0700
committerChris Packham <judge.packham@gmail.com>2025-04-26 15:06:15 +1200
commit2fb4cf18d13fdf9b694f1ff01245b559a5447c8d (patch)
tree57be5fd594052217338ecdef6f5ff7ae0aac96a9 /scripts/build
parent63765c98c0c267e1cc87612ea7373e13113396d9 (diff)
downloadcrosstool-ng-2fb4cf18d13fdf9b694f1ff01245b559a5447c8d.tar.gz
crosstool-ng-2fb4cf18d13fdf9b694f1ff01245b559a5447c8d.tar.bz2
crosstool-ng-2fb4cf18d13fdf9b694f1ff01245b559a5447c8d.zip
companion_libs: Make picolibc build compatible with 1.8.10
Picolibc 1.8.10 reworked the configuration option for single/multi thread support and removed some unused options for exit handler support. Map LIBC_PICOLIBC_MULTITHREAD to the new single-thread option or the old newlib-retargetable-locking+newlib-multithread options depending on whether the picolibc version knows about the single-thread option. Remove support for newlib-register-fini, newlib-atexit-dynamic-alloc, newlib-global-atexit and lite-exit options as all of those relate to the legacy exit handler code. There hasn't ever been any way to enable this using crosstool-ng, so none of these options have ever done anything. The help strings for each of of the unused configuration variables have been updated. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'scripts/build')
-rw-r--r--scripts/build/companion_libs/340-picolibc.sh24
1 files changed, 18 insertions, 6 deletions
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"