You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using -target with gnu as the C ABI, the default -std flag used by clang++ is -std=gnu++14. This sets the _GNU_SOURCE preprocessor definition. In turn, this causes:
/* If _GNU_SOURCE was defined by the user, turn on all the other features. */
#ifdef _GNU_SOURCE
# undef _ISOC95_SOURCE
# define_ISOC95_SOURCE1
# undef _ISOC99_SOURCE
# define_ISOC99_SOURCE1
# undef _ISOC11_SOURCE
# define_ISOC11_SOURCE1
# undef _ISOC2X_SOURCE
# define_ISOC2X_SOURCE1
# undef _POSIX_SOURCE
# define_POSIX_SOURCE1
# undef _POSIX_C_SOURCE
# define_POSIX_C_SOURCE200809L
# undef _XOPEN_SOURCE
# define_XOPEN_SOURCE700
# undef _XOPEN_SOURCE_EXTENDED
# define_XOPEN_SOURCE_EXTENDED1
# undef _LARGEFILE64_SOURCE
# define_LARGEFILE64_SOURCE1
# undef _DEFAULT_SOURCE
# define_DEFAULT_SOURCE1
# undef _ATFILE_SOURCE
# define_ATFILE_SOURCE1
# undef _DYNAMIC_STACK_SIZE_SOURCE
# define_DYNAMIC_STACK_SIZE_SOURCE1
#endif
Emphasis on _DYNAMIC_STACK_SIZE_SOURCE. This gets used like this:
#if defined __USE_DYNAMIC_STACK_SIZE && __USE_DYNAMIC_STACK_SIZE
# include<unistd.h>/* Default stack size for a signal handler: sysconf (SC_SIGSTKSZ). */
# undef SIGSTKSZ
# defineSIGSTKSZsysconf (_SC_SIGSTKSZ)
/* Minimum stack size for a signal handler: SIGSTKSZ. */
# undef MINSIGSTKSZ
# defineMINSIGSTKSZ SIGSTKSZ
#endif
So turns out MINSIGSTKSZ actually ends up being a call to sysconf which is apparently returning -1 (error) for some reason.
This is a patch to glibc features.h which makes
_DYNAMIC_STACK_SIZE_SOURCE undefined unless the version is >= 2.34.
This feature was introduced with glibc 2.34 and without this patch, code
built against these headers but then run on an older glibc will end up
making a call to sysconf() that returns -1 for the value of SIGSTKSZ
and MINSIGSTKSZ.
Closes#10713
Zig Version
0.10.0-dev.445+d7deffee8
Steps to Reproduce
Expected Behavior
Expected the same result (2048) for musl and glibc, and expected the same result (2048) for C++ and C.
Actual Behavior
When compiling C++ code with glibc, MINSIGSTKSZ has incorrect value of
-1
.The text was updated successfully, but these errors were encountered: