-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Support risc-v code models medlow, medany #22517
Comments
We may need to give |
My instinct is that we just need to add more enum variants, but I'll read the resources linked later today and formulate a full opinion. |
I assume by "the I don't really see a reason we should do that -- IMO this shouldn't just be modeled with more enum tags. If there were a huge variety of code models in the wild my opinion might differ, but it seems to me that almost all targets have some subset of what we expose right now. My opinion could be swayed if there were several more examples of weird target differences here. |
Code models are a bit of a mess because they're not always clearly defined in platform ABIs. Sometimes compilers just make some code models up and they become de-facto standardized. Some targets don't use code models at all. Some targets use different naming styles for code models. Etc. It's worth noting that Clang just maps RISC-V's |
For reference, here's what LLVM and Zig understand: Lines 142 to 149 in 3dadb8c
Here's how Clang maps |
Zig Version
0.13.0
Steps to Reproduce and Observed Behavior
According to the riscv-elf-psabi docs and the GCC risc-v options, RISC-V supports two code models named "Medium Low" aka "medlow" and "Medium Any" or "medany".
When I add the code model option to my build.zig file reproduced below, I get the following error.
Note that x86 and arm targets don't support these code models, just like risc-v does not support the kernel code model.
Expected Behavior
zig successfully compiles code with these code models.
The text was updated successfully, but these errors were encountered: