Finish port

This commit is contained in:
Mathieu Strypsteen 2024-12-25 10:49:46 +01:00
parent 36471393dc
commit 692725dc96
4 changed files with 26 additions and 7 deletions

View file

@ -1,11 +1,15 @@
use crate::spec::{PanicStrategy, RelocModel, TargetOptions, crt_objects};
use crate::spec::{
Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, StackProbeType, TargetOptions,
};
pub(crate) fn opts() -> TargetOptions {
TargetOptions {
os: "os".into(),
linker: Some("rust-lld".into()),
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
relocation_model: RelocModel::Static,
panic_strategy: PanicStrategy::Abort,
pre_link_objects: crt_objects::pre_os(),
stack_probes: StackProbeType::Inline,
..Default::default()
}
}

View file

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

View file

@ -1,5 +1,7 @@
#![deny(unsafe_op_in_unsafe_fn)]
use core::arch::global_asm;
pub mod args;
pub mod env;
pub mod fs;
@ -14,3 +16,20 @@ pub mod time;
mod common;
pub use common::*;
global_asm!(
"
.text
.global _start
_start:
mov $stack, %rsp
call main
.section .bss
.align 16
.skip 0x10000
stack:
",
options(att_syntax)
);

View file

@ -665,7 +665,7 @@ impl Build {
}
// Generate memcpy, etc. FIXME: Remove this once compiler-builtins
// automatically detects this target.
if target.contains("zkvm") {
if target.contains("zkvm") || target.contains("os") {
features.insert("compiler-builtins-mem");
}