Add riscv64gc-unknown-freebsd

This commit is contained in:
Tobias Kortkamp 2021-11-27 07:23:55 +01:00
parent 3e018ce194
commit 47474f1055
No known key found for this signature in database
GPG Key ID: F4815C5F893E655D
7 changed files with 27 additions and 5 deletions

View File

@ -277,7 +277,7 @@ fn main() {
};
// RISC-V requires libatomic for sub-word atomic operations
if target.starts_with("riscv") {
if !target.contains("freebsd") && target.starts_with("riscv") {
println!("cargo:rustc-link-lib=atomic");
}

View File

@ -813,6 +813,7 @@ supported_targets! {
("powerpc-unknown-freebsd", powerpc_unknown_freebsd),
("powerpc64-unknown-freebsd", powerpc64_unknown_freebsd),
("powerpc64le-unknown-freebsd", powerpc64le_unknown_freebsd),
("riscv64gc-unknown-freebsd", riscv64gc_unknown_freebsd),
("x86_64-unknown-freebsd", x86_64_unknown_freebsd),
("x86_64-unknown-dragonfly", x86_64_unknown_dragonfly),

View File

@ -0,0 +1,18 @@
use crate::spec::{CodeModel, Target, TargetOptions};
pub fn target() -> Target {
Target {
llvm_target: "riscv64-unknown-freebsd".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: TargetOptions {
code_model: Some(CodeModel::Medium),
cpu: "generic-rv64".to_string(),
features: "+m,+a,+f,+d,+c".to_string(),
llvm_abiname: "lp64d".to_string(),
max_atomic_width: Some(64),
..super::freebsd_base::opts()
},
}
}

View File

@ -69,7 +69,8 @@ type_alias! { "char.md", c_char = u8, NonZero_c_char = NonZeroU8;
target_arch = "aarch64",
target_arch = "arm",
target_arch = "powerpc",
target_arch = "powerpc64"
target_arch = "powerpc64",
target_arch = "riscv64"
)
),
all(
@ -112,7 +113,8 @@ type_alias! { "char.md", c_char = i8, NonZero_c_char = NonZeroI8;
target_arch = "aarch64",
target_arch = "arm",
target_arch = "powerpc",
target_arch = "powerpc64"
target_arch = "powerpc64",
target_arch = "riscv64"
)
),
all(

View File

@ -265,7 +265,7 @@ def default_build_triple(verbose):
err = "unknown OS type: {}".format(ostype)
sys.exit(err)
if cputype == 'powerpc' and ostype == 'unknown-freebsd':
if cputype in ['powerpc', 'riscv'] and ostype == 'unknown-freebsd':
cputype = subprocess.check_output(
['uname', '-p']).strip().decode(default_encoding)
cputype_mapper = {

View File

@ -249,7 +249,7 @@ impl Step for Llvm {
}
}
if target.starts_with("riscv") {
if !target.contains("freebsd") && target.starts_with("riscv") {
// In RISC-V, using C++ atomics require linking to `libatomic` but the LLVM build
// system check cannot detect this. Therefore it is set manually here.
if !builder.config.llvm_tools_enabled {

View File

@ -267,6 +267,7 @@ target | std | host | notes
`riscv32gc-unknown-linux-gnu` | | | RISC-V Linux (kernel 5.4, glibc 2.33)
`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-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