Adds sanitizer options for macOS
(cherry picked from commit df4ea84e03
)
This commit is contained in:
parent
74bf8b2d50
commit
3388b7f4c7
|
@ -27,6 +27,9 @@ def get_opts():
|
||||||
('MACOS_SDK_PATH', 'Path to the macOS SDK', ''),
|
('MACOS_SDK_PATH', 'Path to the macOS SDK', ''),
|
||||||
EnumVariable('debug_symbols', 'Add debugging symbols to release builds', 'yes', ('yes', 'no', 'full')),
|
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('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["CC"] = "clang"
|
||||||
env["LINK"] = "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
|
## Dependencies
|
||||||
|
|
||||||
if env['builtin_libtheora']:
|
if env['builtin_libtheora']:
|
||||||
|
|
Loading…
Reference in New Issue