]> git.lizzy.rs Git - rust.git/blob - src/librustc_target/spec/freestanding_base.rs
Fix typo in TLS Model in Unstable Book
[rust.git] / src / librustc_target / spec / freestanding_base.rs
1 use crate::spec::{LinkArgs, LinkerFlavor, TargetOptions};
2 use std::default::Default;
3
4 pub fn opts() -> TargetOptions {
5     let mut args = LinkArgs::new();
6
7     args.insert(
8         LinkerFlavor::Gcc,
9         vec![
10             // We want to be able to strip as much executable code as possible
11             // from the linker command line, and this flag indicates to the
12             // linker that it can avoid linking in dynamic libraries that don't
13             // actually satisfy any symbols up to that point (as with many other
14             // resolutions the linker does). This option only applies to all
15             // following libraries so we're sure to pass it as one of the first
16             // arguments.
17             "-Wl,--as-needed".to_string(),
18         ],
19     );
20
21     TargetOptions {
22         dynamic_linking: false,
23         executables: true,
24         linker_is_gnu: true,
25         has_rpath: false,
26         pre_link_args: args,
27         position_independent_executables: false,
28         eh_frame_header: false,
29         ..Default::default()
30     }
31 }