-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
RISC-V inline assembly ignores clobber constraints #60392
Comments
Digging into this issue, it seems if you use the canonical register names in the clobber list (i.e., |
I have just landed https://reviews.llvm.org/rL368303, which solves the problem of using abi names for you on RISC-V. This has not been backported to the 9.0 branch, and I don't know if we plan to, so you might have to wait a little bit for this to work. Sadly I couldn't find a cross-target way of doing this, so the same issue will arise on Mips. |
We're still hitting this in RISC-V Tock with a January-2020-ish nightly compiler. Has the Apr 2019 LLVM fix not made it into rustc yet, or could it be a new bug? |
As of right now, asm clobbers of specific registers in Rust only work with the registers' x-style names, not the a/t/ra names. See rust-lang/rust#60392.
As of right now, asm clobbers of specific registers in Rust only work with the registers' x-style names, not the a/t/ra names. Fixes tock#139. See rust-lang/rust#60392.
LLVM 10.0 has not yet been released (but there are release candidates for it) I think rust-lang is still using https://github.com/rust-lang/llvm-project/tree/rustc/9.0-2019-12-19 (judging by the .gitmodules on rust-lang's master). This does not contain the commit that fixed the problem. The good news is it looks like rust-lang is getting ready to update to LLVM 10.0 (you'll see there's a 10.0 branch in rust-lang/llvm-project), and that branch does contain the fix. |
Thanks, @lenary! We've worked around this locally in Tock. |
This issue does not apply to the new The legacy |
This code:
When compiled for the riscv64imac target (and other riscv targets):
Produces code which uses the clobbered registers to pass in values, resulting in the inputs being overwritten before they can be used:
See also: #60391
The text was updated successfully, but these errors were encountered: