diff mbox series

[v1] RISC-V: disallow gcc + rust builds

Message ID 20241001-playlist-deceiving-16ece2f440f5@spud (mailing list archive)
State Superseded
Commit e52d5050a0d2919e8fe6bafa2956baff3c2affdd
Headers show
Series [v1] RISC-V: disallow gcc + rust builds | expand

Checks

Context Check Description
conchuod/vmtest-fixes-PR success PR summary
conchuod/vmtest-for-next-PR success PR summary
conchuod/patch-1-test-1 success .github/scripts/patches/tests/build_rv32_defconfig.sh took 130.52s
conchuod/patch-1-test-2 success .github/scripts/patches/tests/build_rv64_clang_allmodconfig.sh took 1214.07s
conchuod/patch-1-test-3 success .github/scripts/patches/tests/build_rv64_gcc_allmodconfig.sh took 1478.09s
conchuod/patch-1-test-4 success .github/scripts/patches/tests/build_rv64_nommu_k210_defconfig.sh took 20.77s
conchuod/patch-1-test-5 success .github/scripts/patches/tests/build_rv64_nommu_virt_defconfig.sh took 22.94s
conchuod/patch-1-test-6 warning .github/scripts/patches/tests/checkpatch.sh took 0.64s
conchuod/patch-1-test-7 success .github/scripts/patches/tests/dtb_warn_rv64.sh took 43.45s
conchuod/patch-1-test-8 success .github/scripts/patches/tests/header_inline.sh took 0.00s
conchuod/patch-1-test-9 success .github/scripts/patches/tests/kdoc.sh took 0.57s
conchuod/patch-1-test-10 success .github/scripts/patches/tests/module_param.sh took 0.01s
conchuod/patch-1-test-11 success .github/scripts/patches/tests/verify_fixes.sh took 0.02s
conchuod/patch-1-test-12 success .github/scripts/patches/tests/verify_signedoff.sh took 0.03s

Commit Message

Conor Dooley Oct. 1, 2024, 11:28 a.m. UTC
From: Conor Dooley <conor.dooley@microchip.com>

During the discussion before supporting rust on riscv, it was decided
not to support gcc yet, due to differences in extension handling
compared to llvm (only the version of libclang matching the c compiler
is supported). Recently Jason Montleon reported [1] that building with
gcc caused build issues, due to unsupported arguments being passed to
libclang. After some discussion between myself and Miguel, it is better
to disable gcc + rust builds to match the original intent, and
subsequently support it when an appropriate set of extensions can be
deduced from the version of libclang.

Closes: https://lore.kernel.org/all/20240917000848.720765-2-jmontleo@redhat.com/ [1]
Link: https://lore.kernel.org/all/20240926-battering-revolt-6c6a7827413e@spud/ [2]
Fixes: 70a57b247251a ("RISC-V: enable building 64-bit kernels with rust support")
Reported-by: Jason Montleon <jmontleo@redhat.com>
Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
---

Palmer, this is yours to take.

CC: jmontleo@redhat.com
CC: ojeda@kernel.org
CC: alex.gaynor@gmail.com
CC: boqun.feng@gmail.com
CC: gary@garyguo.net
CC: bjorn3_gh@protonmail.com
CC: benno.lossin@proton.me
CC: a.hindborg@kernel.org
CC: aliceryhl@google.com
CC: paul.walmsley@sifive.com
CC: palmer@dabbelt.com
CC: nathan@kernel.org
CC: ndesaulniers@google.com
CC: morbo@google.com
CC: justinstitt@google.com
CC: rust-for-linux@vger.kernel.org
CC: linux-riscv@lists.infradead.org
CC: llvm@lists.linux.dev
---
 Documentation/rust/arch-support.rst | 2 +-
 arch/riscv/Kconfig                  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Miguel Ojeda Oct. 1, 2024, 3:12 p.m. UTC | #1
On Tue, Oct 1, 2024 at 1:28 PM Conor Dooley <conor@kernel.org> wrote:
>
> diff --git a/Documentation/rust/arch-support.rst b/Documentation/rust/arch-support.rst
> index 750ff371570a0..54be7ddf3e57a 100644
> --- a/Documentation/rust/arch-support.rst
> +++ b/Documentation/rust/arch-support.rst
> @@ -17,7 +17,7 @@ Architecture   Level of support  Constraints
>  =============  ================  ==============================================
>  ``arm64``      Maintained        Little Endian only.
>  ``loongarch``  Maintained        \-
> -``riscv``      Maintained        ``riscv64`` only.
> +``riscv``      Maintained        ``riscv64`` and LLVM/Clang only.
>  ``um``         Maintained        \-
>  ``x86``        Maintained        ``x86_64`` only.
>  =============  ================  ==============================================
> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> index 22dc5ea4196ce..76843584960c2 100644
> --- a/arch/riscv/Kconfig
> +++ b/arch/riscv/Kconfig
> @@ -177,7 +177,7 @@ config RISCV
>         select HAVE_REGS_AND_STACK_ACCESS_API
>         select HAVE_RETHOOK if !XIP_KERNEL
>         select HAVE_RSEQ
> -       select HAVE_RUST if RUSTC_SUPPORTS_RISCV
> +       select HAVE_RUST if RUSTC_SUPPORTS_RISCV && CC_IS_CLANG
>         select HAVE_SAMPLE_FTRACE_DIRECT
>         select HAVE_SAMPLE_FTRACE_DIRECT_MULTI
>         select HAVE_STACKPROTECTOR

Acked-by: Miguel Ojeda <ojeda@kernel.org>

Cheers,
Miguel
Nathan Chancellor Oct. 1, 2024, 6:55 p.m. UTC | #2
On Tue, Oct 01, 2024 at 12:28:13PM +0100, Conor Dooley wrote:
> From: Conor Dooley <conor.dooley@microchip.com>
> 
> During the discussion before supporting rust on riscv, it was decided
> not to support gcc yet, due to differences in extension handling
> compared to llvm (only the version of libclang matching the c compiler
> is supported). Recently Jason Montleon reported [1] that building with
> gcc caused build issues, due to unsupported arguments being passed to
> libclang. After some discussion between myself and Miguel, it is better
> to disable gcc + rust builds to match the original intent, and
> subsequently support it when an appropriate set of extensions can be
> deduced from the version of libclang.
> 
> Closes: https://lore.kernel.org/all/20240917000848.720765-2-jmontleo@redhat.com/ [1]
> Link: https://lore.kernel.org/all/20240926-battering-revolt-6c6a7827413e@spud/ [2]
> Fixes: 70a57b247251a ("RISC-V: enable building 64-bit kernels with rust support")
> Reported-by: Jason Montleon <jmontleo@redhat.com>
> Signed-off-by: Conor Dooley <conor.dooley@microchip.com>

Seems like a reasonable restriction to me.

Reviewed-by: Nathan Chancellor <nathan@kernel.org>

I assume the difficulty is not in getting the libclang version itself
but actually mapping extensions to the versions and then deciding how to
make that available to the build system? Or is it more that a solution
is somewhat known but someone has to actually implement it? Sorry if
this has been talked about before.

> ---
> 
> Palmer, this is yours to take.
> 
> CC: jmontleo@redhat.com
> CC: ojeda@kernel.org
> CC: alex.gaynor@gmail.com
> CC: boqun.feng@gmail.com
> CC: gary@garyguo.net
> CC: bjorn3_gh@protonmail.com
> CC: benno.lossin@proton.me
> CC: a.hindborg@kernel.org
> CC: aliceryhl@google.com
> CC: paul.walmsley@sifive.com
> CC: palmer@dabbelt.com
> CC: nathan@kernel.org
> CC: ndesaulniers@google.com
> CC: morbo@google.com
> CC: justinstitt@google.com
> CC: rust-for-linux@vger.kernel.org
> CC: linux-riscv@lists.infradead.org
> CC: llvm@lists.linux.dev
> ---
>  Documentation/rust/arch-support.rst | 2 +-
>  arch/riscv/Kconfig                  | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/rust/arch-support.rst b/Documentation/rust/arch-support.rst
> index 750ff371570a0..54be7ddf3e57a 100644
> --- a/Documentation/rust/arch-support.rst
> +++ b/Documentation/rust/arch-support.rst
> @@ -17,7 +17,7 @@ Architecture   Level of support  Constraints
>  =============  ================  ==============================================
>  ``arm64``      Maintained        Little Endian only.
>  ``loongarch``  Maintained        \-
> -``riscv``      Maintained        ``riscv64`` only.
> +``riscv``      Maintained        ``riscv64`` and LLVM/Clang only.
>  ``um``         Maintained        \-
>  ``x86``        Maintained        ``x86_64`` only.
>  =============  ================  ==============================================
> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> index 22dc5ea4196ce..76843584960c2 100644
> --- a/arch/riscv/Kconfig
> +++ b/arch/riscv/Kconfig
> @@ -177,7 +177,7 @@ config RISCV
>  	select HAVE_REGS_AND_STACK_ACCESS_API
>  	select HAVE_RETHOOK if !XIP_KERNEL
>  	select HAVE_RSEQ
> -	select HAVE_RUST if RUSTC_SUPPORTS_RISCV
> +	select HAVE_RUST if RUSTC_SUPPORTS_RISCV && CC_IS_CLANG
>  	select HAVE_SAMPLE_FTRACE_DIRECT
>  	select HAVE_SAMPLE_FTRACE_DIRECT_MULTI
>  	select HAVE_STACKPROTECTOR
> -- 
> 2.45.2
>
Conor Dooley Oct. 1, 2024, 7:27 p.m. UTC | #3
On Tue, Oct 01, 2024 at 11:55:25AM -0700, Nathan Chancellor wrote:
> On Tue, Oct 01, 2024 at 12:28:13PM +0100, Conor Dooley wrote:
> > From: Conor Dooley <conor.dooley@microchip.com>
> > 
> > During the discussion before supporting rust on riscv, it was decided
> > not to support gcc yet, due to differences in extension handling
> > compared to llvm (only the version of libclang matching the c compiler
> > is supported). Recently Jason Montleon reported [1] that building with
> > gcc caused build issues, due to unsupported arguments being passed to
> > libclang. After some discussion between myself and Miguel, it is better
> > to disable gcc + rust builds to match the original intent, and
> > subsequently support it when an appropriate set of extensions can be
> > deduced from the version of libclang.
> > 
> > Closes: https://lore.kernel.org/all/20240917000848.720765-2-jmontleo@redhat.com/ [1]
> > Link: https://lore.kernel.org/all/20240926-battering-revolt-6c6a7827413e@spud/ [2]
> > Fixes: 70a57b247251a ("RISC-V: enable building 64-bit kernels with rust support")
> > Reported-by: Jason Montleon <jmontleo@redhat.com>
> > Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
> 
> Seems like a reasonable restriction to me.
> 
> Reviewed-by: Nathan Chancellor <nathan@kernel.org>
> 
> I assume the difficulty is not in getting the libclang version itself
> but actually mapping extensions to the versions and then deciding how to
> make that available to the build system? Or is it more that a solution
> is somewhat known but someone has to actually implement it? Sorry if
> this has been talked about before.

It's mostly that someone has to take the time to go and do it. Miguel
and I discussed getting the libclang version a bit in [2] and mapping
the versions to extensions is no different (AFAIU) to mapping the
versions to extensions for Clang, so the work in figuring that out is
mostly done. It's a matter of going off and doing it, and testing the
various mixed tool configurations and versions to make sure it works
correctly.
Alexandre Ghiti Oct. 9, 2024, 7:46 a.m. UTC | #4
Hi Conor,

On 01/10/2024 13:28, Conor Dooley wrote:
> From: Conor Dooley <conor.dooley@microchip.com>
>
> During the discussion before supporting rust on riscv, it was decided
> not to support gcc yet, due to differences in extension handling
> compared to llvm (only the version of libclang matching the c compiler
> is supported). Recently Jason Montleon reported [1] that building with
> gcc caused build issues, due to unsupported arguments being passed to
> libclang. After some discussion between myself and Miguel


I have just added "[2]" here as it seemed to be missing.

Thanks,

Alex


> , it is better
> to disable gcc + rust builds to match the original intent, and
> subsequently support it when an appropriate set of extensions can be
> deduced from the version of libclang.
>
> Closes: https://lore.kernel.org/all/20240917000848.720765-2-jmontleo@redhat.com/ [1]
> Link: https://lore.kernel.org/all/20240926-battering-revolt-6c6a7827413e@spud/ [2]
> Fixes: 70a57b247251a ("RISC-V: enable building 64-bit kernels with rust support")
> Reported-by: Jason Montleon <jmontleo@redhat.com>
> Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
> ---
>
> Palmer, this is yours to take.
>
> CC: jmontleo@redhat.com
> CC: ojeda@kernel.org
> CC: alex.gaynor@gmail.com
> CC: boqun.feng@gmail.com
> CC: gary@garyguo.net
> CC: bjorn3_gh@protonmail.com
> CC: benno.lossin@proton.me
> CC: a.hindborg@kernel.org
> CC: aliceryhl@google.com
> CC: paul.walmsley@sifive.com
> CC: palmer@dabbelt.com
> CC: nathan@kernel.org
> CC: ndesaulniers@google.com
> CC: morbo@google.com
> CC: justinstitt@google.com
> CC: rust-for-linux@vger.kernel.org
> CC: linux-riscv@lists.infradead.org
> CC: llvm@lists.linux.dev
> ---
>   Documentation/rust/arch-support.rst | 2 +-
>   arch/riscv/Kconfig                  | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/rust/arch-support.rst b/Documentation/rust/arch-support.rst
> index 750ff371570a0..54be7ddf3e57a 100644
> --- a/Documentation/rust/arch-support.rst
> +++ b/Documentation/rust/arch-support.rst
> @@ -17,7 +17,7 @@ Architecture   Level of support  Constraints
>   =============  ================  ==============================================
>   ``arm64``      Maintained        Little Endian only.
>   ``loongarch``  Maintained        \-
> -``riscv``      Maintained        ``riscv64`` only.
> +``riscv``      Maintained        ``riscv64`` and LLVM/Clang only.
>   ``um``         Maintained        \-
>   ``x86``        Maintained        ``x86_64`` only.
>   =============  ================  ==============================================
> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> index 22dc5ea4196ce..76843584960c2 100644
> --- a/arch/riscv/Kconfig
> +++ b/arch/riscv/Kconfig
> @@ -177,7 +177,7 @@ config RISCV
>   	select HAVE_REGS_AND_STACK_ACCESS_API
>   	select HAVE_RETHOOK if !XIP_KERNEL
>   	select HAVE_RSEQ
> -	select HAVE_RUST if RUSTC_SUPPORTS_RISCV
> +	select HAVE_RUST if RUSTC_SUPPORTS_RISCV && CC_IS_CLANG
>   	select HAVE_SAMPLE_FTRACE_DIRECT
>   	select HAVE_SAMPLE_FTRACE_DIRECT_MULTI
>   	select HAVE_STACKPROTECTOR
Alexandre Ghiti Oct. 9, 2024, 8:10 a.m. UTC | #5
On 09/10/2024 09:46, Alexandre Ghiti wrote:
> Hi Conor,
>
> On 01/10/2024 13:28, Conor Dooley wrote:
>> From: Conor Dooley <conor.dooley@microchip.com>
>>
>> During the discussion before supporting rust on riscv, it was decided
>> not to support gcc yet, due to differences in extension handling
>> compared to llvm (only the version of libclang matching the c compiler
>> is supported). Recently Jason Montleon reported [1] that building with
>> gcc caused build issues, due to unsupported arguments being passed to
>> libclang. After some discussion between myself and Miguel
>
>
> I have just added "[2]" here as it seemed to be missing.
>
> Thanks,
>
> Alex
>
>
>> , it is better
>> to disable gcc + rust builds to match the original intent, and
>> subsequently support it when an appropriate set of extensions can be
>> deduced from the version of libclang.
>>
>> Closes: 
>> https://lore.kernel.org/all/20240917000848.720765-2-jmontleo@redhat.com/ 
>> [1]
>> Link: 
>> https://lore.kernel.org/all/20240926-battering-revolt-6c6a7827413e@spud/ 
>> [2]
>> Fixes: 70a57b247251a ("RISC-V: enable building 64-bit kernels with 
>> rust support")


I also fixed the Fixes tag ^, it contains 13 characters instead of 12 
and added a cc: stable tag.


>> Reported-by: Jason Montleon <jmontleo@redhat.com>


And I moved this tag above the Closes tag.

Thanks,

Alex


>> Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
>> ---
>>
>> Palmer, this is yours to take.
>>
>> CC: jmontleo@redhat.com
>> CC: ojeda@kernel.org
>> CC: alex.gaynor@gmail.com
>> CC: boqun.feng@gmail.com
>> CC: gary@garyguo.net
>> CC: bjorn3_gh@protonmail.com
>> CC: benno.lossin@proton.me
>> CC: a.hindborg@kernel.org
>> CC: aliceryhl@google.com
>> CC: paul.walmsley@sifive.com
>> CC: palmer@dabbelt.com
>> CC: nathan@kernel.org
>> CC: ndesaulniers@google.com
>> CC: morbo@google.com
>> CC: justinstitt@google.com
>> CC: rust-for-linux@vger.kernel.org
>> CC: linux-riscv@lists.infradead.org
>> CC: llvm@lists.linux.dev
>> ---
>>   Documentation/rust/arch-support.rst | 2 +-
>>   arch/riscv/Kconfig                  | 2 +-
>>   2 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/Documentation/rust/arch-support.rst 
>> b/Documentation/rust/arch-support.rst
>> index 750ff371570a0..54be7ddf3e57a 100644
>> --- a/Documentation/rust/arch-support.rst
>> +++ b/Documentation/rust/arch-support.rst
>> @@ -17,7 +17,7 @@ Architecture   Level of support  Constraints
>>   =============  ================ 
>> ==============================================
>>   ``arm64``      Maintained        Little Endian only.
>>   ``loongarch``  Maintained        \-
>> -``riscv``      Maintained        ``riscv64`` only.
>> +``riscv``      Maintained        ``riscv64`` and LLVM/Clang only.
>>   ``um``         Maintained        \-
>>   ``x86``        Maintained        ``x86_64`` only.
>>   =============  ================ 
>> ==============================================
>> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
>> index 22dc5ea4196ce..76843584960c2 100644
>> --- a/arch/riscv/Kconfig
>> +++ b/arch/riscv/Kconfig
>> @@ -177,7 +177,7 @@ config RISCV
>>       select HAVE_REGS_AND_STACK_ACCESS_API
>>       select HAVE_RETHOOK if !XIP_KERNEL
>>       select HAVE_RSEQ
>> -    select HAVE_RUST if RUSTC_SUPPORTS_RISCV
>> +    select HAVE_RUST if RUSTC_SUPPORTS_RISCV && CC_IS_CLANG
>>       select HAVE_SAMPLE_FTRACE_DIRECT
>>       select HAVE_SAMPLE_FTRACE_DIRECT_MULTI
>>       select HAVE_STACKPROTECTOR
>
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv
Conor Dooley Oct. 9, 2024, 8:23 a.m. UTC | #6
On Wed, Oct 09, 2024 at 10:10:14AM +0200, Alexandre Ghiti wrote:

> > > , it is better
> > > to disable gcc + rust builds to match the original intent, and
> > > subsequently support it when an appropriate set of extensions can be
> > > deduced from the version of libclang.
> > > 
> > > Closes:
> > > https://lore.kernel.org/all/20240917000848.720765-2-jmontleo@redhat.com/
> > > [1]
> > > Link:
> > > https://lore.kernel.org/all/20240926-battering-revolt-6c6a7827413e@spud/
> > > [2]
> > > Fixes: 70a57b247251a ("RISC-V: enable building 64-bit kernels with
> > > rust support")
> 
> 
> I also fixed the Fixes tag ^, it contains 13 characters instead of 12 and
> added a cc: stable tag.

FYI, checkpatch is not an arbiter of truth, and I intentionally left the
13th character that git determined it needed to have there. Apparently
the kernel now has enough objects that there can be 12 character
collisions.
Alexandre Ghiti Oct. 9, 2024, 8:34 a.m. UTC | #7
On 09/10/2024 10:23, Conor Dooley wrote:
> On Wed, Oct 09, 2024 at 10:10:14AM +0200, Alexandre Ghiti wrote:
>
>>>> , it is better
>>>> to disable gcc + rust builds to match the original intent, and
>>>> subsequently support it when an appropriate set of extensions can be
>>>> deduced from the version of libclang.
>>>>
>>>> Closes:
>>>> https://lore.kernel.org/all/20240917000848.720765-2-jmontleo@redhat.com/
>>>> [1]
>>>> Link:
>>>> https://lore.kernel.org/all/20240926-battering-revolt-6c6a7827413e@spud/
>>>> [2]
>>>> Fixes: 70a57b247251a ("RISC-V: enable building 64-bit kernels with
>>>> rust support")
>>
>> I also fixed the Fixes tag ^, it contains 13 characters instead of 12 and
>> added a cc: stable tag.
> FYI, checkpatch is not an arbiter of truth, and I intentionally left the
> 13th character that git determined it needed to have there. Apparently
> the kernel now has enough objects that there can be 12 character
> collisions.


Ok, thanks for the explanation: do checkpatch and the documentation need 
to be updated then? Is that a known issue?

 From https://docs.kernel.org/process/submitting-patches.html:

"If your patch fixes a bug in a specific commit, e.g. you found an issue 
using git bisect, please use the ‘Fixes:’ tag with the first 12 
characters of the SHA-1 ID, and the one line summary."


>
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv
Miguel Ojeda Oct. 9, 2024, 12:52 p.m. UTC | #8
On Wed, Oct 9, 2024 at 10:34 AM Alexandre Ghiti <alex@ghiti.fr> wrote:
>
> Ok, thanks for the explanation: do checkpatch and the documentation need
> to be updated then? Is that a known issue?
>
>  From https://docs.kernel.org/process/submitting-patches.html:
>
> "If your patch fixes a bug in a specific commit, e.g. you found an issue
> using git bisect, please use the ‘Fixes:’ tag with the first 12
> characters of the SHA-1 ID, and the one line summary."

I think Geert (Cc'd) wanted to change those docs -- I am not sure if
the idea is to go with 13 or more, though.

In any case, even if there is a conflict, we have the title.

Cheers,
Miguel
patchwork-bot+linux-riscv@kernel.org Oct. 17, 2024, 4:30 p.m. UTC | #9
Hello:

This patch was applied to riscv/linux.git (fixes)
by Palmer Dabbelt <palmer@rivosinc.com>:

On Tue,  1 Oct 2024 12:28:13 +0100 you wrote:
> From: Conor Dooley <conor.dooley@microchip.com>
> 
> During the discussion before supporting rust on riscv, it was decided
> not to support gcc yet, due to differences in extension handling
> compared to llvm (only the version of libclang matching the c compiler
> is supported). Recently Jason Montleon reported [1] that building with
> gcc caused build issues, due to unsupported arguments being passed to
> libclang. After some discussion between myself and Miguel, it is better
> to disable gcc + rust builds to match the original intent, and
> subsequently support it when an appropriate set of extensions can be
> deduced from the version of libclang.
> 
> [...]

Here is the summary with links:
  - [v1] RISC-V: disallow gcc + rust builds
    https://git.kernel.org/riscv/c/e52d5050a0d2

You are awesome, thank you!
diff mbox series

Patch

diff --git a/Documentation/rust/arch-support.rst b/Documentation/rust/arch-support.rst
index 750ff371570a0..54be7ddf3e57a 100644
--- a/Documentation/rust/arch-support.rst
+++ b/Documentation/rust/arch-support.rst
@@ -17,7 +17,7 @@  Architecture   Level of support  Constraints
 =============  ================  ==============================================
 ``arm64``      Maintained        Little Endian only.
 ``loongarch``  Maintained        \-
-``riscv``      Maintained        ``riscv64`` only.
+``riscv``      Maintained        ``riscv64`` and LLVM/Clang only.
 ``um``         Maintained        \-
 ``x86``        Maintained        ``x86_64`` only.
 =============  ================  ==============================================
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 22dc5ea4196ce..76843584960c2 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -177,7 +177,7 @@  config RISCV
 	select HAVE_REGS_AND_STACK_ACCESS_API
 	select HAVE_RETHOOK if !XIP_KERNEL
 	select HAVE_RSEQ
-	select HAVE_RUST if RUSTC_SUPPORTS_RISCV
+	select HAVE_RUST if RUSTC_SUPPORTS_RISCV && CC_IS_CLANG
 	select HAVE_SAMPLE_FTRACE_DIRECT
 	select HAVE_SAMPLE_FTRACE_DIRECT_MULTI
 	select HAVE_STACKPROTECTOR