-
Notifications
You must be signed in to change notification settings - Fork 13.4k
riscv32imc-unknown-none-elf with --target-feature=+d: cannot link files with different floating-point ABI #117847
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
The standard library for riscv32imc-unknown-none-elf is compiled without the Edit: Yeah, llvm_abiname needs to be changed too. You would need to use a custom target. For example (untested): {
"arch": "riscv32",
"atomic-cas": false,
"cpu": "generic-rv32",
"crt-objects-fallback": "false",
"data-layout": "e-m:e-p:32:32-i64:64-n32-S128",
"eh-frame-header": false,
"emit-debug-gdb-scripts": false,
"features": "+m,+c,+d",
"linker": "rust-lld",
"linker-flavor": "gnu-lld",
"llvm-target": "riscv32",
"llvm-abiname": "ilp32d",
"max-atomic-width": 0,
"panic-strategy": "abort",
"relocation-model": "static",
"target-pointer-width": "32"
} You can put this in a .json file and then pass the path to it as |
Thanks for the quick response! I guess this is already addressed in your edit, but just for completeness I did try adding build-std in And thanks for the example target! I can confirm that this allows the build to complete, and the resulting binary has the double-float ABI. I still think that the compiler should "just work" when the My (non-working)
|
|
Makes sense, thanks for the links! |
Yeah, riscv32imc-unknown-none-elf is a softfloat target. You can't just turn a softfloat target into a hardfloat target with We should ideally already error about this on the Rust side so you don't just get a linker error; that is being worked on in the threads linked above. |
Uh oh!
There was an error while loading. Please reload this page.
I tried this minimal no-std code:
Compiling it with
rustc src/main.rs --target riscv32imc-unknown-none-elf -C target-feature=+d
gives the linker errorrust-lld: error: main.main.2f941e1c5654685d-cgu.0.rcgu.o: cannot link object files with different floating-point ABI from /tmp/rustcnFzdMx/symbols.o
.I was expecting it to successfully compile a binary that uses the double-precision standard extension to the riscv ABI.
I see that this PR changed the behavior so that the float part of the ABI comes from
llvm_abiname
, and only theRVC
part comes fromtarget-feature
. Is this the intended behavior? I read on reddit (I know, it isn't canon) thattarget-feature
is the say we're supposed to use the standard riscv extensions.Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: