Start mass upgrade
[dragora.git] / patches / gcc / 0008-Disable-ssp-on-nostdlib-nodefaultlibs-and-ffreestand.patch
blobb0952ddf320a54fde2d7d50a4a043287e7b2c575
1 From cfa0c7a3154415fe0e0ab6bd373a8f2164024ff5 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.
7 ---
8 gcc/gcc.c | 8 +++++++-
9 gcc/params.opt | 2 +-
10 2 files changed, 8 insertions(+), 2 deletions(-)
12 diff --git a/gcc/gcc.c b/gcc/gcc.c
13 index 7aec9d3a016..daeb4d0c8ea 100644
14 --- a/gcc/gcc.c
15 +++ b/gcc/gcc.c
16 @@ -886,6 +886,12 @@ proper position among the other output files. */
17 #define LINK_GCC_C_SEQUENCE_SPEC "%G %{!nolibc:%L %G}"
18 #endif
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
26 #ifndef LINK_SSP_SPEC
27 #ifdef TARGET_LIBC_PROVIDES_SSP
28 #define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
29 @@ -1170,7 +1176,7 @@ static const char *cc1_options =
30 %{-version:--version}\
31 %{-help=*:--help=%*}\
32 %{!fsyntax-only:%{S:%W{o*}%{!o*:-o %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 4aec480798b..eaecfab37ad 100644
40 --- a/gcc/params.opt
41 +++ b/gcc/params.opt
42 @@ -853,7 +853,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.
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.
50 -param=stack-clash-protection-guard-size=
51 --
52 2.29.2