[PATCH] init/Kconfig: Adjust fixed clang version for __builtin_counted_by_ref

Nathan Chancellor posted 1 patch 1 month, 3 weeks ago
init/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] init/Kconfig: Adjust fixed clang version for __builtin_counted_by_ref
Posted by Nathan Chancellor 1 month, 3 weeks ago
Commit d39a1d7486d9 ("compiler_types: Disable __builtin_counted_by_ref
for Clang") used 22.0.0 as the fixed version for a compiler crash but
the fix was only merged in main (23.0.0) and release/22.x (22.1.0). With
the current fixed version number, prerelease or Android LLVM 22 builds
will still be able to hit the compiler crash when building the kernel.
This can be particularly disruptive when bisecting LLVM.

Use 21.1.0 as the fixed version number to ensure the fix for this crash
is always present.

Fixes: d39a1d7486d9 ("compiler_types: Disable __builtin_counted_by_ref for Clang")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
 init/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/init/Kconfig b/init/Kconfig
index c25869cf59c1..b55deae9256c 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -153,7 +153,7 @@ config CC_HAS_COUNTED_BY_PTR
 config CC_HAS_BROKEN_COUNTED_BY_REF
 	bool
 	# https://github.com/llvm/llvm-project/issues/182575
-	default y if CC_IS_CLANG && CLANG_VERSION < 220000
+	default y if CC_IS_CLANG && CLANG_VERSION < 220100
 
 config CC_HAS_MULTIDIMENSIONAL_NONSTRING
 	def_bool $(success,echo 'char tag[][4] __attribute__((__nonstring__)) = { };' | $(CC) $(CLANG_FLAGS) -x c - -c -o /dev/null -Werror)

---
base-commit: 6de23f81a5e08be8fbf5e8d7e9febc72a5b5f27f
change-id: 20260223-fix-clang-version-builtin-counted-by-ref-2dee9636f43d

Best regards,
--  
Nathan Chancellor <nathan@kernel.org>
Re: [PATCH] init/Kconfig: Adjust fixed clang version for __builtin_counted_by_ref
Posted by Kees Cook 1 month, 3 weeks ago
On Mon, 23 Feb 2026 11:23:12 -0700, Nathan Chancellor wrote:
> Commit d39a1d7486d9 ("compiler_types: Disable __builtin_counted_by_ref
> for Clang") used 22.0.0 as the fixed version for a compiler crash but
> the fix was only merged in main (23.0.0) and release/22.x (22.1.0). With
> the current fixed version number, prerelease or Android LLVM 22 builds
> will still be able to hit the compiler crash when building the kernel.
> This can be particularly disruptive when bisecting LLVM.
> 
> [...]

Applied to for-next/kmalloc_obj, thanks!

[1/1] init/Kconfig: Adjust fixed clang version for __builtin_counted_by_ref
      https://git.kernel.org/kees/c/8e795ac93b64

Take care,

-- 
Kees Cook