forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#65167 - hermitcore:rusty-hermit, r=alexcrichton
Redesign the interface to the unikernel HermitCore We are developing the unikernel HermitCore, where the kernel is written in Rust and is already part of the Rust Standard Library. The interface between the standard library and the kernel based on a small C library. With this pull request, we remove completely the dependency to C and use lld as linker. Currently, the kernel will be linked to the application as static library, which is published at https://github.com/hermitcore/libhermit-rs. We don’t longer support the C interface to the kernel. Consequently, we remove this part from the Rust Standard Library.
- Loading branch information
Showing
51 changed files
with
2,322 additions
and
450 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
//! Unwinding for *hermit* target. | ||
//! | ||
//! Right now we don't support this, so this is just stubs. | ||
|
||
use alloc::boxed::Box; | ||
use core::ptr; | ||
use core::any::Any; | ||
|
||
pub fn payload() -> *mut u8 { | ||
ptr::null_mut() | ||
} | ||
|
||
pub unsafe fn cleanup(_ptr: *mut u8) -> Box<dyn Any + Send> { | ||
extern "C" { pub fn __rust_abort() -> !; } | ||
__rust_abort(); | ||
} | ||
|
||
pub unsafe fn panic(_data: Box<dyn Any + Send>) -> u32 { | ||
extern "C" { pub fn __rust_abort() -> !; } | ||
__rust_abort(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
use crate::spec::{LinkArgs, LinkerFlavor, PanicStrategy, TargetOptions}; | ||
use crate::spec::{LldFlavor, LinkArgs, LinkerFlavor, PanicStrategy, TargetOptions}; | ||
use std::default::Default; | ||
|
||
pub fn opts() -> TargetOptions { | ||
let mut args = LinkArgs::new(); | ||
args.insert(LinkerFlavor::Gcc, vec![ | ||
"-Wl,-Bstatic".to_string(), | ||
"-Wl,--no-dynamic-linker".to_string(), | ||
"-Wl,--gc-sections".to_string(), | ||
"-Wl,--as-needed".to_string(), | ||
let mut pre_link_args = LinkArgs::new(); | ||
pre_link_args.insert(LinkerFlavor::Lld(LldFlavor::Ld), vec![ | ||
"--build-id".to_string(), | ||
"--hash-style=gnu".to_string(), | ||
"--Bstatic".to_string(), | ||
]); | ||
|
||
TargetOptions { | ||
linker: Some("rust-lld".to_owned()), | ||
executables: true, | ||
has_elf_tls: true, | ||
linker_is_gnu: true, | ||
no_default_libraries: false, | ||
pre_link_args, | ||
no_default_libraries: true, | ||
panic_strategy: PanicStrategy::Abort, | ||
position_independent_executables: false, | ||
pre_link_args: args, | ||
position_independent_executables: true, | ||
relocation_model: "static".to_string(), | ||
target_family: Some("unix".to_string()), | ||
tls_model: "local-exec".to_string(), | ||
target_family: None, | ||
tls_model: "initial-exec".to_string(), | ||
.. Default::default() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.