Patchwork [10/14] Enable -fstack-protector=* when requested by configure.

login
register
mail settings
Submitter Nix
Date Feb. 23, 2016, 11:39 p.m.
Message ID <1456270777-9083-11-git-send-email-nix@esperi.org.uk>
Download mbox | patch
Permalink /patch/11024/
State New
Headers show

Comments

Nix - Feb. 23, 2016, 11:39 p.m.
From: Nick Alcock <nick.alcock@oracle.com>

This finally turns on all the machinery added in previous commits.
---
 Makeconfig | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
Andreas Schwab - Feb. 24, 2016, 9:39 a.m.
Nix <nix@esperi.org.uk> writes:

> -+cflags += $(cflags-cpu) $(+gccwarn) $(+merge-constants) $(+math-flags)
> ++cflags += $(cflags-cpu) $(+gccwarn) $(+merge-constants) $(+math-flags) $(+stack-protector)

Please fold long lines.

Andreas.
Nix - Feb. 24, 2016, 1:09 p.m.
On 24 Feb 2016, Andreas Schwab stated:

> Nix <nix@esperi.org.uk> writes:
>
>> -+cflags += $(cflags-cpu) $(+gccwarn) $(+merge-constants) $(+math-flags)
>> ++cflags += $(cflags-cpu) $(+gccwarn) $(+merge-constants) $(+math-flags) $(+stack-protector)
>
> Please fold long lines.

I wasn't sure it was syntactically valid here (as in the bit of
configure.ac with a long line). Clearly I was missing the nose on my
face: glibc folds += lines *all the time*. Will fix.

Patch

diff --git a/Makeconfig b/Makeconfig
index 87a22e8..cdffdc7 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -762,6 +762,11 @@  endif
 # disable any optimization that assume default rounding mode.
 +math-flags = -frounding-math
 
+# We might want to compile with some stack-protection flag.
+ifneq ($(stack-protector),)
++stack-protector=$(stack-protector)
+endif
+
 # This is the program that generates makefile dependencies from C source files.
 # The -MP flag tells GCC >= 3.2 (which we now require) to produce dummy
 # targets for headers so that removed headers don't break the build.
@@ -821,7 +826,7 @@  ifeq	"$(strip $(+cflags))" ""
 +cflags	:= $(default_cflags)
 endif	# $(+cflags) == ""
 
-+cflags += $(cflags-cpu) $(+gccwarn) $(+merge-constants) $(+math-flags)
++cflags += $(cflags-cpu) $(+gccwarn) $(+merge-constants) $(+math-flags) $(+stack-protector)
 +gcc-nowarn := -w
 
 # Don't duplicate options if we inherited variables from the parent.