1

I'm cross-compiling a Rust program to armv8 / aarch64 with the aarch64-unknown-linux-musl target. Building fails during linking due to a number of missing symbols all related to soft floats (addtf3, multf3, subtf3 and more). These are referenced by vfprintf in ~/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/aarch64-unknown-linux-musl/lib/liblibc-f904a5ce7e6fe846.rlib.

Is this a bug in the aarch64-unknown-linux-musl target? As I understand from aarch64 Linux Hard float or soft float soft floats are not supported by GCC on aarch64. Does that extend to Rust?

Or is there some other way to configure Rust not to include references to soft float functions?

Aderstedt
  • 6,301
  • 5
  • 28
  • 44
  • 1
    Seems like [you're not the first with this problem](https://github.com/rust-lang/compiler-builtins/issues/201). That thread points to [this](https://github.com/rust-lang/rust/issues/46651) comment saying that compiling with the `--link-arg=-lgcc` should work. And you should be able to put it in `./.cargo/config.toml` as described [here](https://stackoverflow.com/a/50646443/9363973) – MindSwipe Nov 13 '20 at 14:30

1 Answers1

0

Based on MindSwipe's comment, soft-floats are provided by libgcc. I added this to my config.toml:

[target.aarch64-unknown-linux-musl]
linker = "aarch64-linux-musleabi-gcc"
rustflags = [ "-C", "target-feature=+crt-static", "-C", "link-arg=-lgcc" ]
Aderstedt
  • 6,301
  • 5
  • 28
  • 44