@@ -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
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(+)