]> git.lizzy.rs Git - rust.git/blob - src/librustc_target/spec/openbsd_base.rs
Rollup merge of #61675 - fintelia:riscv-frame-pointer, r=nagisa
[rust.git] / src / librustc_target / spec / openbsd_base.rs
1 use crate::spec::{LinkArgs, LinkerFlavor, TargetOptions, RelroLevel};
2 use std::default::Default;
3
4 pub fn opts() -> TargetOptions {
5     let mut args = LinkArgs::new();
6     args.insert(LinkerFlavor::Gcc, vec![
7         // GNU-style linkers will use this to omit linking to libraries
8         // which don't actually fulfill any relocations, but only for
9         // libraries which follow this flag.  Thus, use it before
10         // specifying libraries to link to.
11         "-Wl,--as-needed".to_string(),
12
13         // Always enable NX protection when it is available
14         "-Wl,-z,noexecstack".to_string(),
15     ]);
16
17     TargetOptions {
18         dynamic_linking: true,
19         executables: true,
20         target_family: Some("unix".to_string()),
21         linker_is_gnu: true,
22         has_rpath: true,
23         abi_return_struct_as_int: true,
24         pre_link_args: args,
25         position_independent_executables: true,
26         eliminate_frame_pointer: false, // FIXME 43575
27         relro_level: RelroLevel::Full,
28         .. Default::default()
29     }
30 }