From cc3cc79e137e8e588d625af855ee4ea9b08774c7 Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Mon, 12 Aug 2024 15:05:05 +0200 Subject: [PATCH 1/8] Windows x86 CI --- .github/scripts/windows/build_task.bat | 4 ++-- .github/workflows/push.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/scripts/windows/build_task.bat b/.github/scripts/windows/build_task.bat index e8d84b8c0bfd6..63aee9064162a 100644 --- a/.github/scripts/windows/build_task.bat +++ b/.github/scripts/windows/build_task.bat @@ -5,9 +5,9 @@ if /i "%GITHUB_ACTIONS%" neq "True" ( exit /b 3 ) -del /f /q C:\Windows\System32\libcrypto-1_1-x64.dll >NUL 2>NUL +del /f /q C:\Windows\System32\libcrypto-1_1-x86.dll >NUL 2>NUL if %errorlevel% neq 0 exit /b 3 -del /f /q C:\Windows\System32\libssl-1_1-x64.dll >NUL 2>NUL +del /f /q C:\Windows\System32\libssl-1_1-x86.dll >NUL 2>NUL if %errorlevel% neq 0 exit /b 3 call %~dp0find-target-branch.bat diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 086c5cc0347bd..8aee2a79b1816 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -235,7 +235,7 @@ jobs: uses: ./.github/actions/verify-generated-files WINDOWS: if: github.repository == 'php/php-src' || github.event_name == 'pull_request' - name: WINDOWS_X64_ZTS + name: WINDOWS_X86_ZTS runs-on: windows-2022 env: PHP_BUILD_CACHE_BASE_DIR: C:\build-cache @@ -243,7 +243,7 @@ jobs: PHP_BUILD_CACHE_SDK_DIR: C:\build-cache\sdk PHP_BUILD_SDK_BRANCH: php-sdk-2.3.0 PHP_BUILD_CRT: vs17 - PLATFORM: x64 + PLATFORM: x86 THREAD_SAFE: "1" INTRINSICS: AVX2 PARALLEL: -j2 From e516f2dee23884854808546d7f98359fb81f0d7f Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Mon, 12 Aug 2024 23:37:16 +0200 Subject: [PATCH 2/8] Enable debug assertions --- .github/scripts/windows/build_task.bat | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/scripts/windows/build_task.bat b/.github/scripts/windows/build_task.bat index 63aee9064162a..8c47ab007accf 100644 --- a/.github/scripts/windows/build_task.bat +++ b/.github/scripts/windows/build_task.bat @@ -37,6 +37,7 @@ if "%PLATFORM%" == "x86" ( ) else ( set CFLAGS=/W1 /WX ) +set CFLAGS=%CFLAGS% /DPHP_DEBUG=1 /DZEND_DEBUG=1 cmd /c configure.bat ^ --enable-snapshot-build ^ From b746290caf3923699e0330f3bcff1ead10a3cdd2 Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Tue, 13 Aug 2024 20:57:15 +0200 Subject: [PATCH 3/8] com_safearray_proxy --- Zend/tests/arginfo_zpp_mismatch.phpt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Zend/tests/arginfo_zpp_mismatch.phpt b/Zend/tests/arginfo_zpp_mismatch.phpt index d7aefc6f374f6..b4b39f9f7aa96 100644 --- a/Zend/tests/arginfo_zpp_mismatch.phpt +++ b/Zend/tests/arginfo_zpp_mismatch.phpt @@ -65,6 +65,7 @@ foreach (get_defined_functions()["internal"] as $function) { } foreach (get_declared_classes() as $class) { + if ($class === "com_safearray_proxy") var_dump("com_safearray_proxy"); try { $rc = new ReflectionClass($class); $obj = $rc->newInstanceWithoutConstructor(); @@ -78,6 +79,7 @@ foreach (get_declared_classes() as $class) { } // var_dump() and debug_zval_dump() print all arguments +echo "fail\n"; ?> ===DONE=== --EXPECT-- From d8bff15324578c13a3e11d766def37ef38bbdddc Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Wed, 21 Aug 2024 23:02:22 +0200 Subject: [PATCH 4/8] Revert "com_safearray_proxy" This reverts commit b746290caf3923699e0330f3bcff1ead10a3cdd2. --- Zend/tests/arginfo_zpp_mismatch.phpt | 2 -- 1 file changed, 2 deletions(-) diff --git a/Zend/tests/arginfo_zpp_mismatch.phpt b/Zend/tests/arginfo_zpp_mismatch.phpt index b4b39f9f7aa96..d7aefc6f374f6 100644 --- a/Zend/tests/arginfo_zpp_mismatch.phpt +++ b/Zend/tests/arginfo_zpp_mismatch.phpt @@ -65,7 +65,6 @@ foreach (get_defined_functions()["internal"] as $function) { } foreach (get_declared_classes() as $class) { - if ($class === "com_safearray_proxy") var_dump("com_safearray_proxy"); try { $rc = new ReflectionClass($class); $obj = $rc->newInstanceWithoutConstructor(); @@ -79,7 +78,6 @@ foreach (get_declared_classes() as $class) { } // var_dump() and debug_zval_dump() print all arguments -echo "fail\n"; ?> ===DONE=== --EXPECT-- From e9d74d22dfd0b4b417861dcb47ab8d4db1d280b0 Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Wed, 21 Aug 2024 23:02:51 +0200 Subject: [PATCH 5/8] Revert "Enable debug assertions" This reverts commit e516f2dee23884854808546d7f98359fb81f0d7f. --- .github/scripts/windows/build_task.bat | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/scripts/windows/build_task.bat b/.github/scripts/windows/build_task.bat index 8c47ab007accf..63aee9064162a 100644 --- a/.github/scripts/windows/build_task.bat +++ b/.github/scripts/windows/build_task.bat @@ -37,7 +37,6 @@ if "%PLATFORM%" == "x86" ( ) else ( set CFLAGS=/W1 /WX ) -set CFLAGS=%CFLAGS% /DPHP_DEBUG=1 /DZEND_DEBUG=1 cmd /c configure.bat ^ --enable-snapshot-build ^ From 4cb4d6ec8ab550fdde83d91ad38682f4daf8a9af Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Wed, 21 Aug 2024 22:57:04 +0200 Subject: [PATCH 6/8] Support --enable-debug-assertions configure option This has been introduced for non Windows system years ago[1] mainly to improve fuzzer SAPI. While this is still not available on Windows, the option can still make sense, particularly for CI runs or other environments where full debugging support would be useless. [1] --- win32/build/config.w32 | 4 ++++ win32/build/confutils.js | 11 ++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/win32/build/config.w32 b/win32/build/config.w32 index c4a617a2e16ec..b5e6c4417e62b 100644 --- a/win32/build/config.w32 +++ b/win32/build/config.w32 @@ -32,6 +32,10 @@ ARG_ENABLE('debug-pack', 'Release binaries with external debug symbols (--enable if (PHP_DEBUG == "yes" && PHP_DEBUG_PACK == "yes") { ERROR("Use of both --enable-debug and --enable-debug-pack not allowed."); } +ARG_ENABLE('debug-assertions', 'Release binaries with debug assertions (--enable-debug must not be specified)', "no"); +if (PHP_DEBUG == "yes" && PHP_DEBUG_ASSERTIONS == "yes") { + ERROR("Use of both --enable-debug and --enable-debug-assertions not allowed."); +} if (PHP_DEBUG == "yes") { ADD_FLAG("CFLAGS"," /Wall "); diff --git a/win32/build/confutils.js b/win32/build/confutils.js index b72950954c0f7..bf0cdd3109362 100644 --- a/win32/build/confutils.js +++ b/win32/build/confutils.js @@ -456,7 +456,7 @@ can be built that way. \ var snapshot_build_exclusions = new Array( 'debug', 'lzf-better-compression', 'php-build', 'snapshot-template', 'zts', 'ipv6', 'fd-setsize', 'pgi', 'pgo', 'all-shared', 'config-profile', 'sanitizer', - 'phpdbg-debug' + 'phpdbg-debug', 'debug-assertions' ); var force; @@ -3473,10 +3473,15 @@ function toolset_setup_build_mode() } ADD_FLAG("CFLAGS", "/LD /MD"); if (PHP_SANITIZER == "yes" && CLANG_TOOLSET) { - ADD_FLAG("CFLAGS", "/Od /D NDebug /D NDEBUG /D ZEND_WIN32_NEVER_INLINE /D ZEND_DEBUG=0"); + ADD_FLAG("CFLAGS", "/Od /D NDebug /D NDEBUG /D ZEND_WIN32_NEVER_INLINE"); } else { // Equivalent to Release_TSInline build -> best optimization - ADD_FLAG("CFLAGS", "/Ox /D NDebug /D NDEBUG /GF /D ZEND_DEBUG=0"); + ADD_FLAG("CFLAGS", "/Ox /D NDebug /D NDEBUG /GF"); + } + if (PHP_DEBUG_ASSERTIONS == "yes") { + ADD_FLAG("CFLAGS", "/D ZEND_DEBUG=1"); + } else { + ADD_FLAG("CFLAGS", "/D ZEND_DEBUG=0"); } // if you have VS.Net /GS hardens the binary against buffer overruns From d2195202c6e2f52c36b180074d9b909494225562 Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Wed, 21 Aug 2024 23:04:28 +0200 Subject: [PATCH 7/8] --enable-debug-assertions --- .github/scripts/windows/build_task.bat | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/scripts/windows/build_task.bat b/.github/scripts/windows/build_task.bat index 63aee9064162a..96d233746d2f5 100644 --- a/.github/scripts/windows/build_task.bat +++ b/.github/scripts/windows/build_task.bat @@ -40,6 +40,7 @@ if "%PLATFORM%" == "x86" ( cmd /c configure.bat ^ --enable-snapshot-build ^ + --enable-debug-assertions ^ --disable-debug-pack ^ --enable-com-dotnet=shared ^ --without-analyzer ^ From 00e202d0363529cbd86ab5f7cbddd560e0187e19 Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Thu, 22 Aug 2024 00:50:41 +0200 Subject: [PATCH 8/8] fix --- win32/winutil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win32/winutil.c b/win32/winutil.c index e09944d131b9b..6e4325dcaecca 100644 --- a/win32/winutil.c +++ b/win32/winutil.c @@ -486,7 +486,7 @@ PHP_WINUTIL_API BOOL php_win32_crt_compatible(char **err) {/*{{{*/ #if PHP_LINKER_MAJOR == 14 /* Extend for other CRT if needed. */ -# if PHP_DEBUG +# if _DEBUG const char *crt_name = "vcruntime140d.dll"; # else const char *crt_name = "vcruntime140.dll";