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