diff mbox series

[meta-oe,1/2] libjxl: do not build the SVE targets on tunes without SVE

Message ID 20260916173011.2907064-1-f_l_k@t-online.de
State New
Headers show
Series [meta-oe,1/2] libjxl: do not build the SVE targets on tunes without SVE | expand

Commit Message

Markus Volk Sept. 16, 2026, 5:30 p.m. UTC
Whether Highway's SVE targets are built is decided by a compiler capability
probe that compiles a function marked __attribute__((target("+sve"))). The
attribute enables SVE for that function itself, so the probe succeeds on any
aarch64 compiler no matter what the tune supports, and the guard meant to
disable the targets never fires.

On a tune without SVE this compiles code that can never run, and gcc 16
crashes while doing so:

    lib/jxl/enc_transforms-inl.h:799:1: internal compiler error:
    in simplify_gen_subreg_concatn, at lower-subreg.cc:744

Tie the targets to TUNE_FEATURES instead, which describes the machine rather
than the compiler. 32 bit arm needs nothing: Highway gates the SVE targets on
HWY_ARCH_ARM_A64, and the probe fails there anyway because arm_sve.h does not
exist.

Built for raspberrypi4-64 (cortexa72, no SVE) from a clean state, and checked
that the x86-64 configuration is unchanged.

AI-Generated: Uses Claude Code (Claude Opus 5)
---
 meta-oe/recipes-multimedia/libjxl/libjxl_0.12.0.bb | 10 ++++++++++
 1 file changed, 10 insertions(+)
diff mbox series

Patch

diff --git a/meta-oe/recipes-multimedia/libjxl/libjxl_0.12.0.bb b/meta-oe/recipes-multimedia/libjxl/libjxl_0.12.0.bb
index 7422282e4c..1207fef856 100644
--- a/meta-oe/recipes-multimedia/libjxl/libjxl_0.12.0.bb
+++ b/meta-oe/recipes-multimedia/libjxl/libjxl_0.12.0.bb
@@ -30,6 +30,16 @@  EXTRA_OECMAKE = " \
 	-DJPEGXL_ENABLE_TOOLS=OFF \
 "
 
+# Whether to build the SVE targets is decided by a compiler capability probe
+# using __attribute__((target("+sve"))), which succeeds on any aarch64 compiler
+# no matter what the tune supports. On a tune without SVE that compiles code
+# which can never run, and gcc crashes on the SVE2_128 target:
+#   enc_transforms-inl.h:799:1: internal compiler error:
+#   in simplify_gen_subreg_concatn, at lower-subreg.cc:744
+# Tie the targets to the tune instead.
+EXTRA_OECMAKE:append:aarch64 = " ${@bb.utils.contains('TUNE_FEATURES', 'sve', '', '-DJPEGXL_ENABLE_HWY_SVE=OFF -DJPEGXL_ENABLE_HWY_SVE_256=OFF', d)}"
+EXTRA_OECMAKE:append:aarch64 = " ${@bb.utils.contains('TUNE_FEATURES', 'sve2', '', '-DJPEGXL_ENABLE_HWY_SVE2=OFF -DJPEGXL_ENABLE_HWY_SVE2_128=OFF', d)}"
+
 PACKAGECONFIG ?= "mime gdk-pixbuf-loader sizeless-vectors"
 # libjxl/0.10.2/recipe-sysroot/usr/include/hwy/ops/rvv-inl.h:591:17: error: use
 # of undeclared identifier '__riscv_vsetvlmax_e8mf8'