Allow to build with stack protection support
This commit is contained in:
+14
-1
@@ -12,11 +12,12 @@ version_info = {
|
||||
|
||||
AddOption('--build_type',
|
||||
dest = 'build_type',
|
||||
type = 'string',
|
||||
type = 'choice',
|
||||
nargs = 1,
|
||||
action='store',
|
||||
default='debug',
|
||||
metavar='TYPE',
|
||||
choices = ['debug', 'release'],
|
||||
help = 'debug|release - Build a Debug (default) or Release variant'
|
||||
)
|
||||
AddOption('--prefix',
|
||||
@@ -35,6 +36,13 @@ AddOption('--test_xml',
|
||||
help='Create a result.xml when running the testsuite'
|
||||
)
|
||||
|
||||
AddOption('--stack-protection',
|
||||
dest = 'stack_protection',
|
||||
action='store_true',
|
||||
default=False,
|
||||
help = 'Build with stack protection support'
|
||||
)
|
||||
|
||||
|
||||
build_type = GetOption('build_type')
|
||||
test_xml = GetOption('test_xml')
|
||||
@@ -68,6 +76,11 @@ if build_type == 'release':
|
||||
elif build_type == 'debug':
|
||||
env.Append(CPPDEFINES = ['DEBUG'])
|
||||
|
||||
if GetOption('stack_protection'):
|
||||
env.Append(CFLAGS = ['-fstack-protector', '--param=ssp-buffer-size=4'])
|
||||
env.Append(CPPDEFINES = ['_FORTIFY_SOURCE=2'])
|
||||
|
||||
|
||||
#put all .sconsign files in one place
|
||||
env.SConsignFile()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user