mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH RESEND v4] riscv: Implement ARCH_HAS_CC_CAN_LINK
@ 2026-03-16 15:46 Thomas Weißschuh
  2026-05-22  3:08 ` patchwork-bot+linux-riscv
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Weißschuh @ 2026-03-16 15:46 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
	Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt
  Cc: linux-riscv, linux-kernel, llvm, Thomas Weißschuh

The generic CC_CAN_LINK detection relies on -m32/-m64 compiler flags.
These are not supported by riscv compilers.

Use architecture-specific logic using -mabi instead.

Prefer the 'd' ABI variant when possible as todays toolchains are most
likely to provide a libc for that one.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
---
Changes in v4:
- Add -march= for clang compatibility.
- (Sorry for the fast resend, the fixed variant was on a wrong branch)
- Link to v3: https://lore.kernel.org/r/20260227-cc-can-link-riscv-v3-1-b0baf0fff571@linutronix.de

Changes in v3:
- Rebase on v7.0-rc1
- Link to v2: https://lore.kernel.org/r/20260116-cc-can-link-riscv-v2-1-eaf362d74c90@linutronix.de

Changes in v2:
- Also handle !FPU case.
- Extend commit message.
- Link to v1: https://lore.kernel.org/r/20251222-cc-can-link-riscv-v1-1-633e39e4a60d@linutronix.de
---
 arch/riscv/Kconfig | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 90c531e6abf5..614106694224 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -25,6 +25,7 @@ config RISCV
 	select ARCH_ENABLE_SPLIT_PMD_PTLOCK if PGTABLE_LEVELS > 2
 	select ARCH_ENABLE_THP_MIGRATION if TRANSPARENT_HUGEPAGE
 	select ARCH_HAS_BINFMT_FLAT
+	select ARCH_HAS_CC_CAN_LINK
 	select ARCH_HAS_CURRENT_STACK_POINTER
 	select ARCH_HAS_DEBUG_VIRTUAL if MMU
 	select ARCH_HAS_DEBUG_VM_PGTABLE
@@ -1374,6 +1375,20 @@ config PORTABLE
 config ARCH_PROC_KCORE_TEXT
 	def_bool y
 
+config ARCH_CC_CAN_LINK
+	bool
+	default $(cc_can_link_user,-march=rv64g -mabi=lp64d) if 64BIT && FPU
+	default $(cc_can_link_user,-march=rv64g -mabi=lp64) if 64BIT
+	default $(cc_can_link_user,-march=rv32g -mabi=ilp32d) if FPU
+	default $(cc_can_link_user,-march=rv32g -mabi=ilp32)
+
+config ARCH_USERFLAGS
+	string
+	default "-march=rv64g -mabi=lp64d" if 64BIT && FPU
+	default "-march=rv64g -mabi=lp64" if 64BIT
+	default "-march=rv32g -mabi=ilp32d" if FPU
+	default "-march=rv32g -mabi=ilp32"
+
 menu "Power management options"
 
 source "kernel/power/Kconfig"

---
base-commit: 6de23f81a5e08be8fbf5e8d7e9febc72a5b5f27f
change-id: 20251222-cc-can-link-riscv-dc0304d27cf4

Best regards,
-- 
Thomas Weißschuh <thomas.weissschuh@linutronix.de>


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH RESEND v4] riscv: Implement ARCH_HAS_CC_CAN_LINK
  2026-03-16 15:46 [PATCH RESEND v4] riscv: Implement ARCH_HAS_CC_CAN_LINK Thomas Weißschuh
@ 2026-05-22  3:08 ` patchwork-bot+linux-riscv
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+linux-riscv @ 2026-05-22  3:08 UTC (permalink / raw)
  To: =?utf-8?q?Thomas_Wei=C3=9Fschuh_=3Cthomas=2Eweissschuh=40linutronix=2Ede=3E?=
  Cc: linux-riscv, pjw, palmer, aou, alex, nathan,
	nick.desaulniers+lkml, morbo, justinstitt, linux-kernel, llvm

Hello:

This patch was applied to riscv/linux.git (for-next)
by Paul Walmsley <pjw@kernel.org>:

On Mon, 16 Mar 2026 16:46:14 +0100 you wrote:
> The generic CC_CAN_LINK detection relies on -m32/-m64 compiler flags.
> These are not supported by riscv compilers.
> 
> Use architecture-specific logic using -mabi instead.
> 
> Prefer the 'd' ABI variant when possible as todays toolchains are most
> likely to provide a libc for that one.
> 
> [...]

Here is the summary with links:
  - [RESEND,v4] riscv: Implement ARCH_HAS_CC_CAN_LINK
    https://git.kernel.org/riscv/c/c586c8394c6a

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-05-22  3:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-16 15:46 [PATCH RESEND v4] riscv: Implement ARCH_HAS_CC_CAN_LINK Thomas Weißschuh
2026-05-22  3:08 ` patchwork-bot+linux-riscv

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome