summaryrefslogtreecommitdiff
path: root/SConstruct
diff options
context:
space:
mode:
authorAndrew Morrow <acm@mongodb.com>2021-02-20 17:00:21 -0500
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-02-24 23:10:12 +0000
commit0f9be3ce08bf8adaddf6098eb019d46942661e2b (patch)
treef83bbf9181132f9c868736c34f9eaa281dfe1d88 /SConstruct
parent6286ed49154196a02febfe584927bcdd2042f8da (diff)
downloadmongo-0f9be3ce08bf8adaddf6098eb019d46942661e2b.tar.gz
SERVER-54682 Implement a command line framework for optimization and hardening flag experiments
Diffstat (limited to 'SConstruct')
-rw-r--r--SConstruct50
1 files changed, 50 insertions, 0 deletions
diff --git a/SConstruct b/SConstruct
index 533d10f310a..da8066af57e 100644
--- a/SConstruct
+++ b/SConstruct
@@ -272,6 +272,21 @@ add_option('opt',
type='choice',
)
+experimental_optimizations = []
+experimental_optimization_choices = ['*']
+experimental_optimization_choices.extend("+" + opt for opt in experimental_optimizations)
+experimental_optimization_choices.extend("-" + opt for opt in experimental_optimizations)
+
+add_option('experimental-optimization',
+ action="append",
+ choices=experimental_optimization_choices,
+ const=experimental_optimization_choices[0],
+ default=[],
+ help='Enable experimental optimizations',
+ nargs='?',
+ type='choice'
+)
+
add_option('debug-compress',
action="append",
choices=["off", "as", "ld"],
@@ -503,6 +518,21 @@ add_option('runtime-hardening',
type='choice',
)
+experimental_runtime_hardenings = []
+experimental_runtime_hardening_choices = ['*']
+experimental_runtime_hardening_choices.extend("+" + opt for opt in experimental_runtime_hardenings)
+experimental_runtime_hardening_choices.extend("-" + opt for opt in experimental_runtime_hardenings)
+
+add_option('experimental-runtime-hardening',
+ action="append",
+ choices=experimental_runtime_hardening_choices,
+ const=experimental_runtime_hardening_choices[0],
+ default=[],
+ help='Enable experimental runtime hardenings',
+ nargs='?',
+ type='choice'
+)
+
add_option('use-hardware-crc32',
choices=["on", "off"],
default="on",
@@ -2067,6 +2097,26 @@ if debugBuild:
else:
env.AppendUnique( CPPDEFINES=[ 'NDEBUG' ] )
+
+# Normalize our experimental optimiation and hardening flags
+selected_experimental_optimizations = set()
+for suboption in get_option('experimental-optimization'):
+ if suboption == "*":
+ selected_experimental_optimizations.update(experimental_optimizations)
+ elif suboption.startswith('-'):
+ selected_experimental_optimizations.discard(suboption[1:])
+ elif suboption.startswith('+'):
+ selected_experimental_optimizations.add(suboption[1:])
+
+selected_experimental_runtime_hardenings = set()
+for suboption in get_option('experimental-runtime-hardening'):
+ if suboption == "*":
+ selected_experimental_runtime_hardenings.update(experimental_runtime_hardenings)
+ elif suboption.startswith('-'):
+ selected_experimental_runtime_hardenings.discard(suboption[1:])
+ elif suboption.startswith('+'):
+ selected_experimental_runtime_hardenings.add(suboption[1:])
+
if env.TargetOSIs('linux'):
env.Append( LIBS=["m"] )
if not env.TargetOSIs('android'):