libssp-musl.patch (2728B)
1First part taken from Alpine. 2 3Second part added to prevent gccgo from thinking it can -fsplit-stack on musl. 4 5--- gcc/gcc.c 6+++ gcc/gcc.c 7@@ -874,10 +874,15 @@ proper position among the other output files. */ 8 #define LINK_GCC_C_SEQUENCE_SPEC "%G %{!nolibc:%L %G}" 9 #endif 10 11+#ifdef ENABLE_DEFAULT_SSP 12+#define NO_SSP_SPEC "%{nostdlib|nodefaultlibs|ffreestanding:-fno-stack-protector} " 13+#else 14+#define NO_SSP_SPEC "" 15+#endif 16+ 17 #ifndef LINK_SSP_SPEC 18 #ifdef TARGET_LIBC_PROVIDES_SSP 19-#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \ 20- "|fstack-protector-strong|fstack-protector-explicit:}" 21+#define LINK_SSP_SPEC "-lssp_nonshared" 22 #else 23 #define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \ 24 "|fstack-protector-strong|fstack-protector-explicit" \ 25@@ -1155,7 +1160,7 @@ static const char *cc1_options = 26 %{-version:--version}\ 27 %{-help=*:--help=%*}\ 28 %{!fsyntax-only:%{S:%W{o*}%{!o*:-o %b.s}}}\ 29- %{fsyntax-only:-o %j} %{-param*}\ 30+ %{fsyntax-only:-o %j} %{-param*} " NO_SSP_SPEC "\ 31 %{coverage:-fprofile-arcs -ftest-coverage}\ 32 %{fprofile-arcs|fprofile-generate*|coverage:\ 33 %{!fprofile-update=single:\ 34--- gcc/params.opt 35+++ gcc/params.opt 36@@ -853,7 +853,7 @@ Common Joined UInteger Var(param_ssa_name_def_chain_limit) Init(512) Param Optim 37 The maximum number of SSA_NAME assignments to follow in determining a value. 38 39 -param=ssp-buffer-size= 40-Common Joined UInteger Var(param_ssp_buffer_size) Init(8) IntegerRange(1, 65536) Param Optimization 41+Common Joined UInteger Var(param_ssp_buffer_size) Init(4) IntegerRange(1, 65536) Param Optimization 42 The lower bound for a buffer to be considered for stack smashing protection. 43 44 -param=stack-clash-protection-guard-size= 45--- gcc/config/i386/gnu-user-common.h 46+++ gcc/config/i386/gnu-user-common.h 47@@ -64,9 +64,3 @@ along with GCC; see the file COPYING3. If not see 48 49 /* Static stack checking is supported by means of probes. */ 50 #define STACK_CHECK_STATIC_BUILTIN 1 51- 52-/* We only build the -fsplit-stack support in libgcc if the 53- assembler has full support for the CFI directives. */ 54-#if HAVE_GAS_CFI_PERSONALITY_DIRECTIVE 55-#define TARGET_CAN_SPLIT_STACK 56-#endif 57--- gcc/config/i386/gnu.h 58+++ gcc/config/i386/gnu.h 59@@ -40,11 +40,6 @@ along with GCC. If not, see <http://www.gnu.org/licenses/>. 60 /* i386 glibc provides __stack_chk_guard in %gs:0x14. */ 61 #define TARGET_THREAD_SSP_OFFSET 0x14 62 63-/* We only build the -fsplit-stack support in libgcc if the 64- assembler has full support for the CFI directives. */ 65-#if HAVE_GAS_CFI_PERSONALITY_DIRECTIVE 66-#define TARGET_CAN_SPLIT_STACK 67-#endif 68 /* We steal the last transactional memory word. */ 69 #define TARGET_THREAD_SPLIT_STACK_OFFSET 0x30 70 #endif