From 31f1b59264cf65297cc6c68fe2fcf448a135a251 Mon Sep 17 00:00:00 2001 From: Christoph Heiss Date: Sat, 28 Jan 2023 12:59:43 +0100 Subject: [PATCH] compiler: target: Add squiid target Signed-off-by: Christoph Heiss --- .gitmodules | 4 ++-- Cargo.lock | 2 +- compiler/rustc_target/src/spec/mod.rs | 3 +++ compiler/rustc_target/src/spec/squiid_base.rs | 17 +++++++++++++++++ .../src/spec/x86_64_unknown_squiid.rs | 18 ++++++++++++++++++ src/llvm-project | 2 +- 6 files changed, 42 insertions(+), 4 deletions(-) create mode 100644 compiler/rustc_target/src/spec/squiid_base.rs create mode 100644 compiler/rustc_target/src/spec/x86_64_unknown_squiid.rs diff --git a/.gitmodules b/.gitmodules index 4011a6fa6b9..0022b24f368 100644 --- a/.gitmodules +++ b/.gitmodules @@ -27,8 +27,8 @@ url = https://github.com/rust-lang/edition-guide.git [submodule "src/llvm-project"] path = src/llvm-project - url = https://github.com/rust-lang/llvm-project.git - branch = rustc/15.0-2022-12-07 + url = git@github.com:squiid-os/llvm-project.git + branch = target/squiid/rustc/15.0-2022-12-07 [submodule "src/doc/embedded-book"] path = src/doc/embedded-book url = https://github.com/rust-embedded/book.git diff --git a/Cargo.lock b/Cargo.lock index b35892ccd52..684f0b6498e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2337,7 +2337,7 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.138" +version = "0.2.137" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "db6d7e329c562c5dfab7a46a2afabc8b987ab9a4834c9d1ca04dc54c1546cef8" dependencies = [ diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs index a094c2c5452..d04c154c7ab 100644 --- a/compiler/rustc_target/src/spec/mod.rs +++ b/compiler/rustc_target/src/spec/mod.rs @@ -79,6 +79,7 @@ mod openbsd_base; mod redox_base; mod solaris_base; mod solid_base; +mod squiid_base; mod thumb_base; mod uefi_msvc_base; mod vxworks_base; @@ -1256,6 +1257,8 @@ supported_targets! { ("aarch64-unknown-nto-qnx710", aarch64_unknown_nto_qnx_710), ("x86_64-pc-nto-qnx710", x86_64_pc_nto_qnx710), + + ("x86_64-unknown-squiid", x86_64_unknown_squiid), } /// Cow-Vec-Str: Cow<'static, [Cow<'static, str>]> diff --git a/compiler/rustc_target/src/spec/squiid_base.rs b/compiler/rustc_target/src/spec/squiid_base.rs new file mode 100644 index 00000000000..7c8b761e105 --- /dev/null +++ b/compiler/rustc_target/src/spec/squiid_base.rs @@ -0,0 +1,17 @@ +use crate::spec::{cvs, LinkerFlavor, Cc, Lld, RelroLevel, TargetOptions}; + +pub fn opts() -> TargetOptions { + TargetOptions { + os: "squiid".into(), + dynamic_linking: true, + executables: true, + families: cvs!["unix"], + has_rpath: true, + has_thread_local: true, + position_independent_executables: true, + linker: Some("x86_64-squiid-gcc".into()), + linker_flavor: LinkerFlavor::Gnu(Cc::Yes, Lld::Yes), + relro_level: RelroLevel::Full, + ..Default::default() + } +} diff --git a/compiler/rustc_target/src/spec/x86_64_unknown_squiid.rs b/compiler/rustc_target/src/spec/x86_64_unknown_squiid.rs new file mode 100644 index 00000000000..683a7924fd8 --- /dev/null +++ b/compiler/rustc_target/src/spec/x86_64_unknown_squiid.rs @@ -0,0 +1,18 @@ +// use crate::spec::{LinkerFlavor, Target}; +use crate::spec::Target; + +pub fn target() -> Target { + let mut base = super::squiid_base::opts(); + base.cpu = "x86-64".into(); + base.max_atomic_width = Some(64); + // base.add_pre_link_args(LinkerFlavor::Gnu(), &["-m64"]); + + Target { + llvm_target: "x86_64-unknown-squiid".into(), + pointer_width: 64, + data_layout: "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" + .into(), + arch: "x86_64".into(), + options: base, + } +} diff --git a/src/llvm-project b/src/llvm-project index 477e7285b12..67e44efaf42 160000 --- a/src/llvm-project +++ b/src/llvm-project @@ -1 +1 @@ -Subproject commit 477e7285b12f876ad105188cfcfc8adda7dc29aa +Subproject commit 67e44efaf423c351abca987f12e3c1441031475a