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

riscv-rt: ABI incompatibility #248

Open
rslawson opened this issue Dec 11, 2024 · 1 comment
Open

riscv-rt: ABI incompatibility #248

rslawson opened this issue Dec 11, 2024 · 1 comment

Comments

@rslawson
Copy link

rslawson commented Dec 11, 2024

I'm working on a project right now that's using a RISCV-32 core with the I, M, F, and C extensions. I know it wouldn't be too difficult to define a custom target for this, but project CI stuff would make actually doing that very difficult (I don't understand Nix). As such, I'm using riscv32imc with --target-features=+f. However, this causes something of an issue - this target uses the ilp32 ABI, but riscv-rt sees the riscvf cfg flag and thus puts some FP instructions into global assembly, which requires ilp32f (as far as I can tell?). Thus I get 33 errors of things like

error: instruction requires the following: 'F' (Single-Precision Floating-Point)
   |
note: instantiated into assembly here
  --> <inline asm>:99:1
   |
99 | fscsr x0
   | ^

error: instruction requires the following: 'F' (Single-Precision Floating-Point)
    |
note: instantiated into assembly here
   --> <inline asm>:100:5
    |
100 |     fmv.w.x f0, x0
    |     ^

So then the question is: should I just bite the bullet and figure out Nix well enough to get it happy enough to accept a custom riscv32imfc-uknown-none-elf.json, or would it be acceptable for me to add a no-float-init = [] feature to the crate that would mask out those global_asm! invocations?

@rslawson
Copy link
Author

Ah, sorry, looks like this can actually be fixed by adjusting the provisional patch at asm.rs line 22. I'll PR this soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant