Skip to content

Commit 4739390

Browse files
committed
Add new Tier-3 target: riscv64a23-unknown-linux-gnu
1 parent e05ab47 commit 4739390

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
@@ -1998,6 +1998,7 @@ supported_targets! {
19981998
("riscv64gc-unknown-none-elf", riscv64gc_unknown_none_elf),
19991999
("riscv64gc-unknown-linux-gnu", riscv64gc_unknown_linux_gnu),
20002000
("riscv64gc-unknown-linux-musl", riscv64gc_unknown_linux_musl),
2001+
("riscv64a23-unknown-linux-gnu", riscv64a23_unknown_linux_gnu),
20012002

20022003
("sparc-unknown-none-elf", sparc_unknown_none_elf),
20032004

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
@@ -532,6 +532,119 @@ static RISCV_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
532532
),
533533
("m", Stable, &[]),
534534
("relax", Unstable(sym::riscv_target_feature), &[]),
535+
(
536+
"rva23s64",
537+
Unstable(sym::riscv_target_feature),
538+
&[
539+
"m",
540+
"a",
541+
"f",
542+
"d",
543+
"c",
544+
"b",
545+
"v",
546+
"zicsr",
547+
"zicntr",
548+
"zihpm",
549+
"ziccif",
550+
"ziccrse",
551+
"ziccamoa",
552+
"zicclsm",
553+
"zic64b",
554+
"za64rs",
555+
"zihintpause",
556+
"zba",
557+
"zbb",
558+
"zbs",
559+
"zicbom",
560+
"zicbop",
561+
"zicboz",
562+
"zfhmin",
563+
"zkt",
564+
"zvfhmin",
565+
"zvbb",
566+
"zvkt",
567+
"zihintntl",
568+
"zicond",
569+
"zimop",
570+
"zcmop",
571+
"zcb",
572+
"zfa",
573+
"zawrs",
574+
"svbare",
575+
"svade",
576+
"ssccptr",
577+
"sstvecd",
578+
"sstvala",
579+
"sscounterenw",
580+
"svpbmt",
581+
"svinval",
582+
"svnapot",
583+
"sstc",
584+
"sscofpmf",
585+
"ssnpm",
586+
"ssu64xl",
587+
"sha",
588+
"supm",
589+
],
590+
),
591+
(
592+
"rva23u64",
593+
Unstable(sym::riscv_target_feature),
594+
&[
595+
"m",
596+
"a",
597+
"f",
598+
"d",
599+
"c",
600+
"b",
601+
"v",
602+
"zicsr",
603+
"zicntr",
604+
"zihpm",
605+
"ziccif",
606+
"ziccrse",
607+
"ziccamoa",
608+
"zicclsm",
609+
"zic64b",
610+
"za64rs",
611+
"zihintpause",
612+
"zba",
613+
"zbb",
614+
"zbs",
615+
"zicbom",
616+
"zicbop",
617+
"zicboz",
618+
"zfhmin",
619+
"zkt",
620+
"zvfhmin",
621+
"zvbb",
622+
"zvkt",
623+
"zihintntl",
624+
"zicond",
625+
"zimop",
626+
"zcmop",
627+
"zcb",
628+
"zfa",
629+
"zawrs",
630+
"supm",
631+
],
632+
),
633+
("sha", Unstable(sym::riscv_target_feature), &[]),
634+
("ssccptr", Unstable(sym::riscv_target_feature), &[]),
635+
("sscofpmf", Unstable(sym::riscv_target_feature), &[]),
636+
("sscounterenw", Unstable(sym::riscv_target_feature), &[]),
637+
("ssnpm", Unstable(sym::riscv_target_feature), &[]),
638+
("sstc", Unstable(sym::riscv_target_feature), &[]),
639+
("sstvala", Unstable(sym::riscv_target_feature), &[]),
640+
("sstvecd", Unstable(sym::riscv_target_feature), &[]),
641+
("ssu64xl", Unstable(sym::riscv_target_feature), &[]),
642+
("supm", Unstable(sym::riscv_target_feature), &[]),
643+
("svade", Unstable(sym::riscv_target_feature), &[]),
644+
("svbare", Unstable(sym::riscv_target_feature), &[]),
645+
("svinval", Unstable(sym::riscv_target_feature), &[]),
646+
("svnapot", Unstable(sym::riscv_target_feature), &[]),
647+
("svpbmt", Unstable(sym::riscv_target_feature), &[]),
535648
("unaligned-scalar-mem", Unstable(sym::riscv_target_feature), &[]),
536649
("unaligned-vector-mem", Unstable(sym::riscv_target_feature), &[]),
537650
("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/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)