diff options
author | Christoph M. Becker <cmbecker69@gmx.de> | 2019-12-27 14:28:28 +0100 |
---|---|---|
committer | Christoph M. Becker <cmbecker69@gmx.de> | 2020-01-16 13:57:21 +0100 |
commit | c9908ee5ebacd00108b960d03e9c7e1cb299b27b (patch) | |
tree | bc6e8621b323e53872580e75b54ec34393b9349f /win32/build/confutils.js | |
parent | 05f3cd23ed61d800a861f2dd057ed56e783ea6f1 (diff) | |
download | php-git-c9908ee5ebacd00108b960d03e9c7e1cb299b27b.tar.gz |
Disable optimizations for ASan instrumented builds
ASan instrumentation does not support the MSVC debug runtime, but still
it does not make sense to enable optimizations for such builds, since
they are not meant for production usage anyway, and although memory
corruption issues are still found in optimized builds, the generated
diagnostics are close to being useless, and apparently sometimes even
outright wrong. Therefore, we disable all optimizations for ASan
instrumented builds.
We also introduce and use `ZEND_WIN32_NEVER_INLINE` for ASan enabled
builds to avoid inlining of functions, so we get even better
diagnostics.
Diffstat (limited to 'win32/build/confutils.js')
-rw-r--r-- | win32/build/confutils.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/win32/build/confutils.js b/win32/build/confutils.js index c95ea1f3e6..e7193a6102 100644 --- a/win32/build/confutils.js +++ b/win32/build/confutils.js @@ -3425,8 +3425,13 @@ function toolset_setup_build_mode() ADD_FLAG("CFLAGS", "/Zi"); ADD_FLAG("LDFLAGS", "/incremental:no /debug /opt:ref,icf"); } - // Equivalent to Release_TSInline build -> best optimization - ADD_FLAG("CFLAGS", "/LD /MD /W3 /Ox /D NDebug /D NDEBUG /D ZEND_WIN32_FORCE_INLINE /GF /D ZEND_DEBUG=0"); + ADD_FLAG("CFLAGS", "/LD /MD /W3"); + if (PHP_SANITIZER == "yes" && CLANG_TOOLSET) { + ADD_FLAG("CFLAGS", "/Od /D NDebug /D NDEBUG /D ZEND_WIN32_NEVER_INLINE /D ZEND_DEBUG=0"); + } else { + // Equivalent to Release_TSInline build -> best optimization + ADD_FLAG("CFLAGS", "/Ox /D NDebug /D NDEBUG /D ZEND_WIN32_FORCE_INLINE /GF /D ZEND_DEBUG=0"); + } // if you have VS.Net /GS hardens the binary against buffer overruns // ADD_FLAG("CFLAGS", "/GS"); |