e2k impl
This commit is contained in:
parent
88f19c6dab
commit
c992fced6b
@ -86,6 +86,7 @@ fn main() {
|
||||
"nvptx",
|
||||
"hexagon",
|
||||
"riscv",
|
||||
"elbrus",
|
||||
];
|
||||
|
||||
let mut version_cmd = Command::new(&llvm_config);
|
||||
@ -190,7 +191,7 @@ fn main() {
|
||||
let mut cmd = Command::new(&llvm_config);
|
||||
cmd.arg(llvm_link_arg).arg("--libs");
|
||||
|
||||
if !is_crossed {
|
||||
if !is_crossed || target.starts_with("e2k") {
|
||||
cmd.arg("--system-libs");
|
||||
} else if target.contains("windows-gnu") {
|
||||
println!("cargo:rustc-link-lib=shell32");
|
||||
|
@ -170,4 +170,11 @@ pub fn initialize_available_targets() {
|
||||
LLVMInitializeWebAssemblyAsmPrinter,
|
||||
LLVMInitializeWebAssemblyAsmParser
|
||||
);
|
||||
init_target!(
|
||||
llvm_component = "elbrus",
|
||||
LLVMInitializeElbrusTargetInfo,
|
||||
LLVMInitializeElbrusTarget,
|
||||
LLVMInitializeElbrusTargetMC,
|
||||
LLVMInitializeElbrusAsmPrinter
|
||||
);
|
||||
}
|
||||
|
@ -649,6 +649,7 @@ impl<'a, Ty> FnAbi<'a, Ty> {
|
||||
_ => wasm32_bindgen_compat::compute_abi_info(self),
|
||||
},
|
||||
"asmjs" => wasm32::compute_abi_info(cx, self),
|
||||
"e2k64" => (), // backend always C-abi, and ignores this attributes
|
||||
a => return Err(format!("unrecognized arch \"{}\" in target specification", a)),
|
||||
}
|
||||
|
||||
|
30
compiler/rustc_target/src/spec/e2k64_unknown_linux_gnu.rs
Normal file
30
compiler/rustc_target/src/spec/e2k64_unknown_linux_gnu.rs
Normal file
@ -0,0 +1,30 @@
|
||||
// ignore-tidy-linelength
|
||||
|
||||
use crate::spec::{LinkerFlavor, Target};
|
||||
|
||||
pub fn target() -> Target {
|
||||
let mut base = super::linux_gnu_base::opts();
|
||||
base.max_atomic_width = Some(64);
|
||||
base.position_independent_executables = false;
|
||||
base.pre_link_args
|
||||
.get_mut(&LinkerFlavor::Gcc)
|
||||
.unwrap()
|
||||
.push("-fPIC".to_string());
|
||||
base.post_link_args.insert(
|
||||
LinkerFlavor::Gcc,
|
||||
vec![
|
||||
"-llccrt_s".to_string(),
|
||||
"-llcc".to_string(),
|
||||
"-lm".to_string(),
|
||||
],
|
||||
);
|
||||
|
||||
Target {
|
||||
llvm_target: "e2k64-unknown-linux-gnu".to_string(),
|
||||
pointer_width: 64,
|
||||
arch: "e2k64".to_string(),
|
||||
data_layout: "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f80:128:128-f128:128:128-v128:128:128-n32:64".to_string(),
|
||||
|
||||
options: base,
|
||||
}
|
||||
}
|
@ -816,6 +816,8 @@ supported_targets! {
|
||||
("aarch64_be-unknown-linux-gnu", aarch64_be_unknown_linux_gnu),
|
||||
("aarch64-unknown-linux-gnu_ilp32", aarch64_unknown_linux_gnu_ilp32),
|
||||
("aarch64_be-unknown-linux-gnu_ilp32", aarch64_be_unknown_linux_gnu_ilp32),
|
||||
|
||||
("e2k64-unknown-linux-gnu", e2k64_unknown_linux_gnu),
|
||||
}
|
||||
|
||||
/// Everything `rustc` knows about how to compile for a specific target.
|
||||
|
@ -123,6 +123,9 @@ const UNWIND_DATA_REG: (i32, i32) = (0, 1); // R0, R1
|
||||
#[cfg(any(target_arch = "riscv64", target_arch = "riscv32"))]
|
||||
const UNWIND_DATA_REG: (i32, i32) = (10, 11); // x10, x11
|
||||
|
||||
#[cfg(target_arch = "e2k64")]
|
||||
const UNWIND_DATA_REG: (i32, i32) = (64, 65);
|
||||
|
||||
// The following code is based on GCC's C and C++ personality routines. For reference, see:
|
||||
// https://github.com/gcc-mirror/gcc/blob/master/libstdc++-v3/libsupc++/eh_personality.cc
|
||||
// https://github.com/gcc-mirror/gcc/blob/trunk/libgcc/unwind-c.c
|
||||
|
@ -865,6 +865,7 @@ pub mod consts {
|
||||
/// - riscv64
|
||||
/// - s390x
|
||||
/// - sparc64
|
||||
/// - e2k64
|
||||
#[stable(feature = "env", since = "1.0.0")]
|
||||
pub const ARCH: &str = env!("STD_ENV_ARCH");
|
||||
|
||||
|
@ -304,7 +304,7 @@ mod arch {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(target_arch = "x86_64", target_arch = "powerpc64"))]
|
||||
#[cfg(any(target_arch = "x86_64", target_arch = "powerpc64", target_arch = "e2k64"))]
|
||||
mod arch {
|
||||
use crate::os::raw::{c_int, c_long};
|
||||
|
||||
|
@ -100,13 +100,14 @@ mod imp {
|
||||
// On Linux-GNU, we rely on `ARGV_INIT_ARRAY` below to initialize
|
||||
// `ARGC` and `ARGV`. But in Miri that does not actually happen so we
|
||||
// still initialize here.
|
||||
#[cfg(any(miri, not(all(target_os = "linux", target_env = "gnu"))))]
|
||||
#[cfg(any(miri, not(all(target_os = "linux", target_env = "gnu")), target_arch = "e2k64"))]
|
||||
really_init(_argc, _argv);
|
||||
}
|
||||
|
||||
/// glibc passes argc, argv, and envp to functions in .init_array, as a non-standard extension.
|
||||
/// This allows `std::env::args` to work even in a `cdylib`, as it does on macOS and Windows.
|
||||
#[cfg(all(target_os = "linux", target_env = "gnu"))]
|
||||
// FIXME: workaround: e2k assembler generates a warning and lccrt fails to compile
|
||||
#[cfg(all(target_os = "linux", target_env = "gnu", not(target_arch = "e2k64")))]
|
||||
#[used]
|
||||
#[link_section = ".init_array.00099"]
|
||||
static ARGV_INIT_ARRAY: extern "C" fn(
|
||||
|
@ -25,7 +25,8 @@ pub const MIN_ALIGN: usize = 8;
|
||||
target_arch = "mips64",
|
||||
target_arch = "s390x",
|
||||
target_arch = "sparc64",
|
||||
target_arch = "riscv64"
|
||||
target_arch = "riscv64",
|
||||
target_arch = "e2k64"
|
||||
)))]
|
||||
pub const MIN_ALIGN: usize = 16;
|
||||
|
||||
|
@ -66,6 +66,9 @@ pub const unwinder_private_data_size: usize = 20;
|
||||
#[cfg(all(target_arch = "hexagon", target_os = "linux"))]
|
||||
pub const unwinder_private_data_size: usize = 35;
|
||||
|
||||
#[cfg(target_arch = "e2k64")]
|
||||
pub const unwinder_private_data_size: usize = 6;
|
||||
|
||||
#[repr(C)]
|
||||
pub struct _Unwind_Exception {
|
||||
pub exception_class: _Unwind_Exception_Class,
|
||||
|
@ -284,6 +284,7 @@ def default_build_triple(verbose):
|
||||
'aarch64': 'aarch64',
|
||||
'amd64': 'x86_64',
|
||||
'arm64': 'aarch64',
|
||||
'e2k': 'e2k64',
|
||||
'i386': 'i686',
|
||||
'i486': 'i686',
|
||||
'i686': 'i686',
|
||||
|
@ -48,6 +48,8 @@ fn cc2ar(cc: &Path, target: TargetSelection) -> Option<PathBuf> {
|
||||
Some(PathBuf::from("ar"))
|
||||
} else if target.contains("vxworks") {
|
||||
Some(PathBuf::from("wr-ar"))
|
||||
} else if target.starts_with("e2k") {
|
||||
Some(PathBuf::from("ar"))
|
||||
} else {
|
||||
let parent = cc.parent().unwrap();
|
||||
let file = cc.file_name().unwrap().to_str().unwrap();
|
||||
|
@ -310,7 +310,9 @@ pub fn std_cargo(builder: &Builder<'_>, target: TargetSelection, stage: u32, car
|
||||
//
|
||||
// But we don't bother for the stage 0 compiler because it's never used
|
||||
// with LTO.
|
||||
if stage >= 1 {
|
||||
//
|
||||
// FIXME: currently e2k llvm backend does not support asm parser
|
||||
if stage >= 1 && !target.starts_with("e2k") {
|
||||
cargo.rustflag("-Cembed-bitcode=yes");
|
||||
}
|
||||
|
||||
|
@ -1054,6 +1054,11 @@ note: if you're sure you want to do this, please open an issue as to why. In the
|
||||
}
|
||||
|
||||
if suite == "debuginfo" {
|
||||
// Skip debuginfo tests for e2k, see bug 105287, dwarf NIY
|
||||
if builder.config.build.starts_with("e2k") {
|
||||
return;
|
||||
}
|
||||
|
||||
builder
|
||||
.ensure(dist::DebuggerScripts { sysroot: builder.sysroot(compiler), host: target });
|
||||
}
|
||||
|
@ -12,6 +12,7 @@
|
||||
// ignore-sgx no processes
|
||||
// ignore-musl FIXME #31506
|
||||
// ignore-pretty
|
||||
// ignore-e2k64
|
||||
// compile-flags: -C lto
|
||||
// no-prefer-dynamic
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
// run-pass
|
||||
// ignore-arm
|
||||
// ignore-aarch64
|
||||
// ignore-e2k64
|
||||
// ignore-mips
|
||||
// ignore-mips64
|
||||
// ignore-powerpc
|
||||
|
@ -1,4 +1,5 @@
|
||||
// revisions: x86_64 arm
|
||||
// ignore-e2k64
|
||||
//[x86_64] compile-flags: --target x86_64-unknown-linux-gnu
|
||||
//[arm] compile-flags: --target armv7-unknown-linux-gnueabihf
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
// Checks that #[naked] attribute can be placed on function definitions only.
|
||||
//
|
||||
// ignore-wasm32 asm unsupported
|
||||
// ignore-e2k64
|
||||
#![feature(asm)]
|
||||
#![feature(naked_functions)]
|
||||
#![naked] //~ ERROR should be applied to a function definition
|
||||
|
@ -6,6 +6,7 @@
|
||||
// ignore-riscv64
|
||||
// ignore-sparc
|
||||
// ignore-sparc64
|
||||
// ignore-e2k64
|
||||
|
||||
#![feature(llvm_asm)]
|
||||
|
||||
|
@ -39,3 +39,6 @@ pub fn main() { }
|
||||
|
||||
#[cfg(target_arch = "riscv64")]
|
||||
pub fn main() { }
|
||||
|
||||
#[cfg(target_arch = "e2k64")]
|
||||
pub fn main() { }
|
||||
|
@ -8,6 +8,7 @@
|
||||
// compile-flags: -C lto -g
|
||||
// no-prefer-dynamic
|
||||
// ignore-asmjs wasm2js does not support source maps yet
|
||||
// ignore-e2k64
|
||||
|
||||
extern crate debuginfo_lto_aux;
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
// run-pass
|
||||
// ignore-wasm32-bare compiled with panic=abort by default
|
||||
// ignore-emscripten no threads support
|
||||
// ignore-e2k64 asmparser
|
||||
|
||||
// rust-lang/rust#64655: with panic=unwind, a panic from a subroutine
|
||||
// should still run destructors as it unwinds the stack. However,
|
||||
|
@ -1,6 +1,7 @@
|
||||
// run-pass
|
||||
// ignore-wasm32-bare compiled with panic=abort by default
|
||||
// ignore-emscripten no threads support
|
||||
// ignore-e2k64 asmparser
|
||||
|
||||
// rust-lang/rust#64655: with panic=unwind, a panic from a subroutine
|
||||
// should still run destructors as it unwinds the stack. However,
|
||||
|
@ -1,6 +1,7 @@
|
||||
// run-pass
|
||||
// compile-flags: -Clto=fat
|
||||
// no-prefer-dynamic
|
||||
// ignore-e2k64 asmparser
|
||||
|
||||
fn main() {
|
||||
println!("hello!");
|
||||
|
@ -2,6 +2,7 @@
|
||||
// dont-check-compiler-stderr
|
||||
// compile-flags: -C codegen-units=2
|
||||
// ignore-emscripten
|
||||
// ignore-e2k64
|
||||
|
||||
#![feature(llvm_asm)]
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
// build-fail
|
||||
// dont-check-compiler-stderr
|
||||
// ignore-emscripten
|
||||
// ignore-e2k64
|
||||
|
||||
#![feature(llvm_asm)]
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
// build-fail
|
||||
// ignore-emscripten no asm! support
|
||||
// Regression test for #69092
|
||||
// ignore-e2k64
|
||||
|
||||
#![feature(llvm_asm)]
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
// ignore-sparc64
|
||||
// ignore-mips
|
||||
// ignore-mips64
|
||||
// ignore-e2k64
|
||||
|
||||
#![feature(llvm_asm)]
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
// ignore-sparc64
|
||||
// ignore-mips
|
||||
// ignore-mips64
|
||||
// ignore-e2k64
|
||||
|
||||
#![feature(llvm_asm)]
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
// ignore-sparc64
|
||||
// ignore-mips
|
||||
// ignore-mips64
|
||||
// ignore-e2k64
|
||||
|
||||
#![feature(llvm_asm)]
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
// ignore-sparc64
|
||||
// ignore-mips
|
||||
// ignore-mips64
|
||||
// ignore-e2k64
|
||||
|
||||
#![feature(llvm_asm)]
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
// ignore-sparc64
|
||||
// ignore-mips
|
||||
// ignore-mips64
|
||||
// ignore-e2k64
|
||||
|
||||
#![feature(llvm_asm)]
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
// ignore-sparc64
|
||||
// ignore-mips
|
||||
// ignore-mips64
|
||||
// ignore-e2k64
|
||||
|
||||
#![feature(llvm_asm)]
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
// error-pattern:Linking globals named 'foo': symbol multiply defined!
|
||||
// compile-flags: -C lto
|
||||
// no-prefer-dynamic
|
||||
// ignore-e2k64 asmparser
|
||||
|
||||
extern crate lto_duplicate_symbols1;
|
||||
extern crate lto_duplicate_symbols2;
|
||||
|
@ -1,6 +1,7 @@
|
||||
// run-pass
|
||||
// compile-flags: -C lto -C codegen-units=8
|
||||
// no-prefer-dynamic
|
||||
// ignore-e2k64 asmparser
|
||||
|
||||
fn main() {
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
// aux-build:lto-rustc-loads-linker-plugin.rs
|
||||
// run-pass
|
||||
// no-prefer-dynamic
|
||||
// ignore-e2k64 asmparser
|
||||
|
||||
// This test ensures that if a dependency was compiled with
|
||||
// `-Clinker-plugin-lto` then we can compile with `-Clto` and still link against
|
||||
|
@ -2,6 +2,7 @@
|
||||
// compile-flags: -C lto
|
||||
// no-prefer-dynamic
|
||||
// ignore-emscripten no threads support
|
||||
// ignore-e2k64 asmparser
|
||||
|
||||
use std::thread;
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
// aux-build:lto-rustc-loads-linker-plugin.rs
|
||||
// run-pass
|
||||
// no-prefer-dynamic
|
||||
// ignore-e2k64 asmparser
|
||||
|
||||
// Same as the adjacent `lto-thin-rustc-loads-linker-plugin.rs` test, only with
|
||||
// ThinLTO.
|
||||
|
@ -1,4 +1,5 @@
|
||||
// ignore-emscripten no llvm_asm! support
|
||||
// ignore-e2k64
|
||||
// build-pass (FIXME(62277): could be check-pass?)
|
||||
#![feature(asm)]
|
||||
#![allow(unused)]
|
||||
|
@ -4,6 +4,7 @@
|
||||
// no-prefer-dynamic
|
||||
// ignore-emscripten no processes
|
||||
// ignore-sgx no processes
|
||||
// ignore-e2k64 asmparser
|
||||
|
||||
use std::process::Command;
|
||||
use std::env;
|
||||
|
@ -5,6 +5,7 @@
|
||||
// no-prefer-dynamic
|
||||
// ignore-emscripten no processes
|
||||
// ignore-sgx no processes
|
||||
// ignore-e2k64 asmparser
|
||||
|
||||
use std::process::Command;
|
||||
use std::env;
|
||||
|
@ -5,6 +5,7 @@
|
||||
// aux-build:sepcomp_lib.rs
|
||||
// compile-flags: -C lto -g
|
||||
// ignore-asmjs wasm2js does not support source maps yet
|
||||
// ignore-e2k64 asmparser
|
||||
// no-prefer-dynamic
|
||||
|
||||
extern crate sepcomp_lib;
|
||||
|
@ -1,4 +1,5 @@
|
||||
// run-pass
|
||||
// ignore-e2k64 asmparser
|
||||
|
||||
// compile-flags: -Clto=thin
|
||||
// no-prefer-dynamic
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
// aux-build:msvc-imp-present.rs
|
||||
// compile-flags: -Z thinlto -C codegen-units=8
|
||||
// ignore-e2k64 asmparser
|
||||
// no-prefer-dynamic
|
||||
|
||||
// On MSVC we have a "hack" where we emit symbols that look like `_imp_$name`
|
||||
|
@ -4,6 +4,7 @@
|
||||
// aux-build:thin-lto-inlines-aux.rs
|
||||
// no-prefer-dynamic
|
||||
// ignore-emscripten can't inspect instructions on emscripten
|
||||
// ignore-e2k64 asmparser
|
||||
|
||||
// We want to assert here that ThinLTO will inline across codegen units. There's
|
||||
// not really a great way to do that in general so we sort of hack around it by
|
||||
|
@ -48,6 +48,7 @@ const ARCH_TABLE: &[(&str, &str)] = &[
|
||||
("armv7s", "arm"),
|
||||
("asmjs", "asmjs"),
|
||||
("avr", "avr"),
|
||||
("e2k64", "e2k64"),
|
||||
("hexagon", "hexagon"),
|
||||
("i386", "x86"),
|
||||
("i586", "x86"),
|
||||
@ -166,7 +167,7 @@ pub fn matches_env(triple: &str, name: &str) -> bool {
|
||||
|
||||
pub fn get_pointer_width(triple: &str) -> &'static str {
|
||||
if (triple.contains("64") && !triple.ends_with("gnux32") && !triple.ends_with("gnu_ilp32"))
|
||||
|| triple.starts_with("s390x")
|
||||
|| triple.starts_with("s390x") || triple.starts_with("e2k")
|
||||
{
|
||||
"64bit"
|
||||
} else if triple.starts_with("avr") {
|
||||
|
Loading…
Reference in New Issue
Block a user