]> Git Repo - linux.git/commitdiff
arm64: rust: clean Rust 1.85.0 warning using softfloat target
authorMiguel Ojeda <[email protected]>
Mon, 10 Feb 2025 16:37:32 +0000 (17:37 +0100)
committerWill Deacon <[email protected]>
Thu, 13 Feb 2025 11:45:49 +0000 (11:45 +0000)
Starting with Rust 1.85.0 (to be released 2025-02-20), `rustc` warns
[1] about disabling neon in the aarch64 hardfloat target:

    warning: target feature `neon` cannot be toggled with
             `-Ctarget-feature`: unsound on hard-float targets
             because it changes float ABI
      |
      = note: this was previously accepted by the compiler but
              is being phased out; it will become a hard error
              in a future release!
      = note: for more information, see issue #116344
              <https://github.com/rust-lang/rust/issues/116344>

Thus, instead, use the softfloat target instead.

While trying it out, I found that the kernel sanitizers were not enabled
for that built-in target [2]. Upstream Rust agreed to backport
the enablement for the current beta so that it is ready for
the 1.85.0 release [3] -- thanks!

However, that still means that before Rust 1.85.0, we cannot switch
since sanitizers could be in use. Thus conditionally do so.

Cc: [email protected] # Needed in 6.12.y and 6.13.y only (Rust is pinned in older LTSs).
Cc: Catalin Marinas <[email protected]>
Cc: Will Deacon <[email protected]>
Cc: Matthew Maurer <[email protected]>
Cc: Alice Ryhl <[email protected]>
Cc: Ralf Jung <[email protected]>
Cc: Jubilee Young <[email protected]>
Link: https://github.com/rust-lang/rust/pull/133417
Link: https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/arm64.20neon.20.60-Ctarget-feature.60.20warning/near/495358442
Link: https://github.com/rust-lang/rust/pull/135905
Link: https://github.com/rust-lang/rust/issues/116344
Signed-off-by: Miguel Ojeda <[email protected]>
Reviewed-by: Trevor Gross <[email protected]>
Tested-by: Matthew Maurer <[email protected]>
Reviewed-by: Ralf Jung <[email protected]>
Reviewed-by: Alice Ryhl <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Will Deacon <[email protected]>
arch/arm64/Makefile

index 358c68565bfd0633d8565187016e1003445208fc..2b25d671365f290d42a7f10a09194b6c5a1215ae 100644 (file)
@@ -48,7 +48,11 @@ KBUILD_CFLAGS        += $(CC_FLAGS_NO_FPU) \
 KBUILD_CFLAGS  += $(call cc-disable-warning, psabi)
 KBUILD_AFLAGS  += $(compat_vdso)
 
+ifeq ($(call test-ge, $(CONFIG_RUSTC_VERSION), 108500),y)
+KBUILD_RUSTFLAGS += --target=aarch64-unknown-none-softfloat
+else
 KBUILD_RUSTFLAGS += --target=aarch64-unknown-none -Ctarget-feature="-neon"
+endif
 
 KBUILD_CFLAGS  += $(call cc-option,-mabi=lp64)
 KBUILD_AFLAGS  += $(call cc-option,-mabi=lp64)
This page took 0.053592 seconds and 4 git commands to generate.