Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libc: add option for c11 threads #27

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions config/libc.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ config LIBC_SUPPORT_THREADS_POSIX
bool
select LIBC_SUPPORT_THREADS_ANY

config LIBC_SUPPORT_THREADS_C11
bool
select LIBC_SUPPORT_THREADS_ANY

config LIBC_SUPPORT_THREADS_NONE
bool

Expand All @@ -40,6 +44,7 @@ choice
default THREADS_NATIVE if LIBC_SUPPORT_THREADS_NATIVE
default THREADS_LT if LIBC_SUPPORT_THREADS_LT
default THREADS_POSIX if LIBC_SUPPORT_THREADS_POSIX
default THREADS_C11 if LIBC_SUPPORT_THREADS_C11
default THREADS_NONE

config THREADS_NATIVE
Expand All @@ -63,6 +68,11 @@ config THREADS_POSIX
prompt "posix"
depends on LIBC_SUPPORT_THREADS_POSIX

config THREADS_C11
bool
prompt "c11"
depends on LIBC_SUPPORT_THREADS_C11

config THREADS_NONE
bool
prompt "none"
Expand Down
4 changes: 4 additions & 0 deletions config/libc/newlib.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## depends on BARE_METAL
## select LIBC_PROVIDES_CXA_ATEXIT
## select LIBC_SUPPORT_THREADS_C11
## select LIBC_SUPPORT_THREADS_NONE
## select CC_CORE_NEEDED

Expand All @@ -12,6 +13,9 @@
## help array of processors, and will usually work on any architecture with
## help the addition of a few low-level routines.

config THREADS
default "c11" if THREADS_C11

config LIBC_NEWLIB_TARGET_CFLAGS
string
prompt "Target CFLAGS for newlib"
Expand Down
23 changes: 14 additions & 9 deletions scripts/build/cc/gcc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1073,16 +1073,21 @@ do_gcc_backend() {
extra_config+=("--with-host-libstdcxx=${host_libstdcxx_flags[*]}")
fi

if [ "${CT_THREADS}" = "none" ]; then
case "${CT_THREADS}" in
none)
extra_config+=("--disable-threads")
else
if [ "${CT_THREADS}" = "win32" ]; then
extra_config+=("--enable-threads=win32")
extra_config+=("--disable-win32-registry")
else
extra_config+=("--enable-threads=posix")
fi
fi
;;
win32)
extra_config+=("--enable-threads=win32")
extra_config+=("--disable-win32-registry")
;;
c11)
extra_config+=("--enable-threads=c11")
;;
*)
extra_config+=("--enable-threads=posix")
;;
esac

if [ "${CT_CC_GCC_ENABLE_TARGET_OPTSPACE}" = "y" ] || \
[ "${enable_optspace}" = "yes" ]; then
Expand Down