Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

soft float ABI used instead of hard float for riscv64gc-unknown-none-elf #83229

Closed
DieracDelta opened this issue Mar 17, 2021 · 1 comment
Closed
Labels
C-bug Category: This is a bug.

Comments

@DieracDelta
Copy link
Contributor

DieracDelta commented Mar 17, 2021

A incorrect ABI is used by llvm on the riscv64gc-unknown-none-elf target. The ABI used should be lp64d. I've included a minimum working example of this here.

Expected behavior:

cargo build --target riscv64gc-unknown-none-elf --lib

would produce a library with double float ABI due to the +d extension. What is produced is a library with a single float ABI. The ABI used can be checked by looking at the ELF header:

readelf -h target/riscv64gc-unknown-none-elf/debug/librust_uland.a

This gives back:

...
Flags:                             0x1, RVC, soft-float ABI
...

I'm expecting:

...
Flags:                             0x1, RVC, double-float ABI
...

Note that the riscv64-unknown-linux-gnu target uses the lp64d ABI as expected. Note that it's actually using the wrong ABI (not just setting bits incorrectly in the header). I'm trying to link to a C library that is compiled with the d extension and this fails during linking due to the differing ABIs in use.

@DieracDelta DieracDelta added the C-bug Category: This is a bug. label Mar 17, 2021
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Mar 17, 2021
…nknown-none-elf, r=estebank

Switch riscvgc-unknown-none-elf use lp64d ABI

Corrects rust-lang#83229 by directly specifying the target abi in the spec in the same way as is done for the `riscv64gc-unknown-linux-gnu` target [here](https://github.com/rust-lang/rust/blob/master/compiler/rustc_target/src/spec/riscv64gc_unknown_linux_gnu.rs).
@JohnTitor
Copy link
Member

Fixed by #83231.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug.
Projects
None yet
Development

No branches or pull requests

2 participants