libjxl: do not build the SVE targets on tunes without SVE

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)
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
This commit is contained in:
Markus Volk authored and Khem Raj committed 2026-09-21 08:13:54 -07:00
1 parent 370780c0fd
commit d9c3c54344
1 file changed
+10
@@ -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'