Skip to content

Commit 015e30c

Browse files
committed
Add new Tier-3 target: riscv64a23-unknown-linux-gnu
1 parent a980cd4 commit 015e30c

File tree

5 files changed

+145
-3
lines changed

5 files changed

+145
-3
lines changed

compiler/rustc_target/src/spec/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2136,6 +2136,7 @@ supported_targets! {
21362136
("riscv64gc-unknown-none-elf", riscv64gc_unknown_none_elf),
21372137
("riscv64gc-unknown-linux-gnu", riscv64gc_unknown_linux_gnu),
21382138
("riscv64gc-unknown-linux-musl", riscv64gc_unknown_linux_musl),
2139+
("riscv64a23-unknown-linux-gnu", riscv64a23_unknown_linux_gnu),
21392140

21402141
("sparc-unknown-none-elf", sparc_unknown_none_elf),
21412142

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
use std::borrow::Cow;
2+
3+
use crate::spec::{CodeModel, SplitDebuginfo, Target, TargetMetadata, TargetOptions, base};
4+
5+
pub(crate) fn target() -> Target {
6+
Target {
7+
llvm_target: "riscv64-unknown-linux-gnu".into(),
8+
metadata: TargetMetadata {
9+
description: Some("RISC-V Linux (kernel 4.20, glibc 2.29)".into()),
10+
tier: Some(3),
11+
host_tools: Some(true),
12+
std: Some(true),
13+
},
14+
pointer_width: 64,
15+
data_layout: "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128".into(),
16+
arch: "riscv64".into(),
17+
options: TargetOptions {
18+
code_model: Some(CodeModel::Medium),
19+
cpu: "generic-rv64".into(),
20+
features: "+rva23u64,+rva23s64".into(),
21+
llvm_abiname: "lp64d".into(),
22+
max_atomic_width: Some(64),
23+
supported_split_debuginfo: Cow::Borrowed(&[SplitDebuginfo::Off]),
24+
..base::linux_gnu::opts()
25+
},
26+
}
27+
}

compiler/rustc_target/src/target_features.rs

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,119 @@ static RISCV_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
597597
),
598598
("m", Stable, &[]),
599599
("relax", Unstable(sym::riscv_target_feature), &[]),
600+
(
601+
"rva23s64",
602+
Unstable(sym::riscv_target_feature),
603+
&[
604+
"m",
605+
"a",
606+
"f",
607+
"d",
608+
"c",
609+
"b",
610+
"v",
611+
"zicsr",
612+
"zicntr",
613+
"zihpm",
614+
"ziccif",
615+
"ziccrse",
616+
"ziccamoa",
617+
"zicclsm",
618+
"zic64b",
619+
"za64rs",
620+
"zihintpause",
621+
"zba",
622+
"zbb",
623+
"zbs",
624+
"zicbom",
625+
"zicbop",
626+
"zicboz",
627+
"zfhmin",
628+
"zkt",
629+
"zvfhmin",
630+
"zvbb",
631+
"zvkt",
632+
"zihintntl",
633+
"zicond",
634+
"zimop",
635+
"zcmop",
636+
"zcb",
637+
"zfa",
638+
"zawrs",
639+
"svbare",
640+
"svade",
641+
"ssccptr",
642+
"sstvecd",
643+
"sstvala",
644+
"sscounterenw",
645+
"svpbmt",
646+
"svinval",
647+
"svnapot",
648+
"sstc",
649+
"sscofpmf",
650+
"ssnpm",
651+
"ssu64xl",
652+
"sha",
653+
"supm",
654+
],
655+
),
656+
(
657+
"rva23u64",
658+
Unstable(sym::riscv_target_feature),
659+
&[
660+
"m",
661+
"a",
662+
"f",
663+
"d",
664+
"c",
665+
"b",
666+
"v",
667+
"zicsr",
668+
"zicntr",
669+
"zihpm",
670+
"ziccif",
671+
"ziccrse",
672+
"ziccamoa",
673+
"zicclsm",
674+
"zic64b",
675+
"za64rs",
676+
"zihintpause",
677+
"zba",
678+
"zbb",
679+
"zbs",
680+
"zicbom",
681+
"zicbop",
682+
"zicboz",
683+
"zfhmin",
684+
"zkt",
685+
"zvfhmin",
686+
"zvbb",
687+
"zvkt",
688+
"zihintntl",
689+
"zicond",
690+
"zimop",
691+
"zcmop",
692+
"zcb",
693+
"zfa",
694+
"zawrs",
695+
"supm",
696+
],
697+
),
698+
("sha", Unstable(sym::riscv_target_feature), &[]),
699+
("ssccptr", Unstable(sym::riscv_target_feature), &[]),
700+
("sscofpmf", Unstable(sym::riscv_target_feature), &[]),
701+
("sscounterenw", Unstable(sym::riscv_target_feature), &[]),
702+
("ssnpm", Unstable(sym::riscv_target_feature), &[]),
703+
("sstc", Unstable(sym::riscv_target_feature), &[]),
704+
("sstvala", Unstable(sym::riscv_target_feature), &[]),
705+
("sstvecd", Unstable(sym::riscv_target_feature), &[]),
706+
("ssu64xl", Unstable(sym::riscv_target_feature), &[]),
707+
("supm", Unstable(sym::riscv_target_feature), &[]),
708+
("svade", Unstable(sym::riscv_target_feature), &[]),
709+
("svbare", Unstable(sym::riscv_target_feature), &[]),
710+
("svinval", Unstable(sym::riscv_target_feature), &[]),
711+
("svnapot", Unstable(sym::riscv_target_feature), &[]),
712+
("svpbmt", Unstable(sym::riscv_target_feature), &[]),
600713
("unaligned-scalar-mem", Unstable(sym::riscv_target_feature), &[]),
601714
("unaligned-vector-mem", Unstable(sym::riscv_target_feature), &[]),
602715
("v", Unstable(sym::riscv_target_feature), &["zvl128b", "zve64d"]),

src/bootstrap/src/core/sanity.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@ pub struct Finder {
3232
// it might not yet be included in stage0. In such cases, we handle the targets missing from stage0 in this list.
3333
//
3434
// Targets can be removed from this list once they are present in the stage0 compiler (usually by updating the beta compiler of the bootstrap).
35-
const STAGE0_MISSING_TARGETS: &[&str] = &[
36-
// just a dummy comment so the list doesn't get onelined
37-
];
35+
const STAGE0_MISSING_TARGETS: &[&str] = &["riscv64a23-unknown-linux-gnu"];
3836

3937
/// Minimum version threshold for libstdc++ required when using prebuilt LLVM
4038
/// from CI (with`llvm.download-ci-llvm` option).

tests/assembly-llvm/targets/targets-elf.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,9 @@
472472
//@ revisions: riscv64gc_unknown_linux_gnu
473473
//@ [riscv64gc_unknown_linux_gnu] compile-flags: --target riscv64gc-unknown-linux-gnu
474474
//@ [riscv64gc_unknown_linux_gnu] needs-llvm-components: riscv
475+
//@ revisions: riscv64a23_unknown_linux_gnu
476+
//@ [riscv64a23_unknown_linux_gnu] compile-flags: --target riscv64a23-unknown-linux-gnu
477+
//@ [riscv64a23_unknown_linux_gnu] needs-llvm-components: riscv
475478
//@ revisions: riscv64gc_unknown_linux_musl
476479
//@ [riscv64gc_unknown_linux_musl] compile-flags: --target riscv64gc-unknown-linux-musl
477480
//@ [riscv64gc_unknown_linux_musl] needs-llvm-components: riscv

0 commit comments

Comments
 (0)