Skip to content

Commit

Permalink
glibc: version-gate _DYNAMIC_STACK_SIZE_SOURCE
Browse files Browse the repository at this point in the history
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
  • Loading branch information
andrewrk committed Jan 29, 2022
1 parent cd5b25c commit 39083c3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/libc/include/generic-glibc/features.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,12 @@
# define _DEFAULT_SOURCE 1
# undef _ATFILE_SOURCE
# define _ATFILE_SOURCE 1

# 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,
Expand Down Expand Up @@ -512,4 +516,4 @@
#include <gnu/stubs.h>


#endif /* features.h */
#endif /* features.h */

1 comment on commit 39083c3

@rofrol
Copy link
Contributor

@rofrol rofrol commented on 39083c3 Feb 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from upstream comment:

new headers may rely on new symbols, behaviours and abi that
did not exist in an old glibc.

the only way multiple glibc versions are supported at runtime
is to compile against old glibc and run the binary against a
newer one. not the other way around.

and you cannot detect at compile time what will be the glibc
version at runtime, so version checking does not help.
what problem are you solving by passing GLIBC_MINOR at
compile time?

Please sign in to comment.