[PATCH v4 2/2] arm64: rust: Enable Rust support for AArch64

Boqun Feng boqun.feng at gmail.com
Tue Nov 28 10:29:34 PST 2023


On Tue, Oct 31, 2023 at 11:31:14AM -0700, Matthew Maurer wrote:
> On Fri, Oct 20, 2023 at 8:53 AM Jamie Cunliffe <Jamie.Cunliffe at arm.com> wrote:
> > +KBUILD_RUSTFLAGS += --target=aarch64-unknown-none -Ctarget-feature="-neon"
> If I have aarch64-unknown-none target support already installed in my
> local Rust compiler (either build a custom compiler and enable the
> target, as is my real case, or as the common case, run `rustup target
> add aarch64-unknown-none`), this produces a build error I didn't get
> from the previous target.json approach:
> 
> error[E0464]: multiple candidates for `rmeta` dependency `core` found
>   |
>   = note: candidate #1:
> /usr/local/google/home/mmaurer/android/linux/out/cache/65c6e8ea/common/rust/libcore.rmeta
>   = note: candidate #2:
> /usr/local/google/home/mmaurer/android/linux/prebuilts/rust/linux-x86/1.72.1/lib/rustlib/aarch64-unknown-none/lib/libcore-690113bb4de6f7fb.rlib
> 
> Are we sure that we want to try to use `--target=aarch64-unknown-none`
> rather than a custom target.json? If our libcore and their libcore may
> be compiled differently (and they can be, because we are controlling
> additional compilation options), it seems to me that we ought to be
> defining our own target.
> 

FWIW, the discussion around this:

	https://lore.kernel.org/rust-for-linux/20230126163552.GD29438@willie-the-truck/	

> If we really do want to go ahead with using targets directly form
> rustc, this patch should add `--sysroot=/dev/null` or a similar
> override to `rustc_library_cmd` and `rust_common_cmd` to prevent rustc
> from picking up any already installed sysroot libraries.
> 

Agreed.

Regards,
Boqun



More information about the linux-arm-kernel mailing list