diff mbox series

php: Fix xxhash always_inline build failure under DEBUG_BUILD

Message ID 20261202084753.3198169-1-rahujosh@qti.qualcomm.com
State New
Headers show
Series php: Fix xxhash always_inline build failure under DEBUG_BUILD | expand

Commit Message

Rahul Joshi Dec. 2, 2026, 8:47 a.m. UTC
Yocto's DEBUG_BUILD variable lowers SELECTED_OPTIMIZATION for every
recipe, including -native ones. At that reduced optimization level
GCC can no longer honor the "always_inline" attribute combined with
the target("sse2") attribute on the accumulate/scramble functions of
the bundled xxHash (ext/hash/xxhash/xxhash.h), and turns the failure
to inline into a hard compile error instead of a warning:

  ext/hash/xxhash/xxhash.h:4786:1: error: inlining failed in call to
  'always_inline' 'XXH3_accumulate_512_sse2': function not considered
  for inlining

This breaks php-native (and anything depending on it) whenever its
sstate is invalidated under a DEBUG_BUILD configuration.

Define XXH_NO_INLINE_HINTS, a flag the bundled xxHash already
supports, so XXH_FORCE_INLINE drops the always_inline hint and falls
back to a plain static function, letting the compiler decide whether
to inline it.

Signed-off-by: Rahul Joshi <rahujosh@qti.qualcomm.com>
---
 meta-oe/recipes-devtools/php/php_8.6.0.bb | 10 ++++++++++
 1 file changed, 10 insertions(+)
diff mbox series

Patch

diff --git a/meta-oe/recipes-devtools/php/php_8.6.0.bb b/meta-oe/recipes-devtools/php/php_8.6.0.bb
index b6cbf02a2f..770ee3f8ea 100644
--- a/meta-oe/recipes-devtools/php/php_8.6.0.bb
+++ b/meta-oe/recipes-devtools/php/php_8.6.0.bb
@@ -123,6 +123,16 @@  export PHP_NATIVE_DIR = "${STAGING_BINDIR_NATIVE}"
 export PHP_PEAR_PHP_BIN = "${STAGING_BINDIR_NATIVE}/php"
 CFLAGS += " -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -g -DPTYS_ARE_GETPT -DPTYS_ARE_SEARCHED -I${STAGING_INCDIR}/apache2"
 
+# At low optimization levels (e.g. DEBUG_BUILD builds using -native
+# recipes) GCC fails to honor the "always_inline" + target("sse2")
+# attributes on the bundled xxHash's accumulate/scramble functions and
+# turns that into a hard compile error instead of just not inlining:
+#   error: inlining failed in call to 'always_inline' 'XXH3_accumulate_512_sse2':
+#   function not considered for inlining
+# XXH_NO_INLINE_HINTS drops the forced-inline hint so xxHash falls back
+# to ordinary static functions, letting the compiler decide.
+CFLAGS += " -DXXH_NO_INLINE_HINTS=1"
+
 # Adding these flags enables dynamic library support, which is disabled by
 # default when cross compiling
 # See https://bugs.php.net/bug.php?id=60109