* [PATCH] riscv: Implement ARCH_HAS_CC_CAN_LINK
@ 2025-12-22 8:27 Thomas Weißschuh
2026-01-16 4:50 ` Paul Walmsley
0 siblings, 1 reply; 3+ messages in thread
From: Thomas Weißschuh @ 2025-12-22 8:27 UTC (permalink / raw)
To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti
Cc: linux-riscv, linux-kernel, 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.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
---
arch/riscv/Kconfig | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 6b39f37f769a..b4c1f922eed5 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
@@ -1351,6 +1352,16 @@ config PORTABLE
config ARCH_PROC_KCORE_TEXT
def_bool y
+config ARCH_CC_CAN_LINK
+ bool
+ default $(cc_can_link_user,-mabi=lp64d) if 64BIT
+ default $(cc_can_link_user,-mabi=ilp32d)
+
+config ARCH_USERFLAGS
+ string
+ default "-mabi=lp64d" if 64BIT
+ default "-mabi=ilp32d"
+
menu "Power management options"
source "kernel/power/Kconfig"
---
base-commit: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
change-id: 20251222-cc-can-link-riscv-dc0304d27cf4
Best regards,
--
Thomas Weißschuh <thomas.weissschuh@linutronix.de>
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] riscv: Implement ARCH_HAS_CC_CAN_LINK
2025-12-22 8:27 [PATCH] riscv: Implement ARCH_HAS_CC_CAN_LINK Thomas Weißschuh
@ 2026-01-16 4:50 ` Paul Walmsley
2026-01-16 6:05 ` Thomas Weißschuh
0 siblings, 1 reply; 3+ messages in thread
From: Paul Walmsley @ 2026-01-16 4:50 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
linux-riscv, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1374 bytes --]
Hi,
On Mon, 22 Dec 2025, Thomas Weißschuh 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.
>
> Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
> ---
> arch/riscv/Kconfig | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> index 6b39f37f769a..b4c1f922eed5 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
> @@ -1351,6 +1352,16 @@ config PORTABLE
> config ARCH_PROC_KCORE_TEXT
> def_bool y
>
> +config ARCH_CC_CAN_LINK
> + bool
> + default $(cc_can_link_user,-mabi=lp64d) if 64BIT
> + default $(cc_can_link_user,-mabi=ilp32d)
> +
> +config ARCH_USERFLAGS
> + string
> + default "-mabi=lp64d" if 64BIT
> + default "-mabi=ilp32d"
> +
Any reason why this patch shouldn't use the non-d ABI variants, as the
rest of arch/riscv/Kconfig does? I suspect this may not work for
!CONFIG_FPU builds.
- Paul
[-- Attachment #2: Type: text/plain, Size: 161 bytes --]
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] riscv: Implement ARCH_HAS_CC_CAN_LINK
2026-01-16 4:50 ` Paul Walmsley
@ 2026-01-16 6:05 ` Thomas Weißschuh
0 siblings, 0 replies; 3+ messages in thread
From: Thomas Weißschuh @ 2026-01-16 6:05 UTC (permalink / raw)
To: Paul Walmsley
Cc: Palmer Dabbelt, Albert Ou, Alexandre Ghiti, linux-riscv,
linux-kernel
Hi Paul,
On Thu, Jan 15, 2026 at 09:50:20PM -0700, Paul Walmsley wrote:
> On Mon, 22 Dec 2025, Thomas Weißschuh 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.
> >
> > Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
> > ---
> > arch/riscv/Kconfig | 11 +++++++++++
> > 1 file changed, 11 insertions(+)
> >
> > diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> > index 6b39f37f769a..b4c1f922eed5 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
> > @@ -1351,6 +1352,16 @@ config PORTABLE
> > config ARCH_PROC_KCORE_TEXT
> > def_bool y
> >
> > +config ARCH_CC_CAN_LINK
> > + bool
> > + default $(cc_can_link_user,-mabi=lp64d) if 64BIT
> > + default $(cc_can_link_user,-mabi=ilp32d)
> > +
> > +config ARCH_USERFLAGS
> > + string
> > + default "-mabi=lp64d" if 64BIT
> > + default "-mabi=ilp32d"
> > +
>
> Any reason why this patch shouldn't use the non-d ABI variants, as the
> rest of arch/riscv/Kconfig does? I suspect this may not work for
> !CONFIG_FPU builds.
Toolchains tend to only provide a libc for the 'd' ABI variants.
At least the ones I checked in Debian, Arch Linux and
https://toolchains.bootlin.com/. So I'd like to prefer those to increase
the chance of CONFIG_CC_CAN_LINK=y.
I'll add dedicated clauses for FPU=n in the next revision.
It would also be possible to have non-d as a fallback for FPU=y, but it
is slightly more complex to represent and will probably never be used.
Thomas
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-01-16 6:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-22 8:27 [PATCH] riscv: Implement ARCH_HAS_CC_CAN_LINK Thomas Weißschuh
2026-01-16 4:50 ` Paul Walmsley
2026-01-16 6:05 ` Thomas Weißschuh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox