diff options
| author | Chen Zhongyao <chen.zhongyao@zte.com.cn> | 2025-07-14 13:35:53 +0000 |
|---|---|---|
| committer | Zhongyao Chen <chen.zhongyao@zte.com.cn> | 2025-08-11 21:08:35 +0000 |
| commit | a4cf5e9eca00527082fd58356e4adc8775aeee03 (patch) | |
| tree | 958d2315f796f9f1e2ca805544bd2113807e8b65 /compiler | |
| parent | 577166503aee7290e09374da21f4045c455acfd5 (diff) | |
Add new Tier-3 target: riscv64a23-unknown-linux-gnu
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/llvm_util.rs | 6 | ||||
| -rw-r--r-- | compiler/rustc_target/src/spec/mod.rs | 1 | ||||
| -rw-r--r-- | compiler/rustc_target/src/spec/targets/riscv64a23_unknown_linux_gnu.rs | 27 | ||||
| -rw-r--r-- | compiler/rustc_target/src/target_features.rs | 113 |
4 files changed, 146 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_llvm/src/llvm_util.rs b/compiler/rustc_codegen_llvm/src/llvm_util.rs index 28d2100f478..a85a894e42c 100644 --- a/compiler/rustc_codegen_llvm/src/llvm_util.rs +++ b/compiler/rustc_codegen_llvm/src/llvm_util.rs @@ -278,7 +278,11 @@ pub(crate) fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> Option<LLVMFea None } // Filter out features that are not supported by the current LLVM version - ("riscv32" | "riscv64", "zacas") if get_version().0 < 20 => None, + ("riscv32" | "riscv64", "zacas" | "rva23s64" | "rva23u64" | "sha" | "ssnpm" | "supm") + if get_version().0 < 20 => + { + None + } ( "s390x", "message-security-assist-extension12" diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs index b9fbff8db05..d72d8bd2d08 100644 --- a/compiler/rustc_target/src/spec/mod.rs +++ b/compiler/rustc_target/src/spec/mod.rs @@ -2137,6 +2137,7 @@ supported_targets! { ("riscv64gc-unknown-none-elf", riscv64gc_unknown_none_elf), ("riscv64gc-unknown-linux-gnu", riscv64gc_unknown_linux_gnu), ("riscv64gc-unknown-linux-musl", riscv64gc_unknown_linux_musl), + ("riscv64a23-unknown-linux-gnu", riscv64a23_unknown_linux_gnu), ("sparc-unknown-none-elf", sparc_unknown_none_elf), diff --git a/compiler/rustc_target/src/spec/targets/riscv64a23_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/riscv64a23_unknown_linux_gnu.rs new file mode 100644 index 00000000000..27a0e27c969 --- /dev/null +++ b/compiler/rustc_target/src/spec/targets/riscv64a23_unknown_linux_gnu.rs @@ -0,0 +1,27 @@ +use std::borrow::Cow; + +use crate::spec::{CodeModel, SplitDebuginfo, Target, TargetMetadata, TargetOptions, base}; + +pub(crate) fn target() -> Target { + Target { + llvm_target: "riscv64-unknown-linux-gnu".into(), + metadata: TargetMetadata { + description: Some("RISC-V Linux (kernel 4.20, glibc 2.29)".into()), + tier: Some(3), + host_tools: Some(true), + std: Some(true), + }, + pointer_width: 64, + data_layout: "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128".into(), + arch: "riscv64".into(), + options: TargetOptions { + code_model: Some(CodeModel::Medium), + cpu: "generic-rv64".into(), + features: "+rva23u64,+rva23s64".into(), + llvm_abiname: "lp64d".into(), + max_atomic_width: Some(64), + supported_split_debuginfo: Cow::Borrowed(&[SplitDebuginfo::Off]), + ..base::linux_gnu::opts() + }, + } +} diff --git a/compiler/rustc_target/src/target_features.rs b/compiler/rustc_target/src/target_features.rs index 297d9ed84c5..434f6a840b6 100644 --- a/compiler/rustc_target/src/target_features.rs +++ b/compiler/rustc_target/src/target_features.rs @@ -597,6 +597,119 @@ static RISCV_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[ ), ("m", Stable, &[]), ("relax", Unstable(sym::riscv_target_feature), &[]), + ( + "rva23s64", + Unstable(sym::riscv_target_feature), + &[ + "m", + "a", + "f", + "d", + "c", + "b", + "v", + "zicsr", + "zicntr", + "zihpm", + "ziccif", + "ziccrse", + "ziccamoa", + "zicclsm", + "zic64b", + "za64rs", + "zihintpause", + "zba", + "zbb", + "zbs", + "zicbom", + "zicbop", + "zicboz", + "zfhmin", + "zkt", + "zvfhmin", + "zvbb", + "zvkt", + "zihintntl", + "zicond", + "zimop", + "zcmop", + "zcb", + "zfa", + "zawrs", + "svbare", + "svade", + "ssccptr", + "sstvecd", + "sstvala", + "sscounterenw", + "svpbmt", + "svinval", + "svnapot", + "sstc", + "sscofpmf", + "ssnpm", + "ssu64xl", + "sha", + "supm", + ], + ), + ( + "rva23u64", + Unstable(sym::riscv_target_feature), + &[ + "m", + "a", + "f", + "d", + "c", + "b", + "v", + "zicsr", + "zicntr", + "zihpm", + "ziccif", + "ziccrse", + "ziccamoa", + "zicclsm", + "zic64b", + "za64rs", + "zihintpause", + "zba", + "zbb", + "zbs", + "zicbom", + "zicbop", + "zicboz", + "zfhmin", + "zkt", + "zvfhmin", + "zvbb", + "zvkt", + "zihintntl", + "zicond", + "zimop", + "zcmop", + "zcb", + "zfa", + "zawrs", + "supm", + ], + ), + ("sha", Unstable(sym::riscv_target_feature), &[]), + ("ssccptr", Unstable(sym::riscv_target_feature), &[]), + ("sscofpmf", Unstable(sym::riscv_target_feature), &[]), + ("sscounterenw", Unstable(sym::riscv_target_feature), &[]), + ("ssnpm", Unstable(sym::riscv_target_feature), &[]), + ("sstc", Unstable(sym::riscv_target_feature), &[]), + ("sstvala", Unstable(sym::riscv_target_feature), &[]), + ("sstvecd", Unstable(sym::riscv_target_feature), &[]), + ("ssu64xl", Unstable(sym::riscv_target_feature), &[]), + ("supm", Unstable(sym::riscv_target_feature), &[]), + ("svade", Unstable(sym::riscv_target_feature), &[]), + ("svbare", Unstable(sym::riscv_target_feature), &[]), + ("svinval", Unstable(sym::riscv_target_feature), &[]), + ("svnapot", Unstable(sym::riscv_target_feature), &[]), + ("svpbmt", Unstable(sym::riscv_target_feature), &[]), ("unaligned-scalar-mem", Unstable(sym::riscv_target_feature), &[]), ("unaligned-vector-mem", Unstable(sym::riscv_target_feature), &[]), ("v", Unstable(sym::riscv_target_feature), &["zvl128b", "zve64d"]), |
