-
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
Add support for pc-relative addressing on 64-bit RISC-V #62281
Conversation
r? @cramertj (rust_highfive has picked a reviewer for you, use r? to override) |
|
r? @nagisa |
Is it necessary to change the default code_model for this to work (as opposed to "just" upgrading LLVM)? |
@nagisa Yes, without medium code model LLVM uses absolute addresses. |
@bors r+
I was rhetorically asking whether just adding support requires changing defaults. In most cases, including this one, you don’t need to change defaults because people can switch to those behaviours by setting a flag or two ( |
📌 Commit c65ffa7 has been approved by |
💡 This pull request was already approved, no need to approve it again.
|
📌 Commit c65ffa7 has been approved by |
Hmm, I didn't know about this variant, thanks for pointing out! |
Add support for pc-relative addressing on 64-bit RISC-V These changes allow Rust to generate position-independent code on `riscv64` targets with code model `medium`. Closes: rust-lang#59802 See also: rust-embedded/riscv-rt#25, rust-embedded/wg#218
Rollup of 4 pull requests [2] Successful merges: - rust-lang#59800 (rustc: Remove `dylib` crate type from most rustc crates) - rust-lang#60081 (Refactor unicode.py script) - rust-lang#62270 (Move async-await tests from run-pass to ui) - rust-lang#62281 (Add support for pc-relative addressing on 64-bit RISC-V) Failed merges: r? @ghost
Add support for pc-relative addressing on 64-bit RISC-V These changes allow Rust to generate position-independent code on `riscv64` targets with code model `medium`. Closes: #59802 See also: rust-embedded/riscv-rt#25, rust-embedded/wg#218
☀️ Test successful - checks-azure, checks-travis, status-appveyor |
With rust-lang/rust#62281, rust compiles in mcmodel=medium mode by default and this work-around is no longer needed.
With rust-lang/rust#62281, rust compiles in mcmodel=medium mode by default and this work-around is no longer needed.
With rust-lang/rust#62281, rust compiles in mcmodel=medium mode which is equivalent to GCC medany. This prevents linker relocation errors code is placed outside the range `-0x80000000..0x7ffffffff`.
These changes allow Rust to generate position-independent code on
riscv64
targets with code modelmedium
.Closes: #59802
See also: rust-embedded/riscv-rt#25, rust-embedded/wg#218