Skip to content

Add riscv64gc-unknown-hermit Tier 3 target #89424

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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions compiler/rustc_target/src/spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -960,6 +960,7 @@ supported_targets! {
("msp430-none-elf", msp430_none_elf),

("aarch64-unknown-hermit", aarch64_unknown_hermit),
("riscv64gc-unknown-hermit", riscv64gc_unknown_hermit),
("x86_64-unknown-hermit", x86_64_unknown_hermit),

("x86_64-unknown-none-hermitkernel", x86_64_unknown_none_hermitkernel),
Expand Down
20 changes: 20 additions & 0 deletions compiler/rustc_target/src/spec/riscv64gc_unknown_hermit.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
use crate::spec::Target;
use crate::spec::{CodeModel, TlsModel};

pub fn target() -> Target {
let mut base = super::hermit_base::opts();
base.cpu = "generic-rv64".to_string();
base.max_atomic_width = Some(64);
base.features = "+m,+a,+f,+d,+c".to_string();
base.code_model = Some(CodeModel::Medium);
base.tls_model = TlsModel::LocalExec;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this TLS model used by default? Does the target not support InitialExec?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that InitialExec is needed since the target is not used to build shared libraries.

base.llvm_abiname = "lp64d".to_string();

Target {
llvm_target: "riscv64-unknown-hermit".to_string(),
pointer_width: 64,
data_layout: "e-m:e-p:64:64-i64:64-i128:128-n64-S128".to_string(),
arch: "riscv64".to_string(),
options: base,
}
}
2 changes: 1 addition & 1 deletion library/std/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ dlmalloc = { version = "0.2.3", features = ['rustc-dep-of-std'] }
[target.x86_64-fortanix-unknown-sgx.dependencies]
fortanix-sgx-abi = { version = "0.3.2", features = ['rustc-dep-of-std'] }

[target.'cfg(all(any(target_arch = "x86_64", target_arch = "aarch64"), target_os = "hermit"))'.dependencies]
[target.'cfg(all(any(target_arch = "x86_64", target_arch = "aarch64", target_arch = "riscv64"), target_os = "hermit"))'.dependencies]
hermit-abi = { version = "0.1.19", features = ['rustc-dep-of-std'] }

[target.wasm32-wasi.dependencies]
Expand Down
1 change: 1 addition & 0 deletions src/doc/rustc/src/platform-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ target | std | host | notes
`riscv32gc-unknown-linux-musl` | | | RISC-V Linux (kernel 5.4, musl + RISCV32 support patches)
`riscv32imc-esp-espidf` | ✓ | | RISC-V ESP-IDF
`riscv64gc-unknown-freebsd` | | | RISC-V FreeBSD
`riscv64gc-unknown-hermit` | ? | |
`riscv64gc-unknown-linux-musl` | | | RISC-V Linux (kernel 4.20, musl 1.2.0)
`s390x-unknown-linux-musl` | | | S390x Linux (kernel 2.6.32, MUSL)
`sparc-unknown-linux-gnu` | ✓ | | 32-bit SPARC Linux
Expand Down