summaryrefslogtreecommitdiff
path: root/buildtools
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2018-09-03 10:49:52 +0200
committerKarolin Seeger <kseeger@samba.org>2018-09-26 15:55:52 +0200
commit29883c7bcbdc742bf22d6205543321f57200a20e (patch)
tree40ade35d393ad34207e8c6ec2058a8570da37ce4 /buildtools
parent7249a4e54b290bb2d3081d2cbcee3ebcd6f198a9 (diff)
downloadsamba-29883c7bcbdc742bf22d6205543321f57200a20e.tar.gz
waf: Add -fstack-clash-protection
https://developers.redhat.com/blog/2018/03/21/compiler-and-linker-flags-gcc/ BUG: https://bugzilla.samba.org/show_bug.cgi?id=13601 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> (cherry picked from commit fc4df251c88365142515a81bea1120b2b84cc4a0) Autobuild-User(v4-9-test): Karolin Seeger <kseeger@samba.org> Autobuild-Date(v4-9-test): Wed Sep 26 15:55:52 CEST 2018 on sn-devel-144
Diffstat (limited to 'buildtools')
-rw-r--r--buildtools/wafsamba/samba_autoconf.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/buildtools/wafsamba/samba_autoconf.py b/buildtools/wafsamba/samba_autoconf.py
index bfd6f9710db..f2b3ec8db8d 100644
--- a/buildtools/wafsamba/samba_autoconf.py
+++ b/buildtools/wafsamba/samba_autoconf.py
@@ -694,6 +694,23 @@ def SAMBA_CONFIG_H(conf, path=None):
conf.ADD_CFLAGS('-Wp,-D_FORTIFY_SOURCE=2 %s' % (stack_protect_flag))
break
+ flag_supported = conf.check(fragment='''
+ #include <stdio.h>
+
+ int main(void)
+ {
+ char t[100000];
+ while (fgets(t, sizeof(t), stdin));
+ return 0;
+ }
+ ''',
+ execute=0,
+ ccflags=[ '-Werror', '-fstack-clash-protection'],
+ mandatory=False,
+ msg='Checking if compiler accepts -fstack-clash-protection')
+ if flag_supported:
+ conf.ADD_CFLAGS('-fstack-clash-protection')
+
if Options.options.debug:
conf.ADD_CFLAGS('-g', testflags=True)