package/sysprof: fix build on 32-bit x86 with AVX2

The bundled CRoaring code enables its x64 specific code paths as soon
as __AVX2__ (or __POPCNT__ and __SSE4_2__) is defined, which also
happens on 32-bit x86 targets such as i686 with BR2_x86_haswell. This
results in calls to 64-bit only intrinsics:

  roaring.h:260:18: error: implicit declaration of function '_mm_popcnt_u64'; did you mean '_mm_popcnt_u32'? [-Wimplicit-function-declaration]

Backport the upstream patch that defines DISABLE_X64 when building
for 32-bit x86, so that the portable implementation is used instead.

This issue has been present since commit 0d57555407 ("package/sysprof:
update to version 46.0"), which switched to the new sysprof code base
bundling CRoaring in contrib/eggbitset. It therefore affects 2024.08
and later.

Fixes:
https://autobuild.buildroot.org/results/f00d523aa13923c9eb73ae4e1b1f04f297512351

Fixes: 0d57555407 ("package/sysprof: update to version 46.0")
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
Yegor Yefremov
2026-10-19 15:57:21 +02:00
committed by Thomas Petazzoni
parent e5bc474158
commit 145bbce3ea

View File

@@ -0,0 +1,53 @@
From 22c10f0dbd3c357e96f83f430ebe05d24a25c536 Mon Sep 17 00:00:00 2001
From: Yegor Yefremov <yegorslists@googlemail.com>
Date: Sat, 17 Oct 2026 22:47:15 +0200
Subject: [PATCH] contrib/eggbitset: disable x64 code paths on 32-bit x86
roaring.h enables USEAVX (and thus IS_X64) whenever __AVX2__ is defined,
and USESSE4 whenever __POPCNT__ and __SSE4_2__ are defined. This also
happens on 32-bit x86 targets such as i686 built with -march=haswell,
where 64-bit only intrinsics like _mm_popcnt_u64() and
_mm256_extract_epi64() are not available, so the build fails with:
roaring.h:260:18: error: implicit declaration of function
'_mm_popcnt_u64'; did you mean '_mm_popcnt_u32'?
[-Wimplicit-function-declaration]
roaring.h:1011:23: error: implicit declaration of function
'_mm256_extract_epi64'; did you mean '_mm256_extract_epi8'?
[-Wimplicit-function-declaration]
Define DISABLE_X64 from the build system when building for 32-bit x86 so
that the portable implementation is used instead. This keeps the bundled
CRoaring sources unmodified, making future updates a plain copy.
DISABLE_X64 is only set for x86, as it also guards the NEON detection
used on ARM.
Upstream: https://gitlab.gnome.org/GNOME/sysprof/-/commit/22c10f0dbd3c357e96f83f430ebe05d24a25c536
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
---
contrib/eggbitset/meson.build | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/contrib/eggbitset/meson.build b/contrib/eggbitset/meson.build
index 82cd8a40..f2f81685 100644
--- a/contrib/eggbitset/meson.build
+++ b/contrib/eggbitset/meson.build
@@ -6,9 +6,18 @@ libeggbitset_deps = [
gio_dep,
]
+libeggbitset_c_args = []
+
+# roaring.h enables its x64 code paths based on __AVX2__/__SSE4_2__ alone,
+# but they rely on intrinsics only available on 64-bit x86.
+if host_machine.cpu_family() == 'x86'
+ libeggbitset_c_args += ['-DDISABLE_X64']
+endif
+
libeggbitset_static = static_library('eggbitset', libeggbitset_sources,
gnu_symbol_visibility: 'hidden',
dependencies: libeggbitset_deps,
+ c_args: libeggbitset_c_args,
)
libeggbitset_static_dep = declare_dependency(