diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-01-31 09:03:20 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-31 09:03:20 +0100 |
commit | fa7e2dd2ad77dbb75bad2ee82d0176c0d66c620c (patch) | |
tree | 18214257d5fb565ecba2574ef986b5d083a47af8 | |
parent | f356f4b74042f0a889e987dcb7cdb0d9597fd9e6 (diff) | |
parent | df4ea84e03b9d1f4397860c562084558a8f062f7 (diff) |
Merge pull request #35684 from timothyqiu/macos-sanitizers
Adds sanitizer options for macOS
-rw-r--r-- | platform/osx/detect.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/platform/osx/detect.py b/platform/osx/detect.py index 7882253e7a..fe839199e8 100644 --- a/platform/osx/detect.py +++ b/platform/osx/detect.py @@ -27,6 +27,9 @@ def get_opts(): ('MACOS_SDK_PATH', 'Path to the macOS SDK', ''), EnumVariable('debug_symbols', 'Add debugging symbols to release builds', 'yes', ('yes', 'no', 'full')), BoolVariable('separate_debug_symbols', 'Create a separate file containing debugging symbols', False), + BoolVariable('use_ubsan', 'Use LLVM/GCC compiler undefined behavior sanitizer (UBSAN)', False), + BoolVariable('use_asan', 'Use LLVM/GCC compiler address sanitizer (ASAN))', False), + BoolVariable('use_tsan', 'Use LLVM/GCC compiler thread sanitizer (TSAN))', False), ] @@ -122,6 +125,21 @@ def configure(env): env["CC"] = "clang" env["LINK"] = "clang++" + if env['use_ubsan'] or env['use_asan'] or env['use_tsan']: + env.extra_suffix += "s" + + if env['use_ubsan']: + env.Append(CCFLAGS=['-fsanitize=undefined']) + env.Append(LINKFLAGS=['-fsanitize=undefined']) + + if env['use_asan']: + env.Append(CCFLAGS=['-fsanitize=address']) + env.Append(LINKFLAGS=['-fsanitize=address']) + + if env['use_tsan']: + env.Append(CCFLAGS=['-fsanitize=thread']) + env.Append(LINKFLAGS=['-fsanitize=thread']) + ## Dependencies if env['builtin_libtheora']: |