add rustc_codegen_ssa
support for csky and correct some code
This commit is contained in:
parent
8ed7aa16bd
commit
8c51e28bd5
7 changed files with 26 additions and 3 deletions
|
@ -209,6 +209,7 @@ pub(crate) fn create_object_file(sess: &Session) -> Option<write::Object<'static
|
|||
"hexagon" => Architecture::Hexagon,
|
||||
"bpf" => Architecture::Bpf,
|
||||
"loongarch64" => Architecture::LoongArch64,
|
||||
"csky" => Architecture::Csky,
|
||||
// Unsupported architecture.
|
||||
_ => return None,
|
||||
};
|
||||
|
@ -307,6 +308,13 @@ pub(crate) fn create_object_file(sess: &Session) -> Option<write::Object<'static
|
|||
// the appropriate EF_AVR_ARCH flag.
|
||||
ef_avr_arch(&sess.target.options.cpu)
|
||||
}
|
||||
Architecture::Csky => {
|
||||
let e_flags = match sess.target.options.abi.as_ref() {
|
||||
"abiv2" => elf::EF_CSKY_ABIV2,
|
||||
_ => elf::EF_CSKY_ABIV1,
|
||||
};
|
||||
e_flags
|
||||
}
|
||||
_ => 0,
|
||||
};
|
||||
// adapted from LLVM's `MCELFObjectTargetWriter::getOSABI`
|
||||
|
|
|
@ -296,6 +296,16 @@ const WASM_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[
|
|||
|
||||
const BPF_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[("alu32", Some(sym::bpf_target_feature))];
|
||||
|
||||
const CSKY_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[
|
||||
("hard-float", Some(sym::csky_target_feature)),
|
||||
("hard-float-abi", Some(sym::csky_target_feature)),
|
||||
("fpuv2_sf", Some(sym::csky_target_feature)),
|
||||
("fpuv2_df", Some(sym::csky_target_feature)),
|
||||
("fpuv3_sf", Some(sym::csky_target_feature)),
|
||||
("fpuv3_df", Some(sym::csky_target_feature)),
|
||||
("vdspv2", Some(sym::csky_target_feature)),
|
||||
("dspv2", Some(sym::csky_target_feature)),
|
||||
];
|
||||
/// When rustdoc is running, provide a list of all known features so that all their respective
|
||||
/// primitives may be documented.
|
||||
///
|
||||
|
@ -311,6 +321,7 @@ pub fn all_known_features() -> impl Iterator<Item = (&'static str, Option<Symbol
|
|||
.chain(RISCV_ALLOWED_FEATURES.iter())
|
||||
.chain(WASM_ALLOWED_FEATURES.iter())
|
||||
.chain(BPF_ALLOWED_FEATURES.iter())
|
||||
.chain(CSKY_ALLOWED_FEATURES)
|
||||
.cloned()
|
||||
}
|
||||
|
||||
|
@ -325,6 +336,7 @@ pub fn supported_target_features(sess: &Session) -> &'static [(&'static str, Opt
|
|||
"riscv32" | "riscv64" => RISCV_ALLOWED_FEATURES,
|
||||
"wasm32" | "wasm64" => WASM_ALLOWED_FEATURES,
|
||||
"bpf" => BPF_ALLOWED_FEATURES,
|
||||
"csky" => CSKY_ALLOWED_FEATURES,
|
||||
_ => &[],
|
||||
}
|
||||
}
|
||||
|
@ -396,6 +408,7 @@ pub fn from_target_feature(
|
|||
Some(sym::ermsb_target_feature) => rust_features.ermsb_target_feature,
|
||||
Some(sym::bpf_target_feature) => rust_features.bpf_target_feature,
|
||||
Some(sym::aarch64_ver_target_feature) => rust_features.aarch64_ver_target_feature,
|
||||
Some(sym::csky_target_feature) => rust_features.csky_target_feature,
|
||||
Some(name) => bug!("unknown target feature gate {}", name),
|
||||
None => true,
|
||||
};
|
||||
|
|
|
@ -282,6 +282,7 @@ declare_features! (
|
|||
(active, arm_target_feature, "1.27.0", Some(44839), None),
|
||||
(active, avx512_target_feature, "1.27.0", Some(44839), None),
|
||||
(active, bpf_target_feature, "1.54.0", Some(44839), None),
|
||||
(active, csky_target_feature, "1.72.0", Some(44839), None),
|
||||
(active, ermsb_target_feature, "1.49.0", Some(44839), None),
|
||||
(active, hexagon_target_feature, "1.27.0", Some(44839), None),
|
||||
(active, mips_target_feature, "1.27.0", Some(44839), None),
|
||||
|
|
|
@ -574,6 +574,7 @@ symbols! {
|
|||
crate_type,
|
||||
crate_visibility_modifier,
|
||||
crt_dash_static: "crt-static",
|
||||
csky_target_feature,
|
||||
cstring_type,
|
||||
ctlz,
|
||||
ctlz_nonzero,
|
||||
|
|
|
@ -6,7 +6,7 @@ use crate::spec::{Target, TargetOptions};
|
|||
pub fn target() -> Target {
|
||||
Target {
|
||||
//https://github.com/llvm/llvm-project/blob/8b76aea8d8b1b71f6220bc2845abc749f18a19b7/clang/lib/Basic/Targets/CSKY.h
|
||||
llvm_target: "csky-unknown-linux".into(),
|
||||
llvm_target: "csky-unknown-linux-gnuabiv2".into(),
|
||||
pointer_width: 32,
|
||||
data_layout: "e-m:e-S32-p:32:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:32:32-v128:32:32-a:0:32-Fi32-n32".into(),
|
||||
arch: "csky".into(),
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
**Tier: 3**
|
||||
|
||||
This target supports [C-SKY](https://github.com/c-sky) v2 CPUs with `glibc`.
|
||||
This target supports [C-SKY](https://github.com/c-sky) CPUs with `abi` v2 and `glibc`.
|
||||
|
||||
https://c-sky.github.io/
|
||||
## Target maintainers
|
||||
|
|
|
@ -4,7 +4,7 @@ warning: unexpected `cfg` condition value
|
|||
LL | #[cfg(target(os = "linux", arch = "X"))]
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: expected values for `target_arch` are: `aarch64`, `arm`, `avr`, `bpf`, `hexagon`, `loongarch64`, `m68k`, `mips`, `mips32r6`, `mips64`, `mips64r6`, `msp430`, `nvptx64`, `powerpc`, `powerpc64`, `riscv32`, `riscv64`, `s390x`, `sparc`, `sparc64`, `wasm32`, `wasm64`, `x86`, `x86_64`
|
||||
= note: expected values for `target_arch` are: `aarch64`, `arm`, `avr`, `bpf`, `csky`, `hexagon`, `loongarch64`, `m68k`, `mips`, `mips32r6`, `mips64`, `mips64r6`, `msp430`, `nvptx64`, `powerpc`, `powerpc64`, `riscv32`, `riscv64`, `s390x`, `sparc`, `sparc64`, `wasm32`, `wasm64`, `x86`, `x86_64`
|
||||
= note: `#[warn(unexpected_cfgs)]` on by default
|
||||
|
||||
warning: 1 warning emitted
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue