]> git.proxmox.com Git - rustc.git/blame - src/librustc_target/spec/openbsd_base.rs
New upstream version 1.47.0+dfsg1
[rustc.git] / src / librustc_target / spec / openbsd_base.rs
CommitLineData
dfeec247 1use crate::spec::{LinkArgs, LinkerFlavor, RelroLevel, TargetOptions};
85aaf69f
SL
2
3pub fn opts() -> TargetOptions {
cc61c64b 4 let mut args = LinkArgs::new();
dfeec247
XL
5 args.insert(
6 LinkerFlavor::Gcc,
7 vec![
8 // GNU-style linkers will use this to omit linking to libraries
9 // which don't actually fulfill any relocations, but only for
10 // libraries which follow this flag. Thus, use it before
11 // specifying libraries to link to.
12 "-Wl,--as-needed".to_string(),
13 // Always enable NX protection when it is available
14 "-Wl,-z,noexecstack".to_string(),
15 ],
16 );
cc61c64b 17
85aaf69f 18 TargetOptions {
85aaf69f
SL
19 dynamic_linking: true,
20 executables: true,
32a655c1 21 target_family: Some("unix".to_string()),
85aaf69f
SL
22 linker_is_gnu: true,
23 has_rpath: true,
0531ce1d 24 abi_return_struct_as_int: true,
cc61c64b 25 pre_link_args: args,
85aaf69f 26 position_independent_executables: true,
ff7c6d11 27 eliminate_frame_pointer: false, // FIXME 43575
3b2f2976 28 relro_level: RelroLevel::Full,
dfeec247 29 ..Default::default()
85aaf69f
SL
30 }
31}