-
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
Always specify llvm_abiname
for RISC-V targets
#131807
Conversation
These commits modify compiler targets. |
This comment has been minimized.
This comment has been minimized.
03243c5
to
3ea91c0
Compare
I can't speak to the consequences of this PR, so I can't review it, sorry. All I am doing is going around and bothering everyone to get their ABIs in check, I don't actually know the technical details of how exactly to do that on each architecture. ;) r? compiler |
That sounds great! |
I think the answer is actually, surprisingly, that LLVM shrieks "DON'T!" at us. Obviously we have to actually reach codegen, but LLVM actually checks this sort of dependency for the RISCV backend. |
I wish that would be true. However, according to this, the answer is "Disabling target features required by the requested ABI will cause LLVM to ignore the ABI", which sounds less nice. |
Also we probably want to show a nicer error than have LLVM do error reporting. But it's always good to have a safety net :) |
Ah, yeah, I checked and the code that I thought might be there isn't. Sadness! |
Would it be worth asking LLVM to add such checks? For the arm backend at least that might actually be happening.
|
See <llvm/llvm-project#110383> for the arm issue.
|
I think we can make that happen, yeah. RISCV does some forms of feature dependency-checking already. |
I believe this PR that sets
@bors r+ |
…kingjubilee Rollup of 6 pull requests Successful merges: - rust-lang#130432 (rust_for_linux: -Zregparm=<N> commandline flag for X86 (rust-lang#116972)) - rust-lang#131697 (`rt::Argument`: elide lifetimes) - rust-lang#131807 (Always specify `llvm_abiname` for RISC-V targets) - rust-lang#131954 (shave 150ms off bootstrap) - rust-lang#132015 (Move const trait tests from `ui/rfcs/rfc-2632-const-trait-impl` to `ui/traits/const-traits`) - rust-lang#132017 (Update triagebot.toml) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#131807 - beetrees:riscv-target-abi, r=workingjubilee Always specify `llvm_abiname` for RISC-V targets For RISC-V targets, when `llvm_abiname` is not specified LLVM will infer the ABI from the target features, causing rust-lang#116344 to occur. This PR adds the correct `llvm_abiname` to all RISC-V targets where it is missing (which are all soft-float targets), and adds a test to prevent future RISC-V targets from accidentally omitting `llvm_abiname`. The only affect of this PR is that `-Ctarget-feature=+f` (or similar) will no longer affect the ABI on the modified targets. <!-- homu-ignore:start --> r? `@RalfJung` <!--- homu-ignore:end -->
assert_matches!(&*self.llvm_abiname, "ilp32" | "ilp32f" | "ilp32d" | "ilp32e") | ||
} | ||
"riscv64" => { | ||
assert_matches!(&*self.llvm_abiname, "lp64" | "lp64f" | "lp64d" | "lp64q") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about lp64e?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we currently don't support any rv64e targets, and we don't really (intentionally) support "this can have one of multiple ABIs" target tuples. we'll need to fix this when we cross that bridge though, so if you want to PR to fix it now, happy to take that on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
more explicitly: r? me and I'll sign off on it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took the list of ABIs from the RISC-V ABIs Specification: lp64e
is not currently mentioned anywhere in that document as it's still waiting for a 2-year-old PR to be reviewed and merged.
Assignment is not allowed on a closed PR. |
thbbbt rustbot. |
…, r=workingjubilee Remove `""` case from RISC-V `llvm_abiname` match statement For RISC-V, `""` isn't the always the same ABI as `"ilp32"`/`"lp64"` (`""` means LLVM will infer the ABI based on the enabled target features), but `create_object_file` currently assumes that it is. Since all RISC-V targets explicitly specify their ABI since rust-lang#131807, this PR removes `""` from the match arm's pattern (meaning an empty string will now fall through to the `_ => bug!` arm). r? `@workingjubilee`
Rollup merge of rust-lang#132421 - beetrees:riscv-abi-no-empty-string, r=workingjubilee Remove `""` case from RISC-V `llvm_abiname` match statement For RISC-V, `""` isn't the always the same ABI as `"ilp32"`/`"lp64"` (`""` means LLVM will infer the ABI based on the enabled target features), but `create_object_file` currently assumes that it is. Since all RISC-V targets explicitly specify their ABI since rust-lang#131807, this PR removes `""` from the match arm's pattern (meaning an empty string will now fall through to the `_ => bug!` arm). r? `@workingjubilee`
For RISC-V targets, when
llvm_abiname
is not specified LLVM will infer the ABI from the target features, causing #116344 to occur. This PR adds the correctllvm_abiname
to all RISC-V targets where it is missing (which are all soft-float targets), and adds a test to prevent future RISC-V targets from accidentally omittingllvm_abiname
. The only affect of this PR is that-Ctarget-feature=+f
(or similar) will no longer affect the ABI on the modified targets.r? @RalfJung