]> git.lizzy.rs Git - rust.git/blob - src/librustc_target/spec/vxworks_base.rs
Auto merge of #68414 - michaelwoerister:share-drop-glue, r=alexcrichton
[rust.git] / src / librustc_target / spec / vxworks_base.rs
1 use crate::spec::{LinkArgs, LinkerFlavor, TargetOptions};
2 use std::default::Default;
3
4 pub fn opts() -> TargetOptions {
5     let mut args_crt = LinkArgs::new();
6     args_crt.insert(LinkerFlavor::Gcc, vec!["--static-crt".to_string()]);
7     let mut args = LinkArgs::new();
8     args.insert(
9         LinkerFlavor::Gcc,
10         vec![
11             // We want to be able to strip as much executable code as possible
12             // from the linker command line, and this flag indicates to the
13             // linker that it can avoid linking in dynamic libraries that don't
14             // actually satisfy any symbols up to that point (as with many other
15             // resolutions the linker does). This option only applies to all
16             // following libraries so we're sure to pass it as one of the first
17             // arguments.
18             "-Wl,--as-needed".to_string(),
19         ],
20     );
21
22     TargetOptions {
23         linker: Some("wr-c++".to_string()),
24         exe_suffix: ".vxe".to_string(),
25         dynamic_linking: true,
26         executables: true,
27         target_family: Some("unix".to_string()),
28         linker_is_gnu: true,
29         has_rpath: true,
30         pre_link_args: args,
31         position_independent_executables: false,
32         has_elf_tls: true,
33         pre_link_args_crt: args_crt,
34         crt_static_default: true,
35         crt_static_respected: true,
36         crt_static_allows_dylibs: true,
37         // VxWorks needs to implement this to support profiling
38         target_mcount: "_mcount".to_string(),
39         ..Default::default()
40     }
41 }