forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#66713 - hermitcore:hermit, r=alexcrichton
introduce a target to build the kernel of the unikernel HermitCore We are developing the unikernel HermitCore, where the kernel is written in Rust and is already supported by the Rust Standard Library. To compile the kernel with the new build flag "-Z build-std", we introduce a new target, which avoids the usage of SSE & AVX within the kernel.
- Loading branch information
Showing
3 changed files
with
54 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
use crate::spec::{LldFlavor, LinkArgs, LinkerFlavor, PanicStrategy, TargetOptions}; | ||
use std::default::Default; | ||
|
||
pub fn opts() -> TargetOptions { | ||
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 { | ||
disable_redzone: true, | ||
linker: Some("rust-lld".to_owned()), | ||
executables: true, | ||
has_elf_tls: true, | ||
linker_is_gnu: true, | ||
pre_link_args, | ||
no_default_libraries: true, | ||
panic_strategy: PanicStrategy::Abort, | ||
position_independent_executables: true, | ||
relocation_model: "static".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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
use crate::spec::{LldFlavor, LinkerFlavor, Target, TargetResult}; | ||
|
||
pub fn target() -> TargetResult { | ||
let mut base = super::hermit_kernel_base::opts(); | ||
base.cpu = "x86-64".to_string(); | ||
base.max_atomic_width = Some(64); | ||
base.features = | ||
"-mmx,-sse,-sse2,-sse3,-ssse3,-sse4.1,-sse4.2,-3dnow,-3dnowa,-avx,-avx2,+soft-float" | ||
.to_string(); | ||
base.stack_probes = true; | ||
|
||
Ok(Target { | ||
llvm_target: "x86_64-unknown-hermit".to_string(), | ||
target_endian: "little".to_string(), | ||
target_pointer_width: "64".to_string(), | ||
target_c_int_width: "32".to_string(), | ||
data_layout: "e-m:e-i64:64-f80:128-n8:16:32:64-S128".to_string(), | ||
arch: "x86_64".to_string(), | ||
target_os: "hermit".to_string(), | ||
target_env: String::new(), | ||
target_vendor: "unknown".to_string(), | ||
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld), | ||
options: base, | ||
}) | ||
} |