]>
Commit | Line | Data |
---|---|---|
9fa01778 | 1 | use crate::spec::{LinkArgs, LinkerFlavor, TargetOptions, RelroLevel}; |
1a4d82fc JJ |
2 | use std::default::Default; |
3 | ||
4 | pub fn opts() -> TargetOptions { | |
cc61c64b XL |
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 | ||
1a4d82fc | 17 | TargetOptions { |
1a4d82fc JJ |
18 | dynamic_linking: true, |
19 | executables: true, | |
32a655c1 | 20 | target_family: Some("unix".to_string()), |
1a4d82fc JJ |
21 | linker_is_gnu: true, |
22 | has_rpath: true, | |
cc61c64b | 23 | pre_link_args: args, |
1a4d82fc | 24 | position_independent_executables: true, |
3b2f2976 | 25 | relro_level: RelroLevel::Full, |
1a4d82fc JJ |
26 | .. Default::default() |
27 | } | |
28 | } |