* [PATCH v2 00/12] Bump minimum supported version of LLVM for building the kernel to 15.0.0
@ 2025-08-21 21:15 Nathan Chancellor
2025-08-21 21:15 ` [PATCH v2 03/12] ARM: Clean up definition of ARM_HAS_GROUP_RELOCS Nathan Chancellor
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Nathan Chancellor @ 2025-08-21 21:15 UTC (permalink / raw)
To: linux-kernel
Cc: Arnd Bergmann, Kees Cook, Nick Desaulniers, Bill Wendling,
Justin Stitt, llvm, patches, Nicolas Schier, Nathan Chancellor,
linux-kbuild, linux-hardening, Russell King, Ard Biesheuvel,
linux-arm-kernel, Will Deacon, Thomas Bogendoerfer, linux-mips,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy, linuxppc-dev, Palmer Dabbelt, Alexandre Ghiti,
linux-riscv, Marco Elver, Peter Zijlstra (Intel), kasan-dev
s390 and x86 have required LLVM 15 since
30d17fac6aae ("scripts/min-tool-version.sh: raise minimum clang version to 15.0.0 for s390")
7861640aac52 ("x86/build: Raise the minimum LLVM version to 15.0.0")
respectively. This series bumps the rest of the kernel to 15.0.0 to
match, which allows for a decent number of clean ups.
On the distros front, we will only leave behind Debian Bookworm and
Ubuntu Jammy. In both of those cases, builders / developers can either
use the kernel.org toolchains or https://apt.llvm.org to get newer
versions that will run on those distributions, if they cannot upgrade.
archlinux:latest clang version 20.1.8
debian:oldoldstable-slim Debian clang version 11.0.1-2
debian:oldstable-slim Debian clang version 14.0.6
debian:stable-slim Debian clang version 19.1.7 (3+b1)
debian:testing-slim Debian clang version 19.1.7 (3+b1)
debian:unstable-slim Debian clang version 19.1.7 (3+b2)
fedora:41 clang version 19.1.7 (Fedora 19.1.7-4.fc41)
fedora:latest clang version 20.1.8 (Fedora 20.1.8-3.fc42)
fedora:rawhide clang version 20.1.8 (Fedora 20.1.8-3.fc43)
opensuse/leap:latest clang version 17.0.6
opensuse/tumbleweed:latest clang version 20.1.8
ubuntu:focal clang version 10.0.0-4ubuntu1
ubuntu:jammy Ubuntu clang version 14.0.0-1ubuntu1.1
ubuntu:noble Ubuntu clang version 18.1.3 (1ubuntu1)
ubuntu:latest Ubuntu clang version 18.1.3 (1ubuntu1)
ubuntu:rolling Ubuntu clang version 20.1.2 (0ubuntu1)
ubuntu:devel Ubuntu clang version 20.1.8 (0ubuntu1)
I plan to carry this via the Kbuild tree with the appropriate acks.
---
Changes in v2:
- Add two new patches for RISC-V to clean up more LLD_VERSION checks
(Alex)
- Pick up provided tags (thanks all!)
- Link to v1: https://lore.kernel.org/r/20250818-bump-min-llvm-ver-15-v1-0-c8b1d0f955e0@kernel.org
---
Nathan Chancellor (12):
kbuild: Bump minimum version of LLVM for building the kernel to 15.0.0
arch/Kconfig: Drop always true condition from RANDOMIZE_KSTACK_OFFSET
ARM: Clean up definition of ARM_HAS_GROUP_RELOCS
arm64: Remove tautological LLVM Kconfig conditions
mips: Unconditionally select ARCH_HAS_CURRENT_STACK_POINTER
powerpc: Drop unnecessary initializations in __copy_inst_from_kernel_nofault()
riscv: Remove version check for LTO_CLANG selects
riscv: Unconditionally use linker relaxation
riscv: Remove ld.lld version checks from many TOOLCHAIN_HAS configs
lib/Kconfig.debug: Drop CLANG_VERSION check from DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT
objtool: Drop noinstr hack for KCSAN_WEAK_MEMORY
KMSAN: Remove tautological checks
Documentation/process/changes.rst | 2 +-
arch/Kconfig | 1 -
arch/arm/Kconfig | 11 ++++-------
arch/arm64/Kconfig | 5 +----
arch/mips/Kconfig | 2 +-
arch/powerpc/include/asm/inst.h | 4 ----
arch/riscv/Kconfig | 21 +++++++--------------
arch/riscv/Makefile | 9 +--------
lib/Kconfig.debug | 2 +-
lib/Kconfig.kcsan | 6 ------
lib/Kconfig.kmsan | 11 +----------
scripts/min-tool-version.sh | 6 ++----
tools/objtool/check.c | 10 ----------
13 files changed, 19 insertions(+), 71 deletions(-)
---
base-commit: 8f5ae30d69d7543eee0d70083daf4de8fe15d585
change-id: 20250710-bump-min-llvm-ver-15-95231f1eb655
Best regards,
--
Nathan Chancellor <nathan@kernel.org>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 03/12] ARM: Clean up definition of ARM_HAS_GROUP_RELOCS
2025-08-21 21:15 [PATCH v2 00/12] Bump minimum supported version of LLVM for building the kernel to 15.0.0 Nathan Chancellor
@ 2025-08-21 21:15 ` Nathan Chancellor
2025-08-22 7:05 ` Arnd Bergmann
2025-08-21 21:15 ` [PATCH v2 04/12] arm64: Remove tautological LLVM Kconfig conditions Nathan Chancellor
2025-08-29 22:33 ` [PATCH v2 00/12] Bump minimum supported version of LLVM for building the kernel to 15.0.0 Nathan Chancellor
2 siblings, 1 reply; 7+ messages in thread
From: Nathan Chancellor @ 2025-08-21 21:15 UTC (permalink / raw)
To: linux-kernel
Cc: Arnd Bergmann, Kees Cook, Nick Desaulniers, Bill Wendling,
Justin Stitt, llvm, patches, Nathan Chancellor, Russell King,
Ard Biesheuvel, linux-arm-kernel
Now that the minimum supported version of LLVM for building the kernel
has been bumped to 15.0.0, the first depends line of
ARM_HAS_GROUP_RELOCS is always true, so it can be safely removed.
Combine the !COMPILE_TEST dependency into the 'def_bool' line and update
the comment as well.
Reviewed-by: Kees Cook <kees@kernel.org>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
Cc: Russell King <linux@armlinux.org.uk>
Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org
---
arch/arm/Kconfig | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index b1f3df39ed40..faf83015b961 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -166,15 +166,12 @@ config ARM
<http://www.arm.linux.org.uk/>.
config ARM_HAS_GROUP_RELOCS
- def_bool y
- depends on !LD_IS_LLD || LLD_VERSION >= 140000
- depends on !COMPILE_TEST
+ def_bool !COMPILE_TEST
help
Whether or not to use R_ARM_ALU_PC_Gn or R_ARM_LDR_PC_Gn group
- relocations, which have been around for a long time, but were not
- supported in LLD until version 14. The combined range is -/+ 256 MiB,
- which is usually sufficient, but not for allyesconfig, so we disable
- this feature when doing compile testing.
+ relocations. The combined range is -/+ 256 MiB, which is usually
+ sufficient, but not for allyesconfig, so we disable this feature
+ when doing compile testing.
config ARM_DMA_USE_IOMMU
bool
--
2.50.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 04/12] arm64: Remove tautological LLVM Kconfig conditions
2025-08-21 21:15 [PATCH v2 00/12] Bump minimum supported version of LLVM for building the kernel to 15.0.0 Nathan Chancellor
2025-08-21 21:15 ` [PATCH v2 03/12] ARM: Clean up definition of ARM_HAS_GROUP_RELOCS Nathan Chancellor
@ 2025-08-21 21:15 ` Nathan Chancellor
2025-08-29 22:33 ` [PATCH v2 00/12] Bump minimum supported version of LLVM for building the kernel to 15.0.0 Nathan Chancellor
2 siblings, 0 replies; 7+ messages in thread
From: Nathan Chancellor @ 2025-08-21 21:15 UTC (permalink / raw)
To: linux-kernel
Cc: Arnd Bergmann, Kees Cook, Nick Desaulniers, Bill Wendling,
Justin Stitt, llvm, patches, Will Deacon, Nathan Chancellor,
linux-arm-kernel
Now that the minimum supported version of LLVM for building the kernel
has been bumped to 15.0.0, two sets of always true conditions can be
safely removed in the arm64 Kconfig file.
Acked-by: Will Deacon <will@kernel.org>
Reviewed-by: Kees Cook <kees@kernel.org>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
Cc: linux-arm-kernel@lists.infradead.org
---
arch/arm64/Kconfig | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index e9bbfacc35a6..41c05562e9af 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -1492,8 +1492,6 @@ choice
config CPU_BIG_ENDIAN
bool "Build big-endian kernel"
- # https://github.com/llvm/llvm-project/commit/1379b150991f70a5782e9a143c2ba5308da1161c
- depends on AS_IS_GNU || AS_VERSION >= 150000
help
Say Y if you plan on running a kernel with a big-endian userspace.
@@ -2363,8 +2361,7 @@ config STACKPROTECTOR_PER_TASK
config UNWIND_PATCH_PAC_INTO_SCS
bool "Enable shadow call stack dynamically using code patching"
- # needs Clang with https://github.com/llvm/llvm-project/commit/de07cde67b5d205d58690be012106022aea6d2b3 incorporated
- depends on CC_IS_CLANG && CLANG_VERSION >= 150000
+ depends on CC_IS_CLANG
depends on ARM64_PTR_AUTH_KERNEL && CC_HAS_BRANCH_PROT_PAC_RET
depends on SHADOW_CALL_STACK
select UNWIND_TABLES
--
2.50.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 03/12] ARM: Clean up definition of ARM_HAS_GROUP_RELOCS
2025-08-21 21:15 ` [PATCH v2 03/12] ARM: Clean up definition of ARM_HAS_GROUP_RELOCS Nathan Chancellor
@ 2025-08-22 7:05 ` Arnd Bergmann
2025-08-22 20:03 ` Arnd Bergmann
0 siblings, 1 reply; 7+ messages in thread
From: Arnd Bergmann @ 2025-08-22 7:05 UTC (permalink / raw)
To: Nathan Chancellor, linux-kernel
Cc: Kees Cook, Nick Desaulniers, Bill Wendling, Justin Stitt, llvm,
patches, Russell King, Ard Biesheuvel, linux-arm-kernel
On Thu, Aug 21, 2025, at 23:15, Nathan Chancellor wrote:
> Now that the minimum supported version of LLVM for building the kernel
> has been bumped to 15.0.0, the first depends line of
> ARM_HAS_GROUP_RELOCS is always true, so it can be safely removed.
> Combine the !COMPILE_TEST dependency into the 'def_bool' line and update
> the comment as well.
>
> Reviewed-by: Kees Cook <kees@kernel.org>
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
>.
>
> config ARM_HAS_GROUP_RELOCS
> - def_bool y
> - depends on !LD_IS_LLD || LLD_VERSION >= 140000
> - depends on !COMPILE_TEST
> + def_bool !COMPILE_TEST
> help
> Whether or not to use R_ARM_ALU_PC_Gn or R_ARM_LDR_PC_Gn group
> - relocations, which have been around for a long time, but were not
> - supported in LLD until version 14. The combined range is -/+ 256 MiB,
> - which is usually sufficient, but not for allyesconfig, so we disable
> - this feature when doing compile testing.
The change is obviously correct by itself, but can we revisit the
question of whether the COMPILE_TEST check is still needed?
Trying it out, I single link issue using llvm-21:
ld.lld-21: error: vmlinux.a(arch/arm/kernel/entry-armv.o):(function __bad_stack: .text+0x110): relocation R_ARM_LDR_PC_G2 out of range: 10168 is not in [0, 4095]; references 'overflow_stack_ptr'
>>> defined in vmlinux.a(arch/arm/kernel/traps.o)
which is from this line
arch/arm/kernel/entry-armv.S: ldr_this_cpu_armv6 ip, overflow_stack_ptr
with the macro expanding to
.macro ldr_this_cpu_armv6, rd:req, sym:req
this_cpu_offset \rd
.globl \sym
.reloc .L0_\@, R_ARM_ALU_PC_G0_NC, \sym
.reloc .L1_\@, R_ARM_ALU_PC_G1_NC, \sym
.reloc .L2_\@, R_ARM_LDR_PC_G2, \sym
add \rd, \rd, pc
.L0_\@: sub \rd, \rd, #4
.L1_\@: sub \rd, \rd, #0
.L2_\@: ldr \rd, [\rd, #4]
.endm
Would it be possible to either change the macro or to move
the overflow_stack_ptr closer in order to completely eliminate
the CONFIG_ARM_HAS_GROUP_RELOCS symbol and have VMAP_STACK
enabled for all CONFIG_MMU builds?
Are there any other build testing issues with ARM_HAS_GROUP_RELOCS
besides the one I saw here?
Arnd
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 03/12] ARM: Clean up definition of ARM_HAS_GROUP_RELOCS
2025-08-22 7:05 ` Arnd Bergmann
@ 2025-08-22 20:03 ` Arnd Bergmann
2025-08-26 13:18 ` Ard Biesheuvel
0 siblings, 1 reply; 7+ messages in thread
From: Arnd Bergmann @ 2025-08-22 20:03 UTC (permalink / raw)
To: Nathan Chancellor, linux-kernel
Cc: Kees Cook, Nick Desaulniers, Bill Wendling, Justin Stitt, llvm,
patches, Russell King, Ard Biesheuvel, linux-arm-kernel
On Fri, Aug 22, 2025, at 09:05, Arnd Bergmann wrote:
> On Thu, Aug 21, 2025, at 23:15, Nathan Chancellor wrote:
>
> Would it be possible to either change the macro or to move
> the overflow_stack_ptr closer in order to completely eliminate
> the CONFIG_ARM_HAS_GROUP_RELOCS symbol and have VMAP_STACK
> enabled for all CONFIG_MMU builds?
>
> Are there any other build testing issues with ARM_HAS_GROUP_RELOCS
> besides the one I saw here?
With some more randconfig testing, I did come across a few
configurations that each fail with hundreds of errors like
arm-linux-gnueabi-ld: drivers/crypto/hifn_795x.o(.text+0x99c): overflow whilst splitting 0x10a61854 for group relocation R_ARM_LDR_PC_G2
so I guess we'll have to stick with the current dependency,
at least for ARMv6 and below.
Arnd
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 03/12] ARM: Clean up definition of ARM_HAS_GROUP_RELOCS
2025-08-22 20:03 ` Arnd Bergmann
@ 2025-08-26 13:18 ` Ard Biesheuvel
0 siblings, 0 replies; 7+ messages in thread
From: Ard Biesheuvel @ 2025-08-26 13:18 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Nathan Chancellor, linux-kernel, Kees Cook, Nick Desaulniers,
Bill Wendling, Justin Stitt, llvm, patches, Russell King,
linux-arm-kernel
On Fri, 22 Aug 2025 at 22:04, Arnd Bergmann <arnd@arndb.de> wrote:
>
> On Fri, Aug 22, 2025, at 09:05, Arnd Bergmann wrote:
> > On Thu, Aug 21, 2025, at 23:15, Nathan Chancellor wrote:
> >
> > Would it be possible to either change the macro or to move
> > the overflow_stack_ptr closer in order to completely eliminate
> > the CONFIG_ARM_HAS_GROUP_RELOCS symbol and have VMAP_STACK
> > enabled for all CONFIG_MMU builds?
> >
> > Are there any other build testing issues with ARM_HAS_GROUP_RELOCS
> > besides the one I saw here?
>
> With some more randconfig testing, I did come across a few
> configurations that each fail with hundreds of errors like
>
> arm-linux-gnueabi-ld: drivers/crypto/hifn_795x.o(.text+0x99c): overflow whilst splitting 0x10a61854 for group relocation R_ARM_LDR_PC_G2
>
> so I guess we'll have to stick with the current dependency,
> at least for ARMv6 and below.
>
This is due to LOAD_SYM_ARMV6() (rather than the ldr_this_cpu_armv6
asm macro), which is used to implement get_current() on configs that
use a global variable to store the current task pointer (i.e., non-k
v6 and older). It eliminates the first of two LDRs, which would
pollute the D-cache otherwise, as every occurrence of get_current()
emits a literal into .text carrying the address of the __current
global variable. The D-cache footprint of each such literal is a
cacheline, which never contains other useful data.
(The second LDR is needed and always refers to the same address so it
does not impact D-cache efficiency)
The LOAD_SYM_ARMV6() sequence has a range of 256 MiB, which is
sufficient for any ARM kernel that can be meaningfully used in
production. However, randconfigs may produce kernels that are larger
than this, and so we need the COMPILE_TEST check if we are going to
keep the optimization, and I think it is meaningful enough to do so.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 00/12] Bump minimum supported version of LLVM for building the kernel to 15.0.0
2025-08-21 21:15 [PATCH v2 00/12] Bump minimum supported version of LLVM for building the kernel to 15.0.0 Nathan Chancellor
2025-08-21 21:15 ` [PATCH v2 03/12] ARM: Clean up definition of ARM_HAS_GROUP_RELOCS Nathan Chancellor
2025-08-21 21:15 ` [PATCH v2 04/12] arm64: Remove tautological LLVM Kconfig conditions Nathan Chancellor
@ 2025-08-29 22:33 ` Nathan Chancellor
2 siblings, 0 replies; 7+ messages in thread
From: Nathan Chancellor @ 2025-08-29 22:33 UTC (permalink / raw)
To: linux-kernel, Nathan Chancellor
Cc: Arnd Bergmann, Kees Cook, Nick Desaulniers, Bill Wendling,
Justin Stitt, llvm, patches, Nicolas Schier, linux-kbuild,
linux-hardening, Russell King, Ard Biesheuvel, linux-arm-kernel,
Will Deacon, Thomas Bogendoerfer, linux-mips, Madhavan Srinivasan,
Michael Ellerman, Nicholas Piggin, Christophe Leroy, linuxppc-dev,
Palmer Dabbelt, Alexandre Ghiti, linux-riscv, Marco Elver,
Peter Zijlstra (Intel), kasan-dev
On Thu, 21 Aug 2025 14:15:37 -0700, Nathan Chancellor wrote:
> s390 and x86 have required LLVM 15 since
>
> 30d17fac6aae ("scripts/min-tool-version.sh: raise minimum clang version to 15.0.0 for s390")
> 7861640aac52 ("x86/build: Raise the minimum LLVM version to 15.0.0")
>
> respectively. This series bumps the rest of the kernel to 15.0.0 to
> match, which allows for a decent number of clean ups.
>
> [...]
Applied, thanks!
[01/12] kbuild: Bump minimum version of LLVM for building the kernel to 15.0.0
https://git.kernel.org/kbuild/c/20c0989283564
[02/12] arch/Kconfig: Drop always true condition from RANDOMIZE_KSTACK_OFFSET
https://git.kernel.org/kbuild/c/65aebf6f5880e
[03/12] ARM: Clean up definition of ARM_HAS_GROUP_RELOCS
https://git.kernel.org/kbuild/c/02aba266e391f
[04/12] arm64: Remove tautological LLVM Kconfig conditions
https://git.kernel.org/kbuild/c/23cb0514208da
[05/12] mips: Unconditionally select ARCH_HAS_CURRENT_STACK_POINTER
https://git.kernel.org/kbuild/c/e633c2e78fd1c
[06/12] powerpc: Drop unnecessary initializations in __copy_inst_from_kernel_nofault()
https://git.kernel.org/kbuild/c/488954ca195d0
[07/12] riscv: Remove version check for LTO_CLANG selects
https://git.kernel.org/kbuild/c/6578a1ff6aa49
[08/12] riscv: Unconditionally use linker relaxation
https://git.kernel.org/kbuild/c/7ccbe91796d7b
[09/12] riscv: Remove ld.lld version checks from many TOOLCHAIN_HAS configs
https://git.kernel.org/kbuild/c/87b28d71396bf
[10/12] lib/Kconfig.debug: Drop CLANG_VERSION check from DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT
https://git.kernel.org/kbuild/c/a817de20091c3
[11/12] objtool: Drop noinstr hack for KCSAN_WEAK_MEMORY
https://git.kernel.org/kbuild/c/573ad421cc551
[12/12] KMSAN: Remove tautological checks
https://git.kernel.org/kbuild/c/5ff8c11775c74
Best regards,
--
Nathan Chancellor <nathan@kernel.org>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-08-30 0:52 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-21 21:15 [PATCH v2 00/12] Bump minimum supported version of LLVM for building the kernel to 15.0.0 Nathan Chancellor
2025-08-21 21:15 ` [PATCH v2 03/12] ARM: Clean up definition of ARM_HAS_GROUP_RELOCS Nathan Chancellor
2025-08-22 7:05 ` Arnd Bergmann
2025-08-22 20:03 ` Arnd Bergmann
2025-08-26 13:18 ` Ard Biesheuvel
2025-08-21 21:15 ` [PATCH v2 04/12] arm64: Remove tautological LLVM Kconfig conditions Nathan Chancellor
2025-08-29 22:33 ` [PATCH v2 00/12] Bump minimum supported version of LLVM for building the kernel to 15.0.0 Nathan Chancellor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).