Re: [PATCH v2 1/3] arm64: rust: Enable Rust support for AArch64

Boqun Feng
2023-08-15T18:01:00Z

On Thu, Jun 29, 2023 at 12:46:13PM -0700, Boqun Feng wrote:
> On Mon, Jun 12, 2023 at 04:26:39PM +0100, Jamie Cunliffe wrote:
> > > I don't think you need "-fp-armv8" here, because "aarch64-unknown-none"
> > > target doesn't have the target-feature "fp-arm64":
> > >
> > > rustc +1.68.2 --print cfg --target aarch64-unknown-none | grep target_feature
> > >
> > > target_feature="neon"
> > >
> > > , and having the "-fp-armv8" gave me a warning at compile time:
> > >
> > > RUSTC L rust/core.o warning: unknown feature specified for `-Ctarget-feature`: `fp-armv8`
> > > |
> > > = note: it is still passed through to the codegen backend
> > > = help: consider filing a feature request
> >
> > Rust removed the fp feature for arm64 and tied it with Neon. However
> > this initially had a bug that meant it couldn't be disabled. This has
> > now been fixed in https://github.com/rust-lang/rust/pull/107294 so
> > once we can update rustc we can fix that warning by removing the
> > `-fp-armv8`. Until we do that we still need the `-fp-armv8` otherwise
> > we will get some floating point usage. This can be seen by doing an
> > objdump of core.o if you build after removing the `-fp-armv8`.
> >
>
> Thanks for the information (and the fix)! That's good to know. Looks
> like the fix will be in 1.71, then agree, we should keep `-fp-armv8`
> until we update to 1.71 or later.
>

Just FYI, rustc has been bumped to 1.71:

https://lore.kernel.org/rust-for-linux/CANiq72mrzALO3J2VvDntscXwt7Z9KzT4+S8sc_HGc8u8izjyLw@mail.gmail.com/

BTW, recently I learned that ARCH is set as "x86" by default even on
x86_64 host, so things like:

+ifeq ($(ARCH),x86_64)
+$(obj)/core.o: scripts/target.json
+endif

"ifeq .." will return false if compiled with "make LLVM=1" even on a
x86_64 host. Maybe use

ifdef CONFIG_X86_64

?

Regards,
Boqun

> Regards,
> Boqun
>
> >
> > You can also see that fp-armv8 is enabled in the aarch64-unknown-none target
> > here: https://raw.githubusercontent.com/rust-lang/rust/master/compiler/rustc_target/src/spec/aarch64_unknown_none.rs
> >
> >
> > Thanks,
> > Jamie.