* [PATCH] arch: um: rust: Use the generated target.json again
@ 2024-05-29 9:33 David Gow
2024-05-30 17:00 ` Boqun Feng
2024-06-11 22:08 ` Miguel Ojeda
0 siblings, 2 replies; 4+ messages in thread
From: David Gow @ 2024-05-29 9:33 UTC (permalink / raw)
To: Rae Moar, Thomas Gleixner, Ingo Molnar, Miguel Ojeda,
H . Peter Anvin, Masahiro Yamada, Jamie Cunliffe, Catalin Marinas,
Richard Weinberger, Anton Ivanov, Johannes Berg
Cc: David Gow, kunit-dev, linux-kernel, linux-um, rust-for-linux, x86,
Wedson Almeida Filho, Borislav Petkov, Dave Hansen, Alex Gaynor,
Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
Andreas Hindborg, Alice Ryhl
The Rust compiler can take a target config from 'target.json', which is
generated by scripts/generate_rust_target.rs. It used to be that all
Linux architectures used this to generate a target.json, but now
architectures must opt-in to this, or they will default to the Rust
compiler's built-in target definition.
This is mostly okay for (64-bit) x86 and UML, except that it can
generate SSE instructions, which we can't use in the kernel. So
re-instate the custom target.json, which disables SSE (and generally
enables the 'soft-float' feature). This fixes the following compile
error:
error: <unknown>:0:0: in function _RNvMNtCs5QSdWC790r4_4core3f32f7next_up float (float): SSE register return with SSE disabled
Fixes: f82811e22b48 ("rust: Refactor the build target to allow the use of builtin targets")
Signed-off-by: David Gow <davidgow@google.com>
---
arch/x86/Makefile.um | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/x86/Makefile.um b/arch/x86/Makefile.um
index 2106a2bd152b..a46b1397ad01 100644
--- a/arch/x86/Makefile.um
+++ b/arch/x86/Makefile.um
@@ -9,6 +9,7 @@ core-y += arch/x86/crypto/
#
ifeq ($(CONFIG_CC_IS_CLANG),y)
KBUILD_CFLAGS += -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx
+KBUILD_RUSTFLAGS += --target=$(objtree)/scripts/target.json
KBUILD_RUSTFLAGS += -Ctarget-feature=-sse,-sse2,-sse3,-ssse3,-sse4.1,-sse4.2,-avx,-avx2
endif
--
2.45.1.288.g0e0cd299f1-goog
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] arch: um: rust: Use the generated target.json again
2024-05-29 9:33 [PATCH] arch: um: rust: Use the generated target.json again David Gow
@ 2024-05-30 17:00 ` Boqun Feng
2024-06-11 22:08 ` Miguel Ojeda
1 sibling, 0 replies; 4+ messages in thread
From: Boqun Feng @ 2024-05-30 17:00 UTC (permalink / raw)
To: David Gow
Cc: Rae Moar, Thomas Gleixner, Ingo Molnar, Miguel Ojeda,
H . Peter Anvin, Masahiro Yamada, Jamie Cunliffe, Catalin Marinas,
Richard Weinberger, Anton Ivanov, Johannes Berg, kunit-dev,
linux-kernel, linux-um, rust-for-linux, x86, Wedson Almeida Filho,
Borislav Petkov, Dave Hansen, Alex Gaynor, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl
On Wed, May 29, 2024 at 05:33:35PM +0800, David Gow wrote:
> The Rust compiler can take a target config from 'target.json', which is
> generated by scripts/generate_rust_target.rs. It used to be that all
> Linux architectures used this to generate a target.json, but now
> architectures must opt-in to this, or they will default to the Rust
> compiler's built-in target definition.
>
> This is mostly okay for (64-bit) x86 and UML, except that it can
> generate SSE instructions, which we can't use in the kernel. So
> re-instate the custom target.json, which disables SSE (and generally
> enables the 'soft-float' feature). This fixes the following compile
> error:
>
> error: <unknown>:0:0: in function _RNvMNtCs5QSdWC790r4_4core3f32f7next_up float (float): SSE register return with SSE disabled
>
> Fixes: f82811e22b48 ("rust: Refactor the build target to allow the use of builtin targets")
> Signed-off-by: David Gow <davidgow@google.com>
Reviewed-by: Boqun Feng <boqun.feng@gmail.com>
Regards,
Boqun
> ---
> arch/x86/Makefile.um | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/arch/x86/Makefile.um b/arch/x86/Makefile.um
> index 2106a2bd152b..a46b1397ad01 100644
> --- a/arch/x86/Makefile.um
> +++ b/arch/x86/Makefile.um
> @@ -9,6 +9,7 @@ core-y += arch/x86/crypto/
> #
> ifeq ($(CONFIG_CC_IS_CLANG),y)
> KBUILD_CFLAGS += -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx
> +KBUILD_RUSTFLAGS += --target=$(objtree)/scripts/target.json
> KBUILD_RUSTFLAGS += -Ctarget-feature=-sse,-sse2,-sse3,-ssse3,-sse4.1,-sse4.2,-avx,-avx2
> endif
>
> --
> 2.45.1.288.g0e0cd299f1-goog
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] arch: um: rust: Use the generated target.json again
2024-05-29 9:33 [PATCH] arch: um: rust: Use the generated target.json again David Gow
2024-05-30 17:00 ` Boqun Feng
@ 2024-06-11 22:08 ` Miguel Ojeda
2024-06-13 20:25 ` Richard Weinberger
1 sibling, 1 reply; 4+ messages in thread
From: Miguel Ojeda @ 2024-06-11 22:08 UTC (permalink / raw)
To: David Gow
Cc: Rae Moar, Thomas Gleixner, Ingo Molnar, Miguel Ojeda,
H . Peter Anvin, Masahiro Yamada, Jamie Cunliffe, Catalin Marinas,
Richard Weinberger, Anton Ivanov, Johannes Berg, kunit-dev,
linux-kernel, linux-um, rust-for-linux, x86, Wedson Almeida Filho,
Borislav Petkov, Dave Hansen, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl
On Wed, May 29, 2024 at 11:33 AM David Gow <davidgow@google.com> wrote:
>
> The Rust compiler can take a target config from 'target.json', which is
> generated by scripts/generate_rust_target.rs. It used to be that all
> Linux architectures used this to generate a target.json, but now
> architectures must opt-in to this, or they will default to the Rust
> compiler's built-in target definition.
>
> This is mostly okay for (64-bit) x86 and UML, except that it can
> generate SSE instructions, which we can't use in the kernel. So
> re-instate the custom target.json, which disables SSE (and generally
> enables the 'soft-float' feature). This fixes the following compile
> error:
>
> error: <unknown>:0:0: in function _RNvMNtCs5QSdWC790r4_4core3f32f7next_up float (float): SSE register return with SSE disabled
>
> Fixes: f82811e22b48 ("rust: Refactor the build target to allow the use of builtin targets")
> Signed-off-by: David Gow <davidgow@google.com>
I guess this should go through UML, but please let me know otherwise
(I don't see it in next).
Tested-by: Miguel Ojeda <ojeda@kernel.org>
Reviewed-by: Miguel Ojeda <ojeda@kernel.org>
Should this have a
Cc: stable@vger.kernel.org
too?
Thanks!
Cheers,
Miguel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] arch: um: rust: Use the generated target.json again
2024-06-11 22:08 ` Miguel Ojeda
@ 2024-06-13 20:25 ` Richard Weinberger
0 siblings, 0 replies; 4+ messages in thread
From: Richard Weinberger @ 2024-06-13 20:25 UTC (permalink / raw)
To: Miguel Ojeda
Cc: davidgow, Rae Moar, tglx, mingo, Miguel Ojeda, hpa, masahiroy,
Jamie Cunliffe, Catalin Marinas, anton ivanov, Johannes Berg,
kunit-dev, linux-kernel, linux-um, Rust for Linux Kernel, x86,
Wedson Almeida Filho, bp, dave hansen, Alex Gaynor, Boqun Feng,
Gary Guo, Björn Roy Baron, Benno Lossin, Andreas Hindborg,
Alice Ryhl
----- Ursprüngliche Mail -----
> Von: "Miguel Ojeda" <miguel.ojeda.sandonis@gmail.com>
>> Fixes: f82811e22b48 ("rust: Refactor the build target to allow the use of
>> builtin targets")
>> Signed-off-by: David Gow <davidgow@google.com>
>
> I guess this should go through UML, but please let me know otherwise
Yeah, that's the plan.
> Tested-by: Miguel Ojeda <ojeda@kernel.org>
> Reviewed-by: Miguel Ojeda <ojeda@kernel.org>
>
> Should this have a
>
> Cc: stable@vger.kernel.org
>
> too?
Ok!
Thanks,
//richard
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-06-13 20:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-29 9:33 [PATCH] arch: um: rust: Use the generated target.json again David Gow
2024-05-30 17:00 ` Boqun Feng
2024-06-11 22:08 ` Miguel Ojeda
2024-06-13 20:25 ` Richard Weinberger
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).