]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_target/src/spec/illumos_base.rs
Rollup merge of #82497 - jyn514:json, r=CraftSpider
[rust.git] / compiler / rustc_target / src / spec / illumos_base.rs
1 use crate::spec::{LinkArgs, LinkerFlavor, TargetOptions};
2 use std::default::Default;
3
4 pub fn opts() -> TargetOptions {
5     let mut late_link_args = LinkArgs::new();
6     late_link_args.insert(
7         LinkerFlavor::Gcc,
8         vec![
9             // LLVM will insert calls to the stack protector functions
10             // "__stack_chk_fail" and "__stack_chk_guard" into code in native
11             // object files.  Some platforms include these symbols directly in
12             // libc, but at least historically these have been provided in
13             // libssp.so on illumos and Solaris systems.
14             "-lssp".to_string(),
15         ],
16     );
17
18     TargetOptions {
19         os: "illumos".to_string(),
20         dynamic_linking: true,
21         executables: true,
22         has_rpath: true,
23         os_family: Some("unix".to_string()),
24         is_like_solaris: true,
25         limit_rdylib_exports: false, // Linker doesn't support this
26         eliminate_frame_pointer: false,
27         eh_frame_header: false,
28         late_link_args,
29
30         // While we support ELF TLS, rust requires a way to register
31         // cleanup handlers (in C, this would be something along the lines of:
32         // void register_callback(void (*fn)(void *), void *arg);
33         // (see src/libstd/sys/unix/fast_thread_local.rs) that is currently
34         // missing in illumos.  For now at least, we must fallback to using
35         // pthread_{get,set}specific.
36         //has_elf_tls: true,
37
38         // FIXME: Currently, rust is invoking cc to link, which ends up
39         // causing these to get included twice.  We should eventually transition
40         // to having rustc invoke ld directly, in which case these will need to
41         // be uncommented.
42         //
43         // We want XPG6 behavior from libc and libm.  See standards(5)
44         //pre_link_objects_exe: vec![
45         //    "/usr/lib/amd64/values-Xc.o".to_string(),
46         //    "/usr/lib/amd64/values-xpg6.o".to_string(),
47         //],
48         ..Default::default()
49     }
50 }