From a4a88e441f989942400dac8ac9b7f7e1a8f83b22 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Fri, 28 Jan 2022 18:31:23 -0700 Subject: [PATCH] glibc patch: version-gate _DYNAMIC_STACK_SIZE_SOURCE 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. --- lib/libc/include/generic-glibc/features.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/libc/include/generic-glibc/features.h b/lib/libc/include/generic-glibc/features.h index cd3a32da86..f9cd858396 100644 --- a/lib/libc/include/generic-glibc/features.h +++ b/lib/libc/include/generic-glibc/features.h @@ -222,8 +222,13 @@ # define _DEFAULT_SOURCE 1 # undef _ATFILE_SOURCE # define _ATFILE_SOURCE 1 + +/* Zig patch */ +# if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 34) || __GLIBC__ > 2 # undef _DYNAMIC_STACK_SIZE_SOURCE # define _DYNAMIC_STACK_SIZE_SOURCE 1 +# endif + #endif /* If nothing (other than _GNU_SOURCE and _DEFAULT_SOURCE) is defined,