diff options
author | Andrew Morrow <acm@mongodb.com> | 2018-12-07 12:31:08 -0500 |
---|---|---|
committer | Andrew Morrow <acm@mongodb.com> | 2018-12-07 15:39:58 -0500 |
commit | 99ee8dc30a59c674738d8c36274cccfb540917f8 (patch) | |
tree | 13c2afefac0e818e58d864ec0ea9df04d7ef5ea2 /SConstruct | |
parent | 53d99b27f09b2d0162c44644cd8c9191a9879121 (diff) | |
download | mongo-99ee8dc30a59c674738d8c36274cccfb540917f8.tar.gz |
SERVER-38460 Let abseil know when sanitizers are active
Diffstat (limited to 'SConstruct')
-rw-r--r-- | SConstruct | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/SConstruct b/SConstruct index 33bfbcd0131..35b8af631ba 100644 --- a/SConstruct +++ b/SConstruct @@ -2674,11 +2674,17 @@ def doConfigure(myenv): myenv.FatalError("Using the leak sanitizer requires a valid symbolizer") if using_asan: - myenv.AppendUnique(CCFLAGS=['-DADDRESS_SANITIZER']) + # Unfortunately, abseil requires that we make these macros + # (this, and THREAD_ and UNDEFINED_BEHAVIOR_ below) set, + # because apparently it is too hard to query the running + # compiler. We do this unconditionally because abseil is + # basically pervasive via the 'base' library. + myenv.AppendUnique(CPPDEFINES=['ADDRESS_SANITIZER']) if using_tsan: tsan_options += "suppressions=\"%s\" " % myenv.File("#etc/tsan.suppressions").abspath myenv['ENV']['TSAN_OPTIONS'] = tsan_options + myenv.AppendUnique(CPPDEFINES=['THREAD_SANITIZER']) if using_ubsan: # By default, undefined behavior sanitizer doesn't stop on @@ -2686,6 +2692,7 @@ def doConfigure(myenv): # have renamed the flag. if not AddToCCFLAGSIfSupported(myenv, "-fno-sanitize-recover"): AddToCCFLAGSIfSupported(myenv, "-fno-sanitize-recover=undefined") + myenv.AppendUnique(CPPDEFINES=['UNDEFINED_BEHAVIOR_SANITIZER']) if myenv.ToolchainIs('msvc') and optBuild: # http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx |