etc: Enable a tty for a serial port by default.
[dragora.git] / patches / gcc / 0008-Disable-ssp-on-nostdlib-nodefaultlibs-and-ffreestand.patch
blobcfd18dcabc49176dc6b6fc10c99177390138624e
1 From 3503fd734a33b67ec6a9fdc2c52bb8310864b119 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 1ad5da6d769..99314032ec2 100644
14 --- a/gcc/gcc.c
15 +++ b/gcc/gcc.c
16 @@ -989,6 +989,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 @@ -1288,7 +1294,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 8ba281b4cfa..bab39cdf8a2 100644
40 --- a/gcc/params.opt
41 +++ b/gcc/params.opt
42 @@ -946,7 +946,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.35.1