Skip to content

Commit

Permalink
SERVER-24117 Force the stack to always be non-executable
Browse files Browse the repository at this point in the history
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.

(cherry picked from commit 23c5d7e)
  • Loading branch information
acmorrow authored and ramonfm committed May 16, 2016
1 parent 9f138ef commit 61965e5
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -2122,6 +2122,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'):
Expand Down

0 comments on commit 61965e5

Please sign in to comment.