]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_target/src/spec/illumos_base.rs
Auto merge of #87869 - thomcc:skinny-io-error, r=yaahc
[rust.git] / compiler / rustc_target / src / spec / illumos_base.rs
1 use crate::spec::{FramePointer, 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             // The illumos libc contains a stack unwinding implementation, as
10             // does libgcc_s.  The latter implementation includes several
11             // additional symbols that are not always in base libc.  To force
12             // the consistent use of just one unwinder, we ensure libc appears
13             // after libgcc_s in the NEEDED list for the resultant binary by
14             // ignoring any attempts to add it as a dynamic dependency until the
15             // very end.
16             // FIXME: This should be replaced by a more complete and generic
17             // mechanism for controlling the order of library arguments passed
18             // to the linker.
19             "-lc".to_string(),
20             // LLVM will insert calls to the stack protector functions
21             // "__stack_chk_fail" and "__stack_chk_guard" into code in native
22             // object files.  Some platforms include these symbols directly in
23             // libc, but at least historically these have been provided in
24             // libssp.so on illumos and Solaris systems.
25             "-lssp".to_string(),
26         ],
27     );
28
29     TargetOptions {
30         os: "illumos".to_string(),
31         dynamic_linking: true,
32         executables: true,
33         has_rpath: true,
34         families: vec!["unix".to_string()],
35         is_like_solaris: true,
36         linker_is_gnu: false,
37         limit_rdylib_exports: false, // Linker doesn't support this
38         frame_pointer: FramePointer::Always,
39         eh_frame_header: false,
40         late_link_args,
41
42         // While we support ELF TLS, rust requires a way to register
43         // cleanup handlers (in C, this would be something along the lines of:
44         // void register_callback(void (*fn)(void *), void *arg);
45         // (see src/libstd/sys/unix/fast_thread_local.rs) that is currently
46         // missing in illumos.  For now at least, we must fallback to using
47         // pthread_{get,set}specific.
48         //has_thread_local: true,
49
50         // FIXME: Currently, rust is invoking cc to link, which ends up
51         // causing these to get included twice.  We should eventually transition
52         // to having rustc invoke ld directly, in which case these will need to
53         // be uncommented.
54         //
55         // We want XPG6 behavior from libc and libm.  See standards(5)
56         //pre_link_objects_exe: vec![
57         //    "/usr/lib/amd64/values-Xc.o".to_string(),
58         //    "/usr/lib/amd64/values-xpg6.o".to_string(),
59         //],
60         ..Default::default()
61     }
62 }