-
Notifications
You must be signed in to change notification settings - Fork 14k
Add riscv64 uefi target #149036
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
Closed
+56
−4
Closed
Add riscv64 uefi target #149036
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
0f1a19a
target file
gjbauer 106cbdd
Merge branch 'rust-lang:main' into add-riscv64-uefi-target
gjbauer 4c1ba83
Add riscv64gc-unknown-uefi target specification
gjbauer cc2e0aa
Update UEFI targets with riscv64gc-unknown-uefi
gjbauer 9157159
Add support for RISC-V 64bit UEFI platform
gjbauer 05b624f
Add riscv64gc-unknown-uefi to supported targets
gjbauer 3aeb7ed
Refactor RISC-V UEFI target configuration
gjbauer 8a6f78f
Set LLVM ABI name to 'lp64d' for RISC-V target
gjbauer b343aa4
Adjust section flags for RISC-V architecture
gjbauer c2080d8
Refactor section_flags assignment for clarity
gjbauer fed1d01
Update architecture handling for RISC-V 64 UEFI
gjbauer 805dc8e
Change llvm_target to 'riscv64-unknown-windows'
gjbauer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
compiler/rustc_target/src/spec/targets/riscv64gc_unknown_uefi.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| use crate::spec::{ | ||
| Arch, Target, TargetMetadata, base | ||
| }; | ||
|
|
||
| pub(crate) fn target() -> Target { | ||
| // Get the base UEFI configuration | ||
| let mut base = base::uefi_msvc::opts(); | ||
|
|
||
| // Override with RISC-V specific settings | ||
| base.cpu = "generic-rv64".into(); | ||
| base.features = "+m,+a,+f,+d,+c".into(); | ||
| base.max_atomic_width = Some(64); | ||
| base.atomic_cas = true; | ||
| base.disable_redzone = true; | ||
| base.llvm_abiname = "lp64d".into(); | ||
|
|
||
| Target { | ||
| llvm_target: "riscv64-unknown-windows".into(), | ||
| metadata: TargetMetadata { | ||
| description: Some("Bare RISC-V (RV64IMAFDC ISA) UEFI".into()), | ||
| tier: Some(3), | ||
| host_tools: Some(false), | ||
| std: None, | ||
| }, | ||
| pointer_width: 64, | ||
| data_layout: "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128".into(), | ||
| arch: Arch::RiscV64, | ||
|
|
||
| options: base, | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Why is this necessary?
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.
thread 'rustc' panicked at compiler/rustc_codegen_ssa/src/back/metadata.rs:560:19:
called
Result::unwrap()on anErrvalue: Error("unimplemented architecture Riscv64 with sub-architecture None")stack backtrace:
0: 0x7fd4e3bee9cb - std::backtrace::Backtrace::create::h652c7106100133e9
1: 0x7fd4e3bee915 - std::backtrace::Backtrace::force_capture::hcbb8a9548a20f2ec
2: 0x7fd4db55d948 - std[e20d0b87aa1ec278]::panicking::update_hook::<alloc[d35db71d034d3387]::boxed::Box<rustc_driver_impl[709b8e3ce94d842e]::install_ice_hook::{closure#1}>>::{closure#0}
3: 0x7fd4e3bef91f - std::panicking::panic_with_hook::hd57cd463d793ed79
4: 0x7fd4e3bef6ca - std::panicking::panic_handler::{{closure}}::hddd6216c3fddee3b
5: 0x7fd4e3be6fe9 - std::sys::backtrace::__rust_end_short_backtrace::h5e7a56f283378525
6: 0x7fd4e3bc31ad - __rustc[256c90bb7e548b45]::rust_begin_unwind
7: 0x7fd4e3c60910 - core::panicking::panic_fmt::hf19c198748ef6a95
8: 0x7fd4e3c5f256 - core::result::unwrap_failed::he81173b5792ad6b0
9: 0x7fd4e2648404 - rustc_codegen_ssa[7f529d302ba2af36]::back::metadata::create_wrapper_file
10: 0x7fd4e25b485c - rustc_codegen_ssa[7f529d302ba2af36]::back::link::link_rlib
11: 0x7fd4e25a2008 - rustc_codegen_ssa[7f529d302ba2af36]::back::link::link_binary
12: 0x7fd4dba1f459 - <rustc_codegen_llvm[525d04dfcb951d0f]::LlvmCodegenBackend as rustc_codegen_ssa[7f529d302ba2af36]::traits::backend::CodegenBackend>::link
13: 0x7fd4db8eca19 - <rustc_interface[f3537463438a3ee8]::queries::Linker>::link
14: 0x7fd4db5b2b43 - rustc_span[eee2686a21fb97e]::create_session_globals_then::<(), rustc_interface[f3537463438a3ee8]::util::run_in_thread_with_globals<rustc_interface[f3537463438a3ee8]::util::run_in_thread_pool_with_globals<rustc_interface[f3537463438a3ee8]::interface::run_compiler<(), rustc_driver_impl[709b8e3ce94d842e]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}::{closure#0}>
15: 0x7fd4db5aa5b9 - std[e20d0b87aa1ec278]::sys::backtrace::_rust_begin_short_backtrace::<rustc_interface[f3537463438a3ee8]::util::run_in_thread_with_globals<rustc_interface[f3537463438a3ee8]::util::run_in_thread_pool_with_globals<rustc_interface[f3537463438a3ee8]::interface::run_compiler<(), rustc_driver_impl[709b8e3ce94d842e]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
16: 0x7fd4db5ad49e - <<std[e20d0b87aa1ec278]::thread::Builder>::spawn_unchecked<rustc_interface[f3537463438a3ee8]::util::run_in_thread_with_globals<rustc_interface[f3537463438a3ee8]::util::run_in_thread_pool_with_globals<rustc_interface[f3537463438a3ee8]::interface::run_compiler<(), rustc_driver_impl[709b8e3ce94d842e]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[5b293a957d0a6e5f]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
17: 0x7fd4e3be180f - std::sys::thread::unix::Thread::new::thread_start::hbaf586a9e50a98cd
18: 0x7fd4d664b9cb -
19: 0x7fd4d66cfa0c -
20: 0x0 -
rustc version: 1.93.0-dev
platform: x86_64-unknown-linux-gnu