]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_target/src/spec/freebsd_base.rs
Merge commit '6ed6f1e6a1a8f414ba7e6d9b8222e7e5a1686e42' into clippyup
[rust.git] / compiler / rustc_target / src / spec / freebsd_base.rs
1 use crate::spec::{LinkArgs, LinkerFlavor, RelroLevel, TargetOptions};
2
3 pub fn opts() -> TargetOptions {
4     let mut args = LinkArgs::new();
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     );
17
18     TargetOptions {
19         os: "freebsd".to_string(),
20         dynamic_linking: true,
21         executables: true,
22         os_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         eliminate_frame_pointer: false, // FIXME 43575
28         relro_level: RelroLevel::Full,
29         abi_return_struct_as_int: true,
30         dwarf_version: Some(2),
31         ..Default::default()
32     }
33 }