How to cross compile to Arm V9

Hi, i got very recently access to a brand new Arm 64 V9 system and the official documentation says that, for GCC the following flags needs to be set to optimize:

-march=armv9-a: turn on cpu feature

-mcpu=neoverse-v2: turning compiled code to be best optimized for cpu

Still figuring out the flags for LLVM, but here is my actual question:

As I am currently cross compiling from an X86_64 box, I wonder if it's possible to get Rust to target and optimize for Arm V9?

I'd say target-cpu and target-feature are the rough equivalents of GCC's mcpu and march flags. I believe something like RUSTCFLAGS="--target-cpu=neoverse-v2" cargo build --release --target=aarch64-unknown-linux-gnu should generate an artefact optimized for a Linux system running on a Neoverse-V2 CPU.

3 Likes

Thank you; that is the solution.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.