toolchain: gcc: improve patch handling by introducing major version
[openwrt/openwrt.git] / toolchain / gcc / patches-11.x / 011-v12-configure-define-TARGET_LIBC_GNUSTACK-on-musl.patch
1 From ea650cae26da4a8fc04f0c4666f4dd776d0b5fc0 Mon Sep 17 00:00:00 2001
2 From: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
3 Date: Sun, 14 Nov 2021 21:54:25 -0800
4 Subject: [PATCH] configure: define TARGET_LIBC_GNUSTACK on musl
5
6 musl only uses PT_GNU_STACK to set default thread stack size and has no
7 executable stack support[0], so there is no reason not to emit the
8 .note.GNU-stack section on musl builds.
9
10 [0]: https://lore.kernel.org/all/20190423192534.GN23599@brightrain.aerifal.cx/T/#u
11
12 gcc/ChangeLog:
13
14 * configure: Regenerate.
15 * configure.ac: define TARGET_LIBC_GNUSTACK on musl
16
17 Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
18 ---
19 gcc/configure | 3 +++
20 gcc/configure.ac | 3 +++
21 2 files changed, 6 insertions(+)
22
23 --- a/gcc/configure
24 +++ b/gcc/configure
25 @@ -31533,6 +31533,9 @@ fi
26 # Check if the target LIBC handles PT_GNU_STACK.
27 gcc_cv_libc_gnustack=unknown
28 case "$target" in
29 + mips*-*-linux-musl*)
30 + gcc_cv_libc_gnustack=yes
31 + ;;
32 mips*-*-linux*)
33
34 if test $glibc_version_major -gt 2 \
35 --- a/gcc/configure.ac
36 +++ b/gcc/configure.ac
37 @@ -7023,6 +7023,9 @@ fi
38 # Check if the target LIBC handles PT_GNU_STACK.
39 gcc_cv_libc_gnustack=unknown
40 case "$target" in
41 + mips*-*-linux-musl*)
42 + gcc_cv_libc_gnustack=yes
43 + ;;
44 mips*-*-linux*)
45 GCC_GLIBC_VERSION_GTE_IFELSE([2], [31], [gcc_cv_libc_gnustack=yes], )
46 ;;