From e300da4db42e2484d98f4982d03150d83436304e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Holz?= Date: Sun, 20 Aug 2023 19:46:39 +0200 Subject: [PATCH] AK: Don't use GCC's `__builtin_ffs` on riscv64 without Zbb extension GCC redirects `__builtin_ffs` to `ffs` on RISC-V without the Zbb extension, causing a linker error. --- AK/BuiltinWrappers.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AK/BuiltinWrappers.h b/AK/BuiltinWrappers.h index bd0620d1a8..a4a68a83e1 100644 --- a/AK/BuiltinWrappers.h +++ b/AK/BuiltinWrappers.h @@ -134,7 +134,7 @@ inline constexpr int count_leading_zeroes_safe(IntType value) template inline constexpr int bit_scan_forward(IntType value) { -#if defined(AK_COMPILER_CLANG) || defined(AK_COMPILER_GCC) +#if defined(AK_COMPILER_CLANG) || (defined(AK_COMPILER_GCC) && (!ARCH(RISCV64) || defined(__riscv_zbb))) static_assert(sizeof(IntType) <= sizeof(unsigned long long)); if constexpr (sizeof(IntType) <= sizeof(unsigned int)) return __builtin_ffs(value);