From 2e6745b4af985b9449a309b07dbbc7bf119ca0fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Sun, 24 May 2026 23:23:31 +0200 Subject: [PATCH 1/3] Fix compilation errors up until Clang 21.0 - The "pclmul" and "cldemote" CPU features are both only available on x86-64, and the __builtin_cpu_supports() checks in question fail on Clang, so they shouldn't even be tried to be run (similar fixes before: https://github.com/php/php-src/pull/18629). - The res.h file in Lexbor contains some unterminated strings (e.g. https://github.com/php/php-src/blob/d58d3d2fd6c1cfa7e3489a9859eda63086af762f/ext/lexbor/lexbor/html/tokenizer/res.h#L203), and a new compiler warning fails by default because of them. This needs to be suppressed. --- Zend/zend_cpuinfo.h | 11 +++++++++-- ext/lexbor/config.m4 | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Zend/zend_cpuinfo.h b/Zend/zend_cpuinfo.h index 513dacfd08f5..ccb891cec257 100644 --- a/Zend/zend_cpuinfo.h +++ b/Zend/zend_cpuinfo.h @@ -272,7 +272,10 @@ static zend_always_inline int zend_cpu_supports_avx512_vbmi(void) { #endif /* __builtin_cpu_supports has pclmul from gcc9 and clang 19 */ -#if defined(PHP_HAVE_BUILTIN_CPU_SUPPORTS) && (!defined(__GNUC__) || (defined(__clang__) && __clang_major__ >= 19) || (ZEND_GCC_VERSION >= 9000)) +#if defined(PHP_HAVE_BUILTIN_CPU_SUPPORTS) && defined(__x86_64__) && \ + ( \ + (!defined(__GNUC__) || (defined(__clang__) && __clang_major__ >= 19) || (ZEND_GCC_VERSION >= 9000)) \ + ) ZEND_NO_SANITIZE_ADDRESS static inline int zend_cpu_supports_pclmul(void) { #ifdef PHP_HAVE_BUILTIN_CPU_INIT @@ -287,7 +290,11 @@ static inline int zend_cpu_supports_pclmul(void) { #endif /* __builtin_cpu_supports has cldemote from gcc11 and clang 19 */ -#if defined(PHP_HAVE_BUILTIN_CPU_SUPPORTS) && ((defined(__clang__) && (__clang_major__ >= 19)) || (!defined(__clang__) && defined(__GNUC__) && (ZEND_GCC_VERSION >= 11000))) +#if defined(PHP_HAVE_BUILTIN_CPU_SUPPORTS) && defined(__x86_64__) && \ + ( \ + (defined(__clang__) && (__clang_major__ >= 19)) || \ + (!defined(__clang__) && defined(__GNUC__) && (ZEND_GCC_VERSION >= 11000)) \ + ) #define HAVE_ZEND_CPU_SUPPORTS_CLDEMOTE 1 ZEND_NO_SANITIZE_ADDRESS static inline int zend_cpu_supports_cldemote(void) { diff --git a/ext/lexbor/config.m4 b/ext/lexbor/config.m4 index 21fabcd0ddb0..3bf28cf989f8 100644 --- a/ext/lexbor/config.m4 +++ b/ext/lexbor/config.m4 @@ -1,4 +1,4 @@ -PHP_LEXBOR_CFLAGS="-I@ext_srcdir@/" +PHP_LEXBOR_CFLAGS="-Wno-unterminated-string-initialization -I@ext_srcdir@/" LEXBOR_DIR="lexbor" AC_DEFINE([HAVE_LEXBOR], [1], [Define to 1 if the PHP extension 'lexbor' is available.]) From 3afbcde9be8b4c18df5281ca66b4de009316556a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Sun, 24 May 2026 23:41:48 +0200 Subject: [PATCH 2/3] Try to suppress warning due to unknown compiler flags --- ext/lexbor/config.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/lexbor/config.m4 b/ext/lexbor/config.m4 index 3bf28cf989f8..a75f490e77cc 100644 --- a/ext/lexbor/config.m4 +++ b/ext/lexbor/config.m4 @@ -1,4 +1,4 @@ -PHP_LEXBOR_CFLAGS="-Wno-unterminated-string-initialization -I@ext_srcdir@/" +PHP_LEXBOR_CFLAGS="-Wno-unknown-warning-option -Wno-unterminated-string-initialization -I@ext_srcdir@/" LEXBOR_DIR="lexbor" AC_DEFINE([HAVE_LEXBOR], [1], [Define to 1 if the PHP extension 'lexbor' is available.]) From 4367a0d3930ad3aa82c70e30fe43e57cbdc72cf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Mon, 25 May 2026 00:00:01 +0200 Subject: [PATCH 3/3] Fix for 32 bit --- Zend/zend_cpuinfo.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Zend/zend_cpuinfo.h b/Zend/zend_cpuinfo.h index ccb891cec257..855e245beafe 100644 --- a/Zend/zend_cpuinfo.h +++ b/Zend/zend_cpuinfo.h @@ -272,7 +272,7 @@ static zend_always_inline int zend_cpu_supports_avx512_vbmi(void) { #endif /* __builtin_cpu_supports has pclmul from gcc9 and clang 19 */ -#if defined(PHP_HAVE_BUILTIN_CPU_SUPPORTS) && defined(__x86_64__) && \ +#if defined(PHP_HAVE_BUILTIN_CPU_SUPPORTS) && (defined(__x86_64__) || defined(__i386__)) && \ ( \ (!defined(__GNUC__) || (defined(__clang__) && __clang_major__ >= 19) || (ZEND_GCC_VERSION >= 9000)) \ ) @@ -290,7 +290,7 @@ static inline int zend_cpu_supports_pclmul(void) { #endif /* __builtin_cpu_supports has cldemote from gcc11 and clang 19 */ -#if defined(PHP_HAVE_BUILTIN_CPU_SUPPORTS) && defined(__x86_64__) && \ +#if defined(PHP_HAVE_BUILTIN_CPU_SUPPORTS) && (defined(__x86_64__) || defined(__i386__)) && \ ( \ (defined(__clang__) && (__clang_major__ >= 19)) || \ (!defined(__clang__) && defined(__GNUC__) && (ZEND_GCC_VERSION >= 11000)) \