diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-03-13 22:10:01 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-13 22:10:01 +0100 |
commit | 0fd723d3ec1dc80d923f7e4e9062873916c762f0 (patch) | |
tree | ce761f8ccebca9ef5d404a9772e0071e6c993a3a | |
parent | 223a06955e6c52ba280469604a5086a2b3af7f25 (diff) | |
parent | 53901d870b11996533f38da95fcb3b8605c0cf67 (diff) |
Merge pull request #46941 from goostengine/asan-msvc
Add `use_asan` option for MSVC to enable AddressSanitizer
-rw-r--r-- | platform/windows/detect.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/platform/windows/detect.py b/platform/windows/detect.py index f26dea8d35..0b2145a92b 100644 --- a/platform/windows/detect.py +++ b/platform/windows/detect.py @@ -72,6 +72,7 @@ def get_opts(): BoolVariable("use_llvm", "Use the LLVM compiler", False), BoolVariable("use_thinlto", "Use ThinLTO", False), BoolVariable("use_static_cpp", "Link MinGW/MSVC C++ runtime libraries statically", True), + BoolVariable("use_asan", "Use address sanitizer (ASAN)", False), ] @@ -306,6 +307,12 @@ def configure_msvc(env, manual_msvc_config): env.Prepend(CPPPATH=[p for p in os.getenv("INCLUDE").split(";")]) env.Append(LIBPATH=[p for p in os.getenv("LIB").split(";")]) + # Sanitizers + if env["use_asan"]: + env.extra_suffix += ".s" + env.Append(LINKFLAGS=["/INFERASANLIBS"]) + env.Append(CCFLAGS=["/fsanitize=address"]) + # Incremental linking fix env["BUILDERS"]["ProgramOriginal"] = env["BUILDERS"]["Program"] env["BUILDERS"]["Program"] = methods.precious_program |