diff mbox series

php: fix build of the bundled xxHash with -Og

Message ID 20261201064921.3966046-1-anuj.mittal@oss.qualcomm.com
State Superseded
Headers show
Series php: fix build of the bundled xxHash with -Og | expand

Commit Message

Anuj Mittal Dec. 1, 2026, 6:49 a.m. UTC
From: Anuj Mittal <anuj.mittal@oss.qualcomm.com>

With DEBUG_BUILD enabled, php and php-native fail to compile
ext/hash/hash_xxhash.c with GCC 14 and newer:

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

The bundled xxHash marks its XXH3 vector paths always_inline but only
reaches them through function pointers. It drops the inline hints when
__NO_INLINE__ is defined (-O0, -fno-inline) but not for -Og, which
can't be detected at compile time. Upstream xxHash closed this as not
fixable in code [1] and documents XXH_NO_INLINE_HINTS as the way to
compile with -Og [2].

Define XXH_NO_INLINE_HINTS when -Og is selected.

[1] https://github.com/Cyan4973/xxHash/issues/943
[2] https://github.com/Cyan4973/xxHash#binary-size-control

Signed-off-by: Anuj Mittal <anuj.mittal@oss.qualcomm.com>
---
 meta-oe/recipes-devtools/php/php_8.6.0.bb | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Khem Raj Dec. 1, 2026, 7:18 a.m. UTC | #1
On Mon, Nov 30, 2026 at 10:49 PM Anuj Mittal via openembedded-devel
<anuj.mittal=oss.qualcomm.com@lists.openembedded.org> wrote:

> From: Anuj Mittal <anuj.mittal@oss.qualcomm.com>
>
> With DEBUG_BUILD enabled, php and php-native fail to compile
> ext/hash/hash_xxhash.c with GCC 14 and newer:
>
>   ext/hash/xxhash/xxhash.h:4786:1: error: inlining failed in call to
>   'always_inline' 'XXH3_accumulate_512_sse2': function not considered
>   for inlining
>
> The bundled xxHash marks its XXH3 vector paths always_inline but only
> reaches them through function pointers. It drops the inline hints when
> __NO_INLINE__ is defined (-O0, -fno-inline) but not for -Og, which
> can't be detected at compile time. Upstream xxHash closed this as not
> fixable in code [1] and documents XXH_NO_INLINE_HINTS as the way to
> compile with -Og [2].
>
> Define XXH_NO_INLINE_HINTS when -Og is selected.
>
> [1] https://github.com/Cyan4973/xxHash/issues/943
> [2] https://github.com/Cyan4973/xxHash#binary-size-control
>
> Signed-off-by: Anuj Mittal <anuj.mittal@oss.qualcomm.com>
> ---
>  meta-oe/recipes-devtools/php/php_8.6.0.bb | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
>
> 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..69eb79a42c 100644
> --- a/meta-oe/recipes-devtools/php/php_8.6.0.bb
> +++ b/meta-oe/recipes-devtools/php/php_8.6.0.bb
> @@ -127,6 +127,18 @@ CFLAGS += " -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -g
> -DPTYS_ARE_GETPT -DPTYS_ARE_S
>  # default when cross compiling
>  # See https://bugs.php.net/bug.php?id=60109
>  CFLAGS += " -DHAVE_LIBDL "
> +
> +# The bundled xxHash in ext/hash marks its XXH3 vector paths
> always_inline but
> +# only reaches them through function pointers. It drops the inline hints
> on its
> +# own when __NO_INLINE__ is defined (-O0, -fno-inline) but never for -Og,
> and
> +# GCC 14 and newer no longer resolve those indirect calls at -Og, so
> +# hash_xxhash.c fails to build with DEBUG_BUILD. Upstream xxHash closed
> this as
> +# not fixable in code and documents XXH_NO_INLINE_HINTS as the supported
> way to
> +# compile with -Og:
> +# https://github.com/Cyan4973/xxHash/issues/943
> +# https://github.com/Cyan4973/xxHash#binary-size-control


Get rid of these comments, they are already in the commit message.


>
> +CFLAGS += "${@bb.utils.contains('SELECTED_OPTIMIZATION', '-Og',
> '-DXXH_NO_INLINE_HINTS', '', d)}"
>

Perhaps use CFLAGS += "${@oe.utils.vartrue('DEBUG_BUILD',
'-DXXH_NO_INLINE_HINTS=1', '', d)}"


> +
>  LDFLAGS += " -ldl "
>  LDFLAGS:append:libc-musl = " -lucontext "
>  LDFLAGS:append:riscv64 = " -latomic"
> --
> 2.55.0
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#133740):
> https://lists.openembedded.org/g/openembedded-devel/message/133740
> Mute This Topic: https://lists.openembedded.org/mt/122530635/1997914
> Group Owner: openembedded-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [
> raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
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..69eb79a42c 100644
--- a/meta-oe/recipes-devtools/php/php_8.6.0.bb
+++ b/meta-oe/recipes-devtools/php/php_8.6.0.bb
@@ -127,6 +127,18 @@  CFLAGS += " -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -g -DPTYS_ARE_GETPT -DPTYS_ARE_S
 # default when cross compiling
 # See https://bugs.php.net/bug.php?id=60109
 CFLAGS += " -DHAVE_LIBDL "
+
+# The bundled xxHash in ext/hash marks its XXH3 vector paths always_inline but
+# only reaches them through function pointers. It drops the inline hints on its
+# own when __NO_INLINE__ is defined (-O0, -fno-inline) but never for -Og, and
+# GCC 14 and newer no longer resolve those indirect calls at -Og, so
+# hash_xxhash.c fails to build with DEBUG_BUILD. Upstream xxHash closed this as
+# not fixable in code and documents XXH_NO_INLINE_HINTS as the supported way to
+# compile with -Og:
+# https://github.com/Cyan4973/xxHash/issues/943
+# https://github.com/Cyan4973/xxHash#binary-size-control
+CFLAGS += "${@bb.utils.contains('SELECTED_OPTIMIZATION', '-Og', '-DXXH_NO_INLINE_HINTS', '', d)}"
+
 LDFLAGS += " -ldl "
 LDFLAGS:append:libc-musl = " -lucontext "
 LDFLAGS:append:riscv64 = " -latomic"