Skip to content

Commit 5c6b58e

Browse files
authored
Rollup merge of rust-lang#62281 - Disasm:riscv-pic, r=nagisa
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
2 parents fe3855c + c65ffa7 commit 5c6b58e

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

src/librustc_target/spec/riscv64gc_unknown_none_elf.rs

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ pub fn target() -> TargetResult {
2323
executables: true,
2424
panic_strategy: PanicStrategy::Abort,
2525
relocation_model: "static".to_string(),
26+
code_model: Some("medium".to_string()),
2627
emit_debug_gdb_scripts: false,
2728
abi_blacklist: super::riscv_base::abi_blacklist(),
2829
eliminate_frame_pointer: false,

src/librustc_target/spec/riscv64imac_unknown_none_elf.rs

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ pub fn target() -> TargetResult {
2323
executables: true,
2424
panic_strategy: PanicStrategy::Abort,
2525
relocation_model: "static".to_string(),
26+
code_model: Some("medium".to_string()),
2627
emit_debug_gdb_scripts: false,
2728
abi_blacklist: super::riscv_base::abi_blacklist(),
2829
eliminate_frame_pointer: false,

0 commit comments

Comments
 (0)