* [PATCH 0/1] RISC-V: Fix building rust when using GCC toolchain
@ 2024-09-17 0:08 Jason Montleon
2024-09-17 0:08 ` [PATCH] " Jason Montleon
0 siblings, 1 reply; 11+ messages in thread
From: Jason Montleon @ 2024-09-17 0:08 UTC (permalink / raw)
To: ojeda, alex.gaynor, boqun.feng, gary, bjorn3_gh, benno.lossin,
a.hindborg, aliceryhl, paul.walmsley, palmer, aou, nathan,
ndesaulniers, morbo, justinstitt
Cc: rust-for-linux, linux-kernel, linux-riscv, llvm, Jason Montleon
The following patch resolves errors encountered while building on RISC-V
using the gcc toolchain with RUST_CONFIG=y
Jason Montleon (1):
RISC-V: Fix building rust when using GCC toolchain
rust/Makefile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
base-commit: ad060dbbcfcfcba624ef1a75e1d71365a98b86d8
--
2.46.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH] RISC-V: Fix building rust when using GCC toolchain
2024-09-17 0:08 [PATCH 0/1] RISC-V: Fix building rust when using GCC toolchain Jason Montleon
@ 2024-09-17 0:08 ` Jason Montleon
2024-09-17 9:35 ` Conor Dooley
2024-09-17 13:32 ` Gary Guo
0 siblings, 2 replies; 11+ messages in thread
From: Jason Montleon @ 2024-09-17 0:08 UTC (permalink / raw)
To: ojeda, alex.gaynor, boqun.feng, gary, bjorn3_gh, benno.lossin,
a.hindborg, aliceryhl, paul.walmsley, palmer, aou, nathan,
ndesaulniers, morbo, justinstitt
Cc: rust-for-linux, linux-kernel, linux-riscv, llvm, Jason Montleon,
stable
Clang does not support '-mno-riscv-attribute' resulting in the error
error: unknown argument: '-mno-riscv-attribute'
Not setting BINDGEN_TARGET_riscv results in the in the error
error: unsupported argument 'medany' to option '-mcmodel=' for target \
'unknown'
error: unknown target triple 'unknown'
Signed-off-by: Jason Montleon <jmontleo@redhat.com>
Cc: stable@vger.kernel.org
---
rust/Makefile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/rust/Makefile b/rust/Makefile
index f168d2c98a15..73eceaaae61e 100644
--- a/rust/Makefile
+++ b/rust/Makefile
@@ -228,11 +228,12 @@ bindgen_skip_c_flags := -mno-fp-ret-in-387 -mpreferred-stack-boundary=% \
-fzero-call-used-regs=% -fno-stack-clash-protection \
-fno-inline-functions-called-once -fsanitize=bounds-strict \
-fstrict-flex-arrays=% -fmin-function-alignment=% \
- --param=% --param asan-%
+ --param=% --param asan-% -mno-riscv-attribute
# Derived from `scripts/Makefile.clang`.
BINDGEN_TARGET_x86 := x86_64-linux-gnu
BINDGEN_TARGET_arm64 := aarch64-linux-gnu
+BINDGEN_TARGET_riscv := riscv64-linux-gnu
BINDGEN_TARGET := $(BINDGEN_TARGET_$(SRCARCH))
# All warnings are inhibited since GCC builds are very experimental,
base-commit: ad060dbbcfcfcba624ef1a75e1d71365a98b86d8
--
2.46.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH] RISC-V: Fix building rust when using GCC toolchain
2024-09-17 0:08 ` [PATCH] " Jason Montleon
@ 2024-09-17 9:35 ` Conor Dooley
2024-09-17 13:29 ` Gary Guo
2024-09-17 13:32 ` Gary Guo
1 sibling, 1 reply; 11+ messages in thread
From: Conor Dooley @ 2024-09-17 9:35 UTC (permalink / raw)
To: Jason Montleon, ojeda, alex.gaynor, boqun.feng, gary, bjorn3_gh,
benno.lossin, a.hindborg, aliceryhl, paul.walmsley, palmer, aou,
nathan, ndesaulniers, morbo, justinstitt
Cc: rust-for-linux, linux-kernel, linux-riscv, llvm, stable
On 17 September 2024 01:08:48 IST, Jason Montleon <jmontleo@redhat.com> wrote:
>Clang does not support '-mno-riscv-attribute' resulting in the error
>error: unknown argument: '-mno-riscv-attribute'
This appears to conflict with your subject, which cities gcc, but I suspect that's due to poor wording of the body of the commit message than a mistake in the subject.
I'd rather disable rust on riscv when building with gcc, I've never been satisfied with the interaction between gcc and rustc's libclang w.r.t. extensions.
Cheers,
Conor.
>
>Not setting BINDGEN_TARGET_riscv results in the in the error
>error: unsupported argument 'medany' to option '-mcmodel=' for target \
>'unknown'
>error: unknown target triple 'unknown'
>
>Signed-off-by: Jason Montleon <jmontleo@redhat.com>
>Cc: stable@vger.kernel.org
>---
> rust/Makefile | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
>diff --git a/rust/Makefile b/rust/Makefile
>index f168d2c98a15..73eceaaae61e 100644
>--- a/rust/Makefile
>+++ b/rust/Makefile
>@@ -228,11 +228,12 @@ bindgen_skip_c_flags := -mno-fp-ret-in-387 -mpreferred-stack-boundary=% \
> -fzero-call-used-regs=% -fno-stack-clash-protection \
> -fno-inline-functions-called-once -fsanitize=bounds-strict \
> -fstrict-flex-arrays=% -fmin-function-alignment=% \
>- --param=% --param asan-%
>+ --param=% --param asan-% -mno-riscv-attribute
>
> # Derived from `scripts/Makefile.clang`.
> BINDGEN_TARGET_x86 := x86_64-linux-gnu
> BINDGEN_TARGET_arm64 := aarch64-linux-gnu
>+BINDGEN_TARGET_riscv := riscv64-linux-gnu
> BINDGEN_TARGET := $(BINDGEN_TARGET_$(SRCARCH))
>
> # All warnings are inhibited since GCC builds are very experimental,
>
>base-commit: ad060dbbcfcfcba624ef1a75e1d71365a98b86d8
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] RISC-V: Fix building rust when using GCC toolchain
2024-09-17 9:35 ` Conor Dooley
@ 2024-09-17 13:29 ` Gary Guo
2024-09-17 15:26 ` Conor Dooley
0 siblings, 1 reply; 11+ messages in thread
From: Gary Guo @ 2024-09-17 13:29 UTC (permalink / raw)
To: Conor Dooley
Cc: Jason Montleon, ojeda, alex.gaynor, boqun.feng, bjorn3_gh,
benno.lossin, a.hindborg, aliceryhl, paul.walmsley, palmer, aou,
nathan, ndesaulniers, morbo, justinstitt, rust-for-linux,
linux-kernel, linux-riscv, llvm, stable
On Tue, 17 Sep 2024 10:35:12 +0100
Conor Dooley <conor@kernel.org> wrote:
> On 17 September 2024 01:08:48 IST, Jason Montleon <jmontleo@redhat.com> wrote:
> >Clang does not support '-mno-riscv-attribute' resulting in the error
> >error: unknown argument: '-mno-riscv-attribute'
>
> This appears to conflict with your subject, which cities gcc, but I suspect that's due to poor wording of the body of the commit message than a mistake in the subject.
> I'd rather disable rust on riscv when building with gcc, I've never been satisfied with the interaction between gcc and rustc's libclang w.r.t. extensions.
>
> Cheers,
> Conor.
Hi Conor,
What happens is that when building against GCC, Kbuild gathers flag
assuming CC is GCC, but bindgen uses clang instead. In this case, the
CC is GCC and all C code is built by GCC. We have a filtering mechanism
to only give bindgen (libclang) flags that it can understand.
While I do think this is a bit fragile, this is what I think all
distros that enable Rust use. They still prefer to build C code with
GCC. So I hope we can still keep that option around.
Best,
Gary
>
> >
> >Not setting BINDGEN_TARGET_riscv results in the in the error
> >error: unsupported argument 'medany' to option '-mcmodel=' for target \
> >'unknown'
> >error: unknown target triple 'unknown'
> >
> >Signed-off-by: Jason Montleon <jmontleo@redhat.com>
> >Cc: stable@vger.kernel.org
> >---
> > rust/Makefile | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> >diff --git a/rust/Makefile b/rust/Makefile
> >index f168d2c98a15..73eceaaae61e 100644
> >--- a/rust/Makefile
> >+++ b/rust/Makefile
> >@@ -228,11 +228,12 @@ bindgen_skip_c_flags := -mno-fp-ret-in-387 -mpreferred-stack-boundary=% \
> > -fzero-call-used-regs=% -fno-stack-clash-protection \
> > -fno-inline-functions-called-once -fsanitize=bounds-strict \
> > -fstrict-flex-arrays=% -fmin-function-alignment=% \
> >- --param=% --param asan-%
> >+ --param=% --param asan-% -mno-riscv-attribute
> >
> > # Derived from `scripts/Makefile.clang`.
> > BINDGEN_TARGET_x86 := x86_64-linux-gnu
> > BINDGEN_TARGET_arm64 := aarch64-linux-gnu
> >+BINDGEN_TARGET_riscv := riscv64-linux-gnu
> > BINDGEN_TARGET := $(BINDGEN_TARGET_$(SRCARCH))
> >
> > # All warnings are inhibited since GCC builds are very experimental,
> >
> >base-commit: ad060dbbcfcfcba624ef1a75e1d71365a98b86d8
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] RISC-V: Fix building rust when using GCC toolchain
2024-09-17 0:08 ` [PATCH] " Jason Montleon
2024-09-17 9:35 ` Conor Dooley
@ 2024-09-17 13:32 ` Gary Guo
1 sibling, 0 replies; 11+ messages in thread
From: Gary Guo @ 2024-09-17 13:32 UTC (permalink / raw)
To: Jason Montleon
Cc: ojeda, alex.gaynor, boqun.feng, bjorn3_gh, benno.lossin,
a.hindborg, aliceryhl, paul.walmsley, palmer, aou, nathan,
ndesaulniers, morbo, justinstitt, rust-for-linux, linux-kernel,
linux-riscv, llvm, stable
On Mon, 16 Sep 2024 20:08:48 -0400
Jason Montleon <jmontleo@redhat.com> wrote:
> Clang does not support '-mno-riscv-attribute' resulting in the error
> error: unknown argument: '-mno-riscv-attribute'
>
> Not setting BINDGEN_TARGET_riscv results in the in the error
> error: unsupported argument 'medany' to option '-mcmodel=' for target \
> 'unknown'
> error: unknown target triple 'unknown'
>
> Signed-off-by: Jason Montleon <jmontleo@redhat.com>
> Cc: stable@vger.kernel.org
I also carry a similar patch locally (haven't get around to submit it
yet), so I can confirm
Tested-by: Gary Guo <garyguo.net>
As Conor points out, the commit message could be improved. Perhaps add
a bit of context about the flag filtering.
Best,
Gary
> ---
> rust/Makefile | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/rust/Makefile b/rust/Makefile
> index f168d2c98a15..73eceaaae61e 100644
> --- a/rust/Makefile
> +++ b/rust/Makefile
> @@ -228,11 +228,12 @@ bindgen_skip_c_flags := -mno-fp-ret-in-387 -mpreferred-stack-boundary=% \
> -fzero-call-used-regs=% -fno-stack-clash-protection \
> -fno-inline-functions-called-once -fsanitize=bounds-strict \
> -fstrict-flex-arrays=% -fmin-function-alignment=% \
> - --param=% --param asan-%
> + --param=% --param asan-% -mno-riscv-attribute
>
> # Derived from `scripts/Makefile.clang`.
> BINDGEN_TARGET_x86 := x86_64-linux-gnu
> BINDGEN_TARGET_arm64 := aarch64-linux-gnu
> +BINDGEN_TARGET_riscv := riscv64-linux-gnu
> BINDGEN_TARGET := $(BINDGEN_TARGET_$(SRCARCH))
>
> # All warnings are inhibited since GCC builds are very experimental,
>
> base-commit: ad060dbbcfcfcba624ef1a75e1d71365a98b86d8
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] RISC-V: Fix building rust when using GCC toolchain
2024-09-17 13:29 ` Gary Guo
@ 2024-09-17 15:26 ` Conor Dooley
2024-09-26 15:40 ` Miguel Ojeda
0 siblings, 1 reply; 11+ messages in thread
From: Conor Dooley @ 2024-09-17 15:26 UTC (permalink / raw)
To: Gary Guo
Cc: Jason Montleon, ojeda, alex.gaynor, boqun.feng, bjorn3_gh,
benno.lossin, a.hindborg, aliceryhl, paul.walmsley, palmer, aou,
nathan, ndesaulniers, morbo, justinstitt, rust-for-linux,
linux-kernel, linux-riscv, llvm, stable
On 17 September 2024 15:29:50 GMT+02:00, Gary Guo <gary@garyguo.net> wrote:
>On Tue, 17 Sep 2024 10:35:12 +0100
>Conor Dooley <conor@kernel.org> wrote:
>
>> On 17 September 2024 01:08:48 IST, Jason Montleon <jmontleo@redhat.com> wrote:
>> >Clang does not support '-mno-riscv-attribute' resulting in the error
>> >error: unknown argument: '-mno-riscv-attribute'
>>
>> This appears to conflict with your subject, which cities gcc, but I suspect that's due to poor wording of the body of the commit message than a mistake in the subject.
>> I'd rather disable rust on riscv when building with gcc, I've never been satisfied with the interaction between gcc and rustc's libclang w.r.t. extensions.
>>
>> Cheers,
>> Conor.
>
>Hi Conor,
>
>What happens is that when building against GCC, Kbuild gathers flag
>assuming CC is GCC, but bindgen uses clang instead. In this case, the
>CC is GCC and all C code is built by GCC. We have a filtering mechanism
>to only give bindgen (libclang) flags that it can understand.
Yes, but unfortunately I already knew how it worked. It's not flags I am worried about, it is extensions.
Even using a libclang that doesn't match clang could be a problem, but we can at least declare that unsupported.
Not digging it out on an airport bus, but we discussed the lack of GCC support on the original patch adding riscv, and decided against it.
>
>While I do think this is a bit fragile, this is what I think all
>distros that enable Rust use. They still prefer to build C code with
>GCC. So I hope we can still keep that option around.
>
>Best,
>Gary
>
>
>>
>> >
>> >Not setting BINDGEN_TARGET_riscv results in the in the error
>> >error: unsupported argument 'medany' to option '-mcmodel=' for target \
>> >'unknown'
>> >error: unknown target triple 'unknown'
>> >
>> >Signed-off-by: Jason Montleon <jmontleo@redhat.com>
>> >Cc: stable@vger.kernel.org
>> >---
>> > rust/Makefile | 3 ++-
>> > 1 file changed, 2 insertions(+), 1 deletion(-)
>> >
>> >diff --git a/rust/Makefile b/rust/Makefile
>> >index f168d2c98a15..73eceaaae61e 100644
>> >--- a/rust/Makefile
>> >+++ b/rust/Makefile
>> >@@ -228,11 +228,12 @@ bindgen_skip_c_flags := -mno-fp-ret-in-387 -mpreferred-stack-boundary=% \
>> > -fzero-call-used-regs=% -fno-stack-clash-protection \
>> > -fno-inline-functions-called-once -fsanitize=bounds-strict \
>> > -fstrict-flex-arrays=% -fmin-function-alignment=% \
>> >- --param=% --param asan-%
>> >+ --param=% --param asan-% -mno-riscv-attribute
>> >
>> > # Derived from `scripts/Makefile.clang`.
>> > BINDGEN_TARGET_x86 := x86_64-linux-gnu
>> > BINDGEN_TARGET_arm64 := aarch64-linux-gnu
>> >+BINDGEN_TARGET_riscv := riscv64-linux-gnu
>> > BINDGEN_TARGET := $(BINDGEN_TARGET_$(SRCARCH))
>> >
>> > # All warnings are inhibited since GCC builds are very experimental,
>> >
>> >base-commit: ad060dbbcfcfcba624ef1a75e1d71365a98b86d8
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] RISC-V: Fix building rust when using GCC toolchain
2024-09-17 15:26 ` Conor Dooley
@ 2024-09-26 15:40 ` Miguel Ojeda
2024-09-26 15:56 ` Conor Dooley
0 siblings, 1 reply; 11+ messages in thread
From: Miguel Ojeda @ 2024-09-26 15:40 UTC (permalink / raw)
To: Conor Dooley
Cc: Gary Guo, Jason Montleon, ojeda, alex.gaynor, boqun.feng,
bjorn3_gh, benno.lossin, a.hindborg, aliceryhl, paul.walmsley,
palmer, aou, nathan, ndesaulniers, morbo, justinstitt,
rust-for-linux, linux-kernel, linux-riscv, llvm, stable
On Tue, Sep 17, 2024 at 5:26 PM Conor Dooley <conor@kernel.org> wrote:
>
> Yes, but unfortunately I already knew how it worked. It's not flags I am worried about, it is extensions.
> Even using a libclang that doesn't match clang could be a problem, but we can at least declare that unsupported.
> Not digging it out on an airport bus, but we discussed the lack of GCC support on the original patch adding riscv, and decided against it.
Do you mean you would prefer to avoid supporting the mixed GCC-Clang
builds? If so, do you mean you would prefer to not pick the patch,
i.e. avoid supporting this at all? (If so, then perhaps it would be a
good idea to add a comment there and perhaps a note to
https://docs.kernel.org/rust/arch-support.html).
Otherwise, please let me know if I am misunderstanding -- thanks!
Cheers,
Miguel
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] RISC-V: Fix building rust when using GCC toolchain
2024-09-26 15:40 ` Miguel Ojeda
@ 2024-09-26 15:56 ` Conor Dooley
2024-09-26 16:11 ` Miguel Ojeda
0 siblings, 1 reply; 11+ messages in thread
From: Conor Dooley @ 2024-09-26 15:56 UTC (permalink / raw)
To: Miguel Ojeda
Cc: Gary Guo, Jason Montleon, ojeda, alex.gaynor, boqun.feng,
bjorn3_gh, benno.lossin, a.hindborg, aliceryhl, paul.walmsley,
palmer, aou, nathan, ndesaulniers, morbo, justinstitt,
rust-for-linux, linux-kernel, linux-riscv, llvm, stable
[-- Attachment #1: Type: text/plain, Size: 1668 bytes --]
On Thu, Sep 26, 2024 at 05:40:19PM +0200, Miguel Ojeda wrote:
> On Tue, Sep 17, 2024 at 5:26 PM Conor Dooley <conor@kernel.org> wrote:
> >
> > Yes, but unfortunately I already knew how it worked. It's not flags I am worried about, it is extensions.
> > Even using a libclang that doesn't match clang could be a problem, but we can at least declare that unsupported.
> > Not digging it out on an airport bus, but we discussed the lack of GCC support on the original patch adding riscv, and decided against it.
>
> Do you mean you would prefer to avoid supporting the mixed GCC-Clang
> builds?
Mixed builds are allowed on the c side, since we can figure out what the
versions of each tool are. If there's a way to detect the version of
libclang in use by the rust side, then I would be okay with mixed gcc +
rustc builds.
> If so, do you mean you would prefer to not pick the patch,
> i.e. avoid supporting this at all?
Yes, I would rather this was not applied at all. My plan was to send a
patch making HAVE_RUST depend on CC_IS_CLANG, but just ain't got around
to it yet, partly cos I was kinda hoping to mention this to you guys at
LPC last week, but I never got the chance to talk to any rust people (or
go to any rust talks either!).
> (If so, then perhaps it would be a
> good idea to add a comment there and perhaps a note to
> https://docs.kernel.org/rust/arch-support.html).
Sure, I can add a comment there.
> Otherwise, please let me know if I am misunderstanding -- thanks!
In sorta related news, is there a plan for config "options" that will
allow us to detect gcc-rs or the gcc rust backend?
Cheers,
Conor.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] RISC-V: Fix building rust when using GCC toolchain
2024-09-26 15:56 ` Conor Dooley
@ 2024-09-26 16:11 ` Miguel Ojeda
2024-09-26 16:21 ` Conor Dooley
0 siblings, 1 reply; 11+ messages in thread
From: Miguel Ojeda @ 2024-09-26 16:11 UTC (permalink / raw)
To: Conor Dooley
Cc: Gary Guo, Jason Montleon, ojeda, alex.gaynor, boqun.feng,
bjorn3_gh, benno.lossin, a.hindborg, aliceryhl, paul.walmsley,
palmer, aou, nathan, ndesaulniers, morbo, justinstitt,
rust-for-linux, linux-kernel, linux-riscv, llvm, stable
On Thu, Sep 26, 2024 at 5:56 PM Conor Dooley <conor@kernel.org> wrote:
>
> Mixed builds are allowed on the c side, since we can figure out what the
I am not sure what you mean by allowed on the C side. For out-of-tree
modules you mean?
> versions of each tool are. If there's a way to detect the version of
> libclang in use by the rust side, then I would be okay with mixed gcc +
> rustc builds.
If you mean the libclang used by bindgen, yes, we have such a check
(warning) in scripts/rust_is_available.sh. We can also have it as a
Kconfig symbol if needed.
Regarding rustc's LLVM version, I wanted to have a similar check in
scripts/rust_is_available.sh (also a warning), but it would have been
quite noisy, and if LTO is not enabled it should generally be OK. So
we are adding instead a Kconfig symbol for that, which will be used
for a couple things. Gary has a WIP patch for this one.
> Yes, I would rather this was not applied at all. My plan was to send a
> patch making HAVE_RUST depend on CC_IS_CLANG, but just ain't got around
> to it yet, partly cos I was kinda hoping to mention this to you guys at
> LPC last week, but I never got the chance to talk to any rust people (or
> go to any rust talks either!).
To be clear, that `depends on` would need to be only for RISC-V, i.e.
other architectures are "OK" with those. It is really, really
experimental, as we have always warned, but some people is using it
successfully, apparently.
> Sure, I can add a comment there.
Thanks!
> In sorta related news, is there a plan for config "options" that will
> allow us to detect gcc-rs or the gcc rust backend?
gccrs is way too early to even think about that. rustc_codegen_gcc,
yeah, if needed, we can add a symbol for that when we start supporting
the backend.
Cheers,
Miguel
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] RISC-V: Fix building rust when using GCC toolchain
2024-09-26 16:11 ` Miguel Ojeda
@ 2024-09-26 16:21 ` Conor Dooley
2024-09-26 16:29 ` Miguel Ojeda
0 siblings, 1 reply; 11+ messages in thread
From: Conor Dooley @ 2024-09-26 16:21 UTC (permalink / raw)
To: Miguel Ojeda
Cc: Gary Guo, Jason Montleon, ojeda, alex.gaynor, boqun.feng,
bjorn3_gh, benno.lossin, a.hindborg, aliceryhl, paul.walmsley,
palmer, aou, nathan, ndesaulniers, morbo, justinstitt,
rust-for-linux, linux-kernel, linux-riscv, llvm, stable
[-- Attachment #1: Type: text/plain, Size: 2430 bytes --]
On Thu, Sep 26, 2024 at 06:11:17PM +0200, Miguel Ojeda wrote:
> On Thu, Sep 26, 2024 at 5:56 PM Conor Dooley <conor@kernel.org> wrote:
> >
> > Mixed builds are allowed on the c side, since we can figure out what the
>
> I am not sure what you mean by allowed on the C side. For out-of-tree
> modules you mean?
No. Things like clang + ld & gas.
I don't care about out of tree modules ;)
> > versions of each tool are. If there's a way to detect the version of
> > libclang in use by the rust side, then I would be okay with mixed gcc +
> > rustc builds.
>
> If you mean the libclang used by bindgen, yes, we have such a check
> (warning) in scripts/rust_is_available.sh. We can also have it as a
> Kconfig symbol if needed.
Okay. Short term then is deny gcc + rust, longer term is allow it with
the same caveats as the aforementioned mixed stuff.
> Regarding rustc's LLVM version, I wanted to have a similar check in
> scripts/rust_is_available.sh (also a warning), but it would have been
> quite noisy, and if LTO is not enabled it should generally be OK. So
> we are adding instead a Kconfig symbol for that, which will be used
> for a couple things. Gary has a WIP patch for this one.
Cool, I'll check that out.
> > Yes, I would rather this was not applied at all. My plan was to send a
> > patch making HAVE_RUST depend on CC_IS_CLANG, but just ain't got around
> > to it yet, partly cos I was kinda hoping to mention this to you guys at
> > LPC last week, but I never got the chance to talk to any rust people (or
> > go to any rust talks either!).
>
> To be clear, that `depends on` would need to be only for RISC-V, i.e.
> other architectures are "OK" with those. It is really, really
> experimental, as we have always warned, but some people is using it
> successfully, apparently.
Yes, just for riscv. The logic in our Kconfig menu is currently something
like
select HAVE_RUST if RUSTC_SUPPORTS_RISCV
so that would just become
select HAVE_RUST if RUSTC_SUPPORTS_RISCV && CC_IS_CLANG
>
> > Sure, I can add a comment there.
>
> Thanks!
>
> > In sorta related news, is there a plan for config "options" that will
> > allow us to detect gcc-rs or the gcc rust backend?
>
> gccrs is way too early to even think about that. rustc_codegen_gcc,
> yeah, if needed, we can add a symbol for that when we start supporting
> the backend.
Cool, sounds good.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] RISC-V: Fix building rust when using GCC toolchain
2024-09-26 16:21 ` Conor Dooley
@ 2024-09-26 16:29 ` Miguel Ojeda
0 siblings, 0 replies; 11+ messages in thread
From: Miguel Ojeda @ 2024-09-26 16:29 UTC (permalink / raw)
To: Conor Dooley
Cc: Gary Guo, Jason Montleon, ojeda, alex.gaynor, boqun.feng,
bjorn3_gh, benno.lossin, a.hindborg, aliceryhl, paul.walmsley,
palmer, aou, nathan, ndesaulniers, morbo, justinstitt,
rust-for-linux, linux-kernel, linux-riscv, llvm, stable
On Thu, Sep 26, 2024 at 6:21 PM Conor Dooley <conor@kernel.org> wrote:
>
> No. Things like clang + ld & gas.
> I don't care about out of tree modules ;)
Ah, other tools, not just the C compiler, I see -- that is why I
mentioned out-of-tree modules, because otherwise I was not sure how
you would get mix the C compiler itself, i.e. GCC and Clang.
> Yes, just for riscv. The logic in our Kconfig menu is currently something
> like
> select HAVE_RUST if RUSTC_SUPPORTS_RISCV
> so that would just become
> select HAVE_RUST if RUSTC_SUPPORTS_RISCV && CC_IS_CLANG
If that is what you think it is best for RISC-V, then sure, up to you -- thanks!
Cheers,
Miguel
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2024-09-26 16:29 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-17 0:08 [PATCH 0/1] RISC-V: Fix building rust when using GCC toolchain Jason Montleon
2024-09-17 0:08 ` [PATCH] " Jason Montleon
2024-09-17 9:35 ` Conor Dooley
2024-09-17 13:29 ` Gary Guo
2024-09-17 15:26 ` Conor Dooley
2024-09-26 15:40 ` Miguel Ojeda
2024-09-26 15:56 ` Conor Dooley
2024-09-26 16:11 ` Miguel Ojeda
2024-09-26 16:21 ` Conor Dooley
2024-09-26 16:29 ` Miguel Ojeda
2024-09-17 13:32 ` Gary Guo
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).