From f2d16be53356bd03aa9cd4396018c9bb982c77f3 Mon Sep 17 00:00:00 2001 From: Chris Friedt Date: Sun, 15 Sep 2024 09:56:55 -0400 Subject: [PATCH] configs: common: enable c++11 thread support via c11 threads Add support for ISO C++11 threads, mutexes, condition variables, semaphores, locks, scoped locks, synchronized streams, and futures (async programming) via ISO C11 threads. Signed-off-by: Christopher Friedt --- configs/aarch64-zephyr-elf.config | 2 +- configs/common.config | 5 ++++- configs/x86_64-zephyr-elf.config | 2 +- gcc | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/configs/aarch64-zephyr-elf.config b/configs/aarch64-zephyr-elf.config index c459c2b4..3e071836 100644 --- a/configs/aarch64-zephyr-elf.config +++ b/configs/aarch64-zephyr-elf.config @@ -5,4 +5,4 @@ CT_ARCH_64=y CT_TARGET_VENDOR="zephyr" CT_TARGET_CFLAGS="-moverride=tune=no_ldp_stp_qregs -ftls-model=local-exec" CT_MULTILIB=y -CT_GDB_CROSS_EXTRA_CONFIG_ARRAY="--enable-targets=arm-zephyr-eabi" +CT_GDB_CROSS_EXTRA_CONFIG_ARRAY="--enable-targets=arm-zephyr-eabi --enable-threads=c11 --enable-libstdcxx-time=c11 --enable-libstdcxx-threads" diff --git a/configs/common.config b/configs/common.config index 9c317655..17df7510 100644 --- a/configs/common.config +++ b/configs/common.config @@ -15,8 +15,11 @@ CT_GDB_CUSTOM_LOCATION="${GITHUB_WORKSPACE}/gdb" # GCC CT_GCC_SRC_CUSTOM=y CT_GCC_CUSTOM_LOCATION="${GITHUB_WORKSPACE}/gcc" -CT_CC_GCC_EXTRA_CONFIG_ARRAY="--with-gnu-ld --with-gnu-as --enable-initfini-array" +# NOTE: --enable-threads=c11 is still necessary here to override the value inherited by +# build/cc/gcc.sh with baremetal "mode" +CT_CC_GCC_EXTRA_CONFIG_ARRAY="--with-gnu-ld --with-gnu-as --enable-initfini-array --enable-threads=c11 --enable-libstdcxx-time=c11 --enable-libstdcxx-threads" CT_CC_LANG_CXX=y +CT_THREADS_C11=y # Newlib CT_NEWLIB_SRC_CUSTOM=y diff --git a/configs/x86_64-zephyr-elf.config b/configs/x86_64-zephyr-elf.config index f3a90cf8..be431dba 100644 --- a/configs/x86_64-zephyr-elf.config +++ b/configs/x86_64-zephyr-elf.config @@ -6,4 +6,4 @@ CT_TARGET_VENDOR="zephyr" CT_TARGET_CFLAGS="-ftls-model=local-exec" CT_MULTILIB=y CT_BINUTILS_EXTRA_CONFIG_ARRAY="--enable-targets=x86_64-pep" -CT_CC_GCC_EXTRA_CONFIG_ARRAY="--with-gnu-ld --with-gnu-as --enable-initfini-array --with-cpu-32=i586 --with-arch-32=i586 --with-cpu-64=generic --with-arch-64=x86-64" +CT_CC_GCC_EXTRA_CONFIG_ARRAY="--with-gnu-ld --with-gnu-as --enable-initfini-array --with-cpu-32=i586 --with-arch-32=i586 --with-cpu-64=generic --with-arch-64=x86-64 --enable-threads=c11 --enable-libstdcxx-time=c11 --enable-libstdcxx-threads" diff --git a/gcc b/gcc index f141243a..00a6f7c4 160000 --- a/gcc +++ b/gcc @@ -1 +1 @@ -Subproject commit f141243aeca7396400b4123438b3975d947bdcf2 +Subproject commit 00a6f7c4db779532036923a99a4661f5468bcc8f