-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Some -Ctarget-feature
s must be restrained on RISCV
#132618
Comments
-Ctarget-feature
s be restrained on RISCV targets?-Ctarget-feature
s be restrained on RISCV?
In summary:
Notes:
|
cc @coastalwhite (as author of #116485 which got scaled back due to precisely this question!) |
Just realised I missed the |
Also I haven't included above the cases where LLVM will emit an error itself due to feature incompatibility. Checking the features mentioned #116485, those are:
In both these cases LLVM will already emit a fatal error, but it would definitely be better diagnostic UX for |
-Ctarget-feature
s be restrained on RISCV?-Ctarget-feature
s must be restrained on RISCV
Thanks for the summary! That seems pretty definite in terms of a "yes, we should", yeah. |
Wait so enabling |
Looking at the RISC-V ISA specification, the RV32E/RV64E base instruction sets are described as reduced versions of RV32I/RV64I (the only difference being fewer available GPR registers): this seems similar to the way that e.g. the Zfhmin extension is a subset of the Zfh extension. So rather than having |
technically the way it actually works is that the architectures are, from the high-level perspective,
i.e. LLVM representing it as a feature is on LLVM, and from the RISCV architectural definition perspective these are all separate "base" architectures. |
relevant to this in a slightly sideways manner: #134358 will expose a way to |
Yeah that makes sense, but it would divert from how RISCV target features are handled in other languages. Seems like a discussion for #114544.
Oh wait this is an LLVM thing after all? What does GCC do? If it's actually a different architecture then maybe marking it as "forbidden" (i.e. a target feature that is fixed by the target spec) isn't the worst idea? |
#134337 catches most of the potential ABI issues listed above. What remains are problems caused by feature implications that rustc does not know about. I have some plans here but that will have to wait for a future PR. |
…workingjubilee reject unsound toggling of RISCV target features ~~Stacked on top of rust-lang#133417, only the last commit is new.~~ Works towards rust-lang#132618 (but more [remains to be done](rust-lang#134337 (comment))) Part of rust-lang#116344 Cc `@beetrees` I hope I got everything. I didn't do anything about "The f and zfinx features are incompatible" and that's not an ABI thing (right?) and I am not sure how to handle it with these ABI checks. r? `@workingjubilee` Ideally we'd also reject target specs that disable the `f` feature but set an ABI that requires `f`... but I don't want to duplicate this logic. I have some ideas for how maybe the entire float ABI check logic should be different, now that we have some examples of what these ABI checks look like, but that will be a future PR.
…workingjubilee reject unsound toggling of RISCV target features ~~Stacked on top of rust-lang#133417, only the last commit is new.~~ Works towards rust-lang#132618 (but more [remains to be done](rust-lang#134337 (comment))) Part of rust-lang#116344 Cc ``@beetrees`` I hope I got everything. I didn't do anything about "The f and zfinx features are incompatible" and that's not an ABI thing (right?) and I am not sure how to handle it with these ABI checks. r? ``@workingjubilee`` Ideally we'd also reject target specs that disable the `f` feature but set an ABI that requires `f`... but I don't want to duplicate this logic. I have some ideas for how maybe the entire float ABI check logic should be different, now that we have some examples of what these ABI checks look like, but that will be a future PR.
Rollup merge of rust-lang#134337 - RalfJung:riscv-target-features, r=workingjubilee reject unsound toggling of RISCV target features ~~Stacked on top of rust-lang#133417, only the last commit is new.~~ Works towards rust-lang#132618 (but more [remains to be done](rust-lang#134337 (comment))) Part of rust-lang#116344 Cc ``@beetrees`` I hope I got everything. I didn't do anything about "The f and zfinx features are incompatible" and that's not an ABI thing (right?) and I am not sure how to handle it with these ABI checks. r? ``@workingjubilee`` Ideally we'd also reject target specs that disable the `f` feature but set an ABI that requires `f`... but I don't want to duplicate this logic. I have some ideas for how maybe the entire float ABI check logic should be different, now that we have some examples of what these ABI checks look like, but that will be a future PR.
I'm not sure gcc doesn't do the same thing, I'm addressing "how the specification for RISCV itself reasons about the underlying thing going on here". Essentially, the answer from the hardware architects might be that there are really 4 different
It seems doubtful we would want to actually go that route, but nonetheless! |
So... is it even worth supporting toggling the "e" feature then? We don't support toggling the target architecture, either... |
refs:
-Ctarget-feature
#116344llvm_abiname
for RISC-V targets #131807in discussion of the target modifiers RFC1, Ralf asks this question:
cc @beetrees
Footnotes
https://github.com/rust-lang/rfcs/pull/3716 ↩
The text was updated successfully, but these errors were encountered: