-
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
RISC-V -mcmodel=medium #59802
Comments
great ! |
Greetings from Oxidize! It'd be great if someone could bump LLVM, so we can start adding support for Linux/RV64 targets. It was suggested @alexcrichton might be the person to ping about this. @asb Is there a specific LLVM version you would recommend? I assume we want at least llvm/llvm-project@da20f5c, but I imagine there may be other upstream fixes that are needed. Thanks! CCing @Disasm @jamesmunns |
@arunthomas Rust can already target bare metal Rv64 (with the riscv64imac-unknown-none-elf target). What is missing is the ability to place the code/symbols* at locations outside the range [-2GB, 2GB]. That isn't too much of an issue for writing supervisor mode code which can just configure the MMU to map those addresses to point to RAM, but machine mode can't pick the memory layout of the board it runs on. *You actually can get away with having code outside this range as long as there aren't any indirect jumps or static variables there. It is very restrictive and inconvenient, but you might be able to get away with it for a small amount of code. |
I also really want these patches to be merged. I've already tried to merge upstream branch as well as to deduce a cherry-pick-able set of commits but failed in both cases. Because of that, I can't tell whether these patches will fix the issue or not. At the moment I'm stuck waiting for help. I'm ready to give it another try, but I need some guidance. Maybe @alexcrichton or @asb could help me? |
There's instructions/rationale about updating LLVM hosted at https://rust-lang.github.io/rustc-guide/codegen/updating-llvm.html. Instructions are slightly out of date but I'll send a PR to fix them. |
(Current status) This patch arrived in LLVM: llvm/llvm-project@a524036 |
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
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
LLVM recently added some support for mcmodel=medium (which is equivalent to GCC's mcmodel=medany). I believe that this means that it is now possible to cherry pick the relevant commits and expose support from Rust.
See also: rust-embedded/wg/issues/218
The text was updated successfully, but these errors were encountered: