rust/compiler/rustc_target/src/spec/hermit_kernel_base.rs
Martin Kröning 311a249f9d hermitkernel-target: Set OS to "none"
For our kernel targets, we should not set OS, as the kernel runs bare
metal without a circular dependency on std.

This also prepares us for unifying with
https://github.com/rust-lang/rust/pull/89062. This patch requires
libhermit-rs to change a `cfg`s from `target_os = "hermit"` to `target_os
= "none"`.

I tested this patch locally.
2021-10-29 18:07:36 +02:00

22 lines
725 B
Rust

use crate::spec::{LinkArgs, LinkerFlavor, LldFlavor, PanicStrategy, TargetOptions};
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 {
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
disable_redzone: true,
linker: Some("rust-lld".to_owned()),
executables: true,
pre_link_args,
panic_strategy: PanicStrategy::Abort,
position_independent_executables: true,
static_position_independent_executables: true,
..Default::default()
}
}