summaryrefslogtreecommitdiff
path: root/SConstruct
diff options
context:
space:
mode:
authorAndrew Morrow <acm@mongodb.com>2016-05-10 10:43:25 -0400
committerAndrew Morrow <acm@mongodb.com>2016-05-10 14:02:33 -0400
commit23c5d7e44c5447769a46e6d4e10ae6237e8de5fd (patch)
treee642aae87f91f0710629cf45f9f360ce96205d4f /SConstruct
parent9e29541c86ee52c459e3c7090291ff029dfc6889 (diff)
downloadmongo-23c5d7e44c5447769a46e6d4e10ae6237e8de5fd.tar.gz
SERVER-24117 Force the stack to always be non-executable
Also, warn if the stack would have been executable if we hadn't forced it not to be, so we can find and correct broken assmbley source files.
Diffstat (limited to 'SConstruct')
-rw-r--r--SConstruct11
1 files changed, 11 insertions, 0 deletions
diff --git a/SConstruct b/SConstruct
index 791cbf6efbe..6c4948068c0 100644
--- a/SConstruct
+++ b/SConstruct
@@ -2166,6 +2166,17 @@ def doConfigure(myenv):
if myenv.ToolchainIs('gcc', 'clang'):
AddToLINKFLAGSIfSupported(myenv, '-fuse-ld=gold')
+ # Disallow an executable stack. Also, issue a warning if any files are found that would
+ # cause the stack to become executable if the noexecstack flag was not in play, so that we
+ # can find them and fix them. We do this here after we check for ld.gold because the
+ # --warn-execstack is currently only offered with gold.
+ #
+ # TODO: Add -Wl,--fatal-warnings once WT-2629 is fixed. We probably can do that
+ # unconditionally above, and not need to do it as an AddToLINKFLAGSIfSupported step, since
+ # both gold and binutils ld both support it.
+ AddToLINKFLAGSIfSupported(myenv, "-Wl,-z,noexecstack")
+ AddToLINKFLAGSIfSupported(myenv, "-Wl,--warn-execstack")
+
# Apply any link time optimization settings as selected by the 'lto' option.
if has_option('lto'):
if myenv.ToolchainIs('msvc'):