More changes to support my OS

This commit is contained in:
Mathieu Strypsteen 2024-12-24 19:15:42 +01:00
parent ce66368009
commit 606b8f634b
22 changed files with 43 additions and 1 deletions

View file

@ -21,6 +21,7 @@ pub(crate) mod msvc;
pub(crate) mod netbsd; pub(crate) mod netbsd;
pub(crate) mod nto_qnx; pub(crate) mod nto_qnx;
pub(crate) mod openbsd; pub(crate) mod openbsd;
pub(crate) mod os;
pub(crate) mod redox; pub(crate) mod redox;
pub(crate) mod solaris; pub(crate) mod solaris;
pub(crate) mod solid; pub(crate) mod solid;

View file

@ -0,0 +1,11 @@
use crate::spec::{PanicStrategy, RelocModel, TargetOptions, crt_objects};
pub(crate) fn opts() -> TargetOptions {
TargetOptions {
os: "os".into(),
relocation_model: RelocModel::Static,
panic_strategy: PanicStrategy::Abort,
pre_link_objects: crt_objects::pre_os(),
..Default::default()
}
}

View file

@ -122,3 +122,7 @@ pub(super) fn pre_wasi_self_contained() -> CrtObjects {
pub(super) fn post_wasi_self_contained() -> CrtObjects { pub(super) fn post_wasi_self_contained() -> CrtObjects {
new(&[]) new(&[])
} }
pub(super) fn pre_os() -> CrtObjects {
all("crt0.o")
}

View file

@ -1946,6 +1946,7 @@ supported_targets! {
("riscv32imafc-unknown-nuttx-elf", riscv32imafc_unknown_nuttx_elf), ("riscv32imafc-unknown-nuttx-elf", riscv32imafc_unknown_nuttx_elf),
("riscv64imac-unknown-nuttx-elf", riscv64imac_unknown_nuttx_elf), ("riscv64imac-unknown-nuttx-elf", riscv64imac_unknown_nuttx_elf),
("riscv64gc-unknown-nuttx-elf", riscv64gc_unknown_nuttx_elf), ("riscv64gc-unknown-nuttx-elf", riscv64gc_unknown_nuttx_elf),
("x86_64-unknown-os", x86_64_unknown_os),
} }

View file

@ -0,0 +1,20 @@
use crate::spec::{Target, TargetMetadata, base};
pub(crate) fn target() -> Target {
let mut base = base::os::opts();
base.cpu = "x86-64".into();
Target {
llvm_target: "x86_64-unknown-none".into(),
metadata: TargetMetadata {
description: None,
tier: None,
host_tools: Some(false),
std: Some(true),
},
pointer_width: 64,
arch: "x86_64".into(),
data_layout:
"e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128".into(),
options: base,
}
}

View file

@ -151,5 +151,5 @@ check-cfg = [
# of declared features, we therefor expect any feature cfg # of declared features, we therefor expect any feature cfg
'cfg(feature, values(any()))', 'cfg(feature, values(any()))',
# #[cfg(bootstrap)] rtems # #[cfg(bootstrap)] rtems
'cfg(target_os, values("rtems"))', 'cfg(target_os, values("rtems", "os"))',
] ]

View file

@ -56,6 +56,7 @@ fn main() {
|| target_os == "zkvm" || target_os == "zkvm"
|| target_os == "rtems" || target_os == "rtems"
|| target_os == "nuttx" || target_os == "nuttx"
|| target_os == "os"
// See src/bootstrap/src/core/build_steps/synthetic_targets.rs // See src/bootstrap/src/core/build_steps/synthetic_targets.rs
|| env::var("RUSTC_BOOTSTRAP_SYNTHETIC_TARGET").is_ok() || env::var("RUSTC_BOOTSTRAP_SYNTHETIC_TARGET").is_ok()

View file

@ -61,6 +61,9 @@ cfg_if::cfg_if! {
} else if #[cfg(target_os = "zkvm")] { } else if #[cfg(target_os = "zkvm")] {
mod zkvm; mod zkvm;
pub use self::zkvm::*; pub use self::zkvm::*;
} else if #[cfg(target_os = "os")] {
mod osstd;
pub use self::osstd::*;
} else { } else {
mod unsupported; mod unsupported;
pub use self::unsupported::*; pub use self::unsupported::*;

View file

@ -28,6 +28,7 @@ cfg_if::cfg_if! {
all(target_family = "wasm", not(target_feature = "atomics")), all(target_family = "wasm", not(target_feature = "atomics")),
target_os = "uefi", target_os = "uefi",
target_os = "zkvm", target_os = "zkvm",
target_os = "os",
))] { ))] {
mod statik; mod statik;
pub use statik::{EagerStorage, LazyStorage, thread_local_inner}; pub use statik::{EagerStorage, LazyStorage, thread_local_inner};