0008-Disable-ssp-on-nostdlib-nodefaultlibs-and-ffreestand.patch (1913B)
1 From 27e5d5bd3fed9006a2958d2b09750d15ad07383b Mon Sep 17 00:00:00 2001 2 From: Ariadne Conill <ariadne@dereferenced.org> 3 Date: Fri, 21 Aug 2020 06:49:40 +0000 4 Subject: [PATCH] Disable ssp on -nostdlib, -nodefaultlibs and -ffreestanding 5 Change the buffer size. 6 7 --- 8 gcc/gcc.cc | 8 +++++++- 9 gcc/params.opt | 2 +- 10 2 files changed, 8 insertions(+), 2 deletions(-) 11 12 diff --git a/gcc/gcc.cc b/gcc/gcc.cc 13 index 3b76311b544..cc99d0b7aa1 100644 14 --- a/gcc/gcc.cc 15 +++ b/gcc/gcc.cc 16 @@ -996,6 +996,12 @@ proper position among the other output files. */ 17 #define LINK_GCC_C_SEQUENCE_SPEC "%G %{!nolibc:%L %G}" 18 #endif 19 20 +#ifdef ENABLE_DEFAULT_SSP 21 +#define NO_SSP_SPEC "%{nostdlib|nodefaultlibs|ffreestanding:-fno-stack-protector} " 22 +#else 23 +#define NO_SSP_SPEC "" 24 +#endif 25 + 26 #ifndef LINK_SSP_SPEC 27 #ifdef TARGET_LIBC_PROVIDES_SSP 28 #define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \ 29 @@ -1295,7 +1301,7 @@ static const char *cc1_options = 30 %{-version:--version}\ 31 %{-help=*:--help=%*}\ 32 %{!fsyntax-only:%{S:%W{o*}%{!o*:-o %w%b.s}}}\ 33 - %{fsyntax-only:-o %j} %{-param*}\ 34 + %{fsyntax-only:-o %j} %{-param*} " NO_SSP_SPEC "\ 35 %{coverage:-fprofile-arcs -ftest-coverage}\ 36 %{fprofile-arcs|fprofile-generate*|coverage:\ 37 %{!fprofile-update=single:\ 38 diff --git a/gcc/params.opt b/gcc/params.opt 39 index b88e1372005..82a7e25dd2f 100644 40 --- a/gcc/params.opt 41 +++ b/gcc/params.opt 42 @@ -1012,7 +1012,7 @@ Common Joined UInteger Var(param_ssa_name_def_chain_limit) Init(512) Param Optim 43 The maximum number of SSA_NAME assignments to follow in determining a value. 44 45 -param=ssp-buffer-size= 46 -Common Joined UInteger Var(param_ssp_buffer_size) Init(8) IntegerRange(1, 65536) Param Optimization 47 +Common Joined UInteger Var(param_ssp_buffer_size) Init(4) IntegerRange(1, 65536) Param Optimization 48 The lower bound for a buffer to be considered for stack smashing protection. 49 50 -param=stack-clash-protection-guard-size=