libsoup3: update to 3.6.0; fix GTK2/3 app startup
[oi-userland.git] / components / developer / gcc-10 / patches / 0033-Use-the-illumos-libc-SSP-implementation-for-fstack-p.patch
blobb3b1b69434a1e4babe62950c1f4f99727b2ece84
1 From 5f8d25c979324d0dc3c1d38d3d2f3e42fdbd5792 Mon Sep 17 00:00:00 2001
2 From: Andy Fiddaman <omnios@citrus-it.co.uk>
3 Date: Wed, 4 Nov 2020 16:16:25 +0000
4 Subject: [PATCH 33/34] Use the illumos libc SSP implementation for
5 -fstack-protector
7 ---
8 gcc/config/i386/sol2.h | 17 +++++++++++++++++
9 gcc/configure | 2 +-
10 gcc/configure.ac | 2 +-
11 3 files changed, 19 insertions(+), 2 deletions(-)
13 diff --git a/gcc/config/i386/sol2.h b/gcc/config/i386/sol2.h
14 index c288d440dee..4e2cea44d43 100644
15 --- a/gcc/config/i386/sol2.h
16 +++ b/gcc/config/i386/sol2.h
17 @@ -252,3 +252,20 @@ along with GCC; see the file COPYING3. If not see
18 /* We do not need NT_VERSION notes. */
19 #undef X86_FILE_START_VERSION_DIRECTIVE
20 #define X86_FILE_START_VERSION_DIRECTIVE false
22 +/*
23 + * As of 5788, the illumos libc includes support for the stack protector
24 + * __stack_chk_fail() function and for the __stack_chk_guard variable.
25 + * That means that, for most cases, no extra objects need to be linked in
26 + * when compiling with one of the -fstack-protector options.
27 + * However, for 32-bit PIC/PIE objects, the gcc stack protector emits a
28 + * function call to __stack_chk_fail_local(); this symbol is provided in
29 + * illumos via the libssp_ns.a object. The spec below includes this in the
30 + * link when appropriate.
31 + */
32 +#if defined(TARGET_LIBC_PROVIDES_SSP)
33 +#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all|" \
34 + "fstack-protector-strong|fstack-protector-explicit:" \
35 + DEF_ARCH32_SPEC("-lssp_ns") \
36 + "}"
37 +#endif
38 diff --git a/gcc/configure b/gcc/configure
39 index c20dfc771ea..06ccb0d1ab3 100755
40 --- a/gcc/configure
41 +++ b/gcc/configure
42 @@ -29780,7 +29780,7 @@ fi
43 # realistically usable GNU/Hurd configurations.
44 # All supported versions of musl provide it as well
45 gcc_cv_libc_provides_ssp=yes;;
46 - *-*-darwin* | *-*-freebsd* | *-*-netbsd*)
47 + *-*-darwin* | *-*-freebsd* | *-*-netbsd* | *-*-solaris2*)
48 ac_fn_cxx_check_func "$LINENO" "__stack_chk_fail" "ac_cv_func___stack_chk_fail"
49 if test "x$ac_cv_func___stack_chk_fail" = xyes; then :
50 gcc_cv_libc_provides_ssp=yes
51 diff --git a/gcc/configure.ac b/gcc/configure.ac
52 index ddbab71370d..2968c276172 100644
53 --- a/gcc/configure.ac
54 +++ b/gcc/configure.ac
55 @@ -6173,7 +6173,7 @@ AC_CACHE_CHECK(__stack_chk_fail in target C library,
56 # realistically usable GNU/Hurd configurations.
57 # All supported versions of musl provide it as well
58 gcc_cv_libc_provides_ssp=yes;;
59 - *-*-darwin* | *-*-freebsd* | *-*-netbsd*)
60 + *-*-darwin* | *-*-freebsd* | *-*-netbsd* | *-*-solaris2*)
61 AC_CHECK_FUNC(__stack_chk_fail,[gcc_cv_libc_provides_ssp=yes],
62 [echo "no __stack_chk_fail on this target"])
64 --
65 2.31.1