From e04efc88e92d14cd5d724db5660054aaef4a9c01 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Wed, 24 Jun 2026 23:33:50 +0000 Subject: [PATCH] abseil-cpp: fix clang build with BMI2 Clang errors on a direct include of 'Never use directly; include instead.' hit whenever __BMI2__ is defined. Backport the upstream fix to include the umbrella header guarded by an x86 check. Signed-off-by: Khem Raj --- ...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 +Date: Tue, 24 Jun 2026 00:00:00 +0000 +Subject: [PATCH] raw_hash_set: include instead of + +Clang refuses a direct include of and errors out with: + + error: "Never use directly; include instead." + +This is hit whenever __BMI2__ is defined, e.g. when building with +-march=x86-64-v3. Mirror upstream and include the umbrella +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 +--- + 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 // NOLINT(build/c++20) + #endif + +-#ifdef __BMI2__ +-#include +-#endif // __BMI2__ ++#if defined(__i386__) || defined(__x86_64__) ++#include ++#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"