[clang] [clang] Introduce '-fint64-is-long-long' (PR #234780)

Nathan Chancellor via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 22 15:19:27 PDT 2026


nathanchance wrote:

The corresponding kernel patch to consume this would look like:

```diff
diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
index 04e1a0d12f8f..9e569791eb9a 100644
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -38,6 +38,9 @@ endif
 CC_FLAGS_FPU	:= -ffreestanding
 # Enable <arm_neon.h>
 CC_FLAGS_FPU	+= -isystem $(shell $(CC) -print-file-name=include)
+# Notify clang about the kernel's choice of int64_t being "long long" vs. just
+# "long" in userland
+CC_FLAGS_FPU	+= $(CONFIG_CC_OPT_INT64_IS_LONG_LONG)
 CC_FLAGS_NO_FPU	:= -mgeneral-regs-only
 
 KBUILD_CFLAGS	+= $(CC_FLAGS_NO_FPU) \
diff --git a/arch/arm64/include/asm/neon-intrinsics.h b/arch/arm64/include/asm/neon-intrinsics.h
index 5f13505d39fc..b8fecadb7683 100644
--- a/arch/arm64/include/asm/neon-intrinsics.h
+++ b/arch/arm64/include/asm/neon-intrinsics.h
@@ -33,7 +33,7 @@
 #include <arm_neon.h>
 #endif
 
-#ifdef CONFIG_CC_IS_CLANG
+#if defined(CONFIG_CC_IS_CLANG) && !defined(CONFIG_CC_HAS_OPT_INT64_IS_LONG_LONG)
 #pragma clang diagnostic ignored "-Wincompatible-pointer-types"
 #endif
 
diff --git a/scripts/Kconfig.toolchain b/scripts/Kconfig.toolchain
index 4b962831d62a..df9ef543f2d4 100644
--- a/scripts/Kconfig.toolchain
+++ b/scripts/Kconfig.toolchain
@@ -252,6 +252,12 @@ config CC_OPT_INLINE_MEMSET
 	default "-finline-stringops=memset" if $(cc-option,-finline-stringops=memset)
 	default "-mllvm -max-store-memset=4294967294" if $(cc-option,-mllvm -max-store-memset=4294967294)
 
+config CC_HAS_OPT_INT64_IS_LONG_LONG
+	def_bool $(cc-option,-fint64-is-long-long)
+
+config CC_OPT_INT64_IS_LONG_LONG
+	def_string "-fint64-is-long-long" if CC_HAS_OPT_INT64_IS_LONG_LONG
+
 config LD_CAN_USE_KEEP_IN_OVERLAY
 	# ld.lld prior to 21.0.0 did not support KEEP within an overlay description
 	# https://github.com/llvm/llvm-project/pull/130661
```

https://github.com/llvm/llvm-project/pull/234780


More information about the cfe-commits mailing list