Skip to content

Commit f580c79

Browse files
committed
Add ASan support for MSVC
1 parent 05cb27a commit f580c79

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

win32/build/confutils.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1241,6 +1241,8 @@ function SAPI(sapiname, file_list, makefiletarget, cflags, obj_dir)
12411241
if (PHP_SANITIZER == "yes") {
12421242
if (CLANG_TOOLSET) {
12431243
add_asan_opts("CFLAGS_" + SAPI, "LIBS_" + SAPI, (is_lib ? "ARFLAGS_" : "LDFLAGS_") + SAPI);
1244+
} else if (VS_TOOLSET) {
1245+
ADD_FLAG("CFLAGS", "/fsanitize=address");
12441246
}
12451247
}
12461248

@@ -3440,8 +3442,8 @@ function toolset_setup_build_mode()
34403442
ADD_FLAG("LDFLAGS", "/incremental:no /debug /opt:ref,icf");
34413443
}
34423444
ADD_FLAG("CFLAGS", "/LD /MD");
3443-
if (PHP_SANITIZER == "yes" && CLANG_TOOLSET) {
3444-
ADD_FLAG("CFLAGS", "/Od /D NDebug /D NDEBUG /D ZEND_WIN32_NEVER_INLINE /D ZEND_DEBUG=0");
3445+
if (PHP_SANITIZER == "yes") {
3446+
ADD_FLAG("CFLAGS", "/Od /D NDebug /D NDEBUG /D ZEND_WIN32_NEVER_INLINE /D ZEND_DEBUG=1");
34453447
} else {
34463448
// Equivalent to Release_TSInline build -> best optimization
34473449
ADD_FLAG("CFLAGS", "/Ox /D NDebug /D NDEBUG /GF /D ZEND_DEBUG=0");

win32/winutil.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ PHP_WINUTIL_API BOOL php_win32_crt_compatible(char **err)
486486
{/*{{{*/
487487
#if PHP_LINKER_MAJOR == 14
488488
/* Extend for other CRT if needed. */
489-
# if PHP_DEBUG
489+
# if _DEBUG
490490
const char *crt_name = "vcruntime140d.dll";
491491
# else
492492
const char *crt_name = "vcruntime140.dll";

0 commit comments

Comments
 (0)