Skip to content

Commit 302ddef

Browse files
committed
[RISCV] Add built-in target riscv32imac-unknown-none-elf.
1 parent a6bd5ae commit 302ddef

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed

src/librustc_target/spec/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,8 @@ supported_targets! {
377377

378378
("aarch64-unknown-hermit", aarch64_unknown_hermit),
379379
("x86_64-unknown-hermit", x86_64_unknown_hermit),
380+
381+
("riscv32imac-unknown-none-elf", riscv32imac_unknown_none_elf),
380382
}
381383

382384
/// Everything `rustc` knows about how to compile for a specific target.
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
use spec::{LinkerFlavor, PanicStrategy, Target, TargetOptions, TargetResult};
12+
use spec::abi::{Abi};
13+
14+
pub fn target() -> TargetResult {
15+
Ok(Target {
16+
data_layout: "e-m:e-p:32:32-i64:64-n32-S128".to_string(),
17+
llvm_target: "riscv32".to_string(),
18+
target_endian: "little".to_string(),
19+
target_pointer_width: "32".to_string(),
20+
target_c_int_width: "32".to_string(),
21+
target_os: "none".to_string(),
22+
target_env: "".to_string(),
23+
target_vendor: "unknown".to_string(),
24+
arch: "riscv32".to_string(),
25+
linker_flavor: LinkerFlavor::Ld,
26+
27+
options: TargetOptions {
28+
linker: Some("riscv32-unknown-elf-ld".to_string()),
29+
cpu: "generic-rv32".to_string(),
30+
max_atomic_width: Some(32),
31+
features: "+m,+a,+c".to_string(),
32+
executables: true,
33+
panic_strategy: PanicStrategy::Abort,
34+
relocation_model: "static".to_string(),
35+
abi_blacklist: vec![
36+
Abi::Cdecl,
37+
Abi::Stdcall,
38+
Abi::Fastcall,
39+
Abi::Vectorcall,
40+
Abi::Thiscall,
41+
Abi::Aapcs,
42+
Abi::Win64,
43+
Abi::SysV64,
44+
Abi::PtxKernel,
45+
Abi::Msp430Interrupt,
46+
Abi::X86Interrupt,
47+
],
48+
.. Default::default()
49+
},
50+
})
51+
}

0 commit comments

Comments
 (0)