[PATCH 07/10] riscv: Remove version check for LTO_CLANG selects

Nathan Chancellor posted 10 patches 1 month, 2 weeks ago
There is a newer version of this series
[PATCH 07/10] riscv: Remove version check for LTO_CLANG selects
Posted by Nathan Chancellor 1 month, 2 weeks ago
Now that the minimum supported version of LLVM for building the kernel
has been bumped to 15.0.0, there is no need to check the LLD version
before selecting ARCH_SUPPORTS_LTO_CLANG{,_THIN} because it will always
be true.

Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Alexandre Ghiti <alex@ghiti.fr>
Cc: linux-riscv@lists.infradead.org

Small note, this will conflict with
https://lore.kernel.org/20250710-riscv-restrict-lto-to-medany-v1-1-b1dac9871ecf@kernel.org/
but I think it is simple enough to deal with.
---
 arch/riscv/Kconfig | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index a4b233a0659e..1d53bf02d0fa 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -64,9 +64,8 @@ config RISCV
 	select ARCH_SUPPORTS_DEBUG_PAGEALLOC if MMU
 	select ARCH_SUPPORTS_HUGE_PFNMAP if TRANSPARENT_HUGEPAGE
 	select ARCH_SUPPORTS_HUGETLBFS if MMU
-	# LLD >= 14: https://github.com/llvm/llvm-project/issues/50505
-	select ARCH_SUPPORTS_LTO_CLANG if LLD_VERSION >= 140000
-	select ARCH_SUPPORTS_LTO_CLANG_THIN if LLD_VERSION >= 140000
+	select ARCH_SUPPORTS_LTO_CLANG
+	select ARCH_SUPPORTS_LTO_CLANG_THIN
 	select ARCH_SUPPORTS_MSEAL_SYSTEM_MAPPINGS if 64BIT && MMU
 	select ARCH_SUPPORTS_PAGE_TABLE_CHECK if MMU
 	select ARCH_SUPPORTS_PER_VMA_LOCK if MMU

-- 
2.50.1
Re: [PATCH 07/10] riscv: Remove version check for LTO_CLANG selects
Posted by Alexandre Ghiti 1 month, 2 weeks ago
Hi Nathan,

On 8/18/25 20:57, Nathan Chancellor wrote:
> Now that the minimum supported version of LLVM for building the kernel
> has been bumped to 15.0.0, there is no need to check the LLD version
> before selecting ARCH_SUPPORTS_LTO_CLANG{,_THIN} because it will always
> be true.
>
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
> Cc: Palmer Dabbelt <palmer@dabbelt.com>
> Cc: Alexandre Ghiti <alex@ghiti.fr>
> Cc: linux-riscv@lists.infradead.org
>
> Small note, this will conflict with
> https://lore.kernel.org/20250710-riscv-restrict-lto-to-medany-v1-1-b1dac9871ecf@kernel.org/
> but I think it is simple enough to deal with.


FYI, I'll send this patch for some 6.17-rcX.


> ---
>   arch/riscv/Kconfig | 5 ++---
>   1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> index a4b233a0659e..1d53bf02d0fa 100644
> --- a/arch/riscv/Kconfig
> +++ b/arch/riscv/Kconfig
> @@ -64,9 +64,8 @@ config RISCV
>   	select ARCH_SUPPORTS_DEBUG_PAGEALLOC if MMU
>   	select ARCH_SUPPORTS_HUGE_PFNMAP if TRANSPARENT_HUGEPAGE
>   	select ARCH_SUPPORTS_HUGETLBFS if MMU
> -	# LLD >= 14: https://github.com/llvm/llvm-project/issues/50505
> -	select ARCH_SUPPORTS_LTO_CLANG if LLD_VERSION >= 140000
> -	select ARCH_SUPPORTS_LTO_CLANG_THIN if LLD_VERSION >= 140000
> +	select ARCH_SUPPORTS_LTO_CLANG
> +	select ARCH_SUPPORTS_LTO_CLANG_THIN
>   	select ARCH_SUPPORTS_MSEAL_SYSTEM_MAPPINGS if 64BIT && MMU
>   	select ARCH_SUPPORTS_PAGE_TABLE_CHECK if MMU
>   	select ARCH_SUPPORTS_PER_VMA_LOCK if MMU
>

I found another bunch of LLD_VERSION check in this file that could be 
removed:

https://elixir.bootlin.com/linux/v6.17-rc2/source/arch/riscv/Kconfig#L253
https://elixir.bootlin.com/linux/v6.17-rc2/source/arch/riscv/Kconfig#L262
https://elixir.bootlin.com/linux/v6.17-rc2/source/arch/riscv/Kconfig#L630
https://elixir.bootlin.com/linux/v6.17-rc2/source/arch/riscv/Kconfig#L731
https://elixir.bootlin.com/linux/v6.17-rc2/source/arch/riscv/Kconfig#L746
https://elixir.bootlin.com/linux/v6.17-rc2/source/arch/riscv/Kconfig#L781
https://elixir.bootlin.com/linux/v6.17-rc2/source/arch/riscv/Kconfig#L804

Thanks,

Alex
Re: [PATCH 07/10] riscv: Remove version check for LTO_CLANG selects
Posted by Nathan Chancellor 1 month, 2 weeks ago
On Wed, Aug 20, 2025 at 09:23:08AM +0200, Alexandre Ghiti wrote:
> Hi Nathan,
> 
> On 8/18/25 20:57, Nathan Chancellor wrote:
> > Now that the minimum supported version of LLVM for building the kernel
> > has been bumped to 15.0.0, there is no need to check the LLD version
> > before selecting ARCH_SUPPORTS_LTO_CLANG{,_THIN} because it will always
> > be true.
> > 
> > Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> > ---
> > Cc: Palmer Dabbelt <palmer@dabbelt.com>
> > Cc: Alexandre Ghiti <alex@ghiti.fr>
> > Cc: linux-riscv@lists.infradead.org
> > 
> > Small note, this will conflict with
> > https://lore.kernel.org/20250710-riscv-restrict-lto-to-medany-v1-1-b1dac9871ecf@kernel.org/
> > but I think it is simple enough to deal with.
> 
> FYI, I'll send this patch for some 6.17-rcX.

Thanks, that would help.

> I found another bunch of LLD_VERSION check in this file that could be
> removed:

Huh, I am very surprised that I missed those :/ thanks a lot for
catching that!

> https://elixir.bootlin.com/linux/v6.17-rc2/source/arch/riscv/Kconfig#L253

I have added a patch removing CONFIG_RISCV_USE_LINKER_RELAXATION.

> https://elixir.bootlin.com/linux/v6.17-rc2/source/arch/riscv/Kconfig#L262

I don't think this one can be currently cleaned up since it won't always
be either true or false.

> https://elixir.bootlin.com/linux/v6.17-rc2/source/arch/riscv/Kconfig#L630
> https://elixir.bootlin.com/linux/v6.17-rc2/source/arch/riscv/Kconfig#L731
> https://elixir.bootlin.com/linux/v6.17-rc2/source/arch/riscv/Kconfig#L746
> https://elixir.bootlin.com/linux/v6.17-rc2/source/arch/riscv/Kconfig#L781
> https://elixir.bootlin.com/linux/v6.17-rc2/source/arch/riscv/Kconfig#L804

I have added a patch converting those version checks to just LD_IS_LLD.

Cheers,
Nathan