Clang errors on a direct include of <bmi2intrin.h> 'Never use <bmi2intrin.h> directly; include <immintrin.h> instead.'
hit whenever __BMI2__ is defined. Backport the upstream fix to include the umbrella <immintrin.h> header guarded by an x86 check. Signed-off-by: Khem Raj <[email protected]> --- ...lude-immintrin.h-instead-of-bmi2intr.patch | 36 +++++++++++++++++++ .../abseil-cpp/abseil-cpp_20260526.0.bb | 1 + 2 files changed, 37 insertions(+) create mode 100644 meta-oe/recipes-devtools/abseil-cpp/abseil-cpp/0003-raw_hash_set-include-immintrin.h-instead-of-bmi2intr.patch diff --git a/meta-oe/recipes-devtools/abseil-cpp/abseil-cpp/0003-raw_hash_set-include-immintrin.h-instead-of-bmi2intr.patch b/meta-oe/recipes-devtools/abseil-cpp/abseil-cpp/0003-raw_hash_set-include-immintrin.h-instead-of-bmi2intr.patch new file mode 100644 index 0000000000..38eba684d9 --- /dev/null +++ b/meta-oe/recipes-devtools/abseil-cpp/abseil-cpp/0003-raw_hash_set-include-immintrin.h-instead-of-bmi2intr.patch @@ -0,0 +1,36 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Khem Raj <[email protected]> +Date: Tue, 24 Jun 2026 00:00:00 +0000 +Subject: [PATCH] raw_hash_set: include <immintrin.h> instead of <bmi2intrin.h> + +Clang refuses a direct include of <bmi2intrin.h> and errors out with: + + error: "Never use <bmi2intrin.h> directly; include <immintrin.h> instead." + +This is hit whenever __BMI2__ is defined, e.g. when building with +-march=x86-64-v3. Mirror upstream and include the umbrella <immintrin.h> +header guarded by an x86 check, which transitively provides the BMI2 +intrinsics (_bzhi_u32/_bzhi_u64) used in mask(). + +Upstream-Status: Backport [https://github.com/abseil/abseil-cpp/commit/d851fdd768b27c02b3fb786fd0987faddd279ece] + +Signed-off-by: Khem Raj <[email protected]> +--- + absl/container/internal/raw_hash_set.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/absl/container/internal/raw_hash_set.h ++++ b/absl/container/internal/raw_hash_set.h +@@ -225,9 +225,9 @@ + #include <ranges> // NOLINT(build/c++20) + #endif + +-#ifdef __BMI2__ +-#include <bmi2intrin.h> +-#endif // __BMI2__ ++#if defined(__i386__) || defined(__x86_64__) ++#include <immintrin.h> ++#endif + + namespace absl { + ABSL_NAMESPACE_BEGIN diff --git a/meta-oe/recipes-devtools/abseil-cpp/abseil-cpp_20260526.0.bb b/meta-oe/recipes-devtools/abseil-cpp/abseil-cpp_20260526.0.bb index d0d0d44610..c2d1e7f44e 100644 --- a/meta-oe/recipes-devtools/abseil-cpp/abseil-cpp_20260526.0.bb +++ b/meta-oe/recipes-devtools/abseil-cpp/abseil-cpp_20260526.0.bb @@ -10,6 +10,7 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=df52c6edb7adc22e533b2bacc3bd3915" SRC_URI = "https://github.com/abseil/${BPN}/releases/download/${PV}/${BP}.tar.gz \ file://0001-absl-always-use-asm-sgidefs.h.patch \ file://0002-abseil-ppc-fixes.patch \ + file://0003-raw_hash_set-include-immintrin.h-instead-of-bmi2intr.patch \ " SRC_URI[sha256sum] = "6e1aee535473414164bf83e4ebc40240dec71a4701f8a642d906e95bea1aea0c"
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#127924): https://lists.openembedded.org/g/openembedded-devel/message/127924 Mute This Topic: https://lists.openembedded.org/mt/120018147/21656 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
