]> git.lizzy.rs Git - rust.git/blob - src/librustc_target/spec/cloudabi_base.rs
Auto merge of #68414 - michaelwoerister:share-drop-glue, r=alexcrichton
[rust.git] / src / librustc_target / spec / cloudabi_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             "-Wl,-Bstatic".to_string(),
9             "-Wl,--no-dynamic-linker".to_string(),
10             "-Wl,--eh-frame-hdr".to_string(),
11             "-Wl,--gc-sections".to_string(),
12         ],
13     );
14
15     TargetOptions {
16         executables: true,
17         target_family: None,
18         linker_is_gnu: true,
19         pre_link_args: args,
20         position_independent_executables: true,
21         // As CloudABI only supports static linkage, there is no need
22         // for dynamic TLS. The C library therefore does not provide
23         // __tls_get_addr(), which is normally used to perform dynamic
24         // TLS lookups by programs that make use of dlopen(). Only the
25         // "local-exec" and "initial-exec" TLS models can be used.
26         //
27         // "local-exec" is more efficient than "initial-exec", as the
28         // latter has one more level of indirection: it accesses the GOT
29         // (Global Offset Table) to obtain the effective address of a
30         // thread-local variable. Using a GOT is useful only when doing
31         // dynamic linking.
32         tls_model: "local-exec".to_string(),
33         relro_level: RelroLevel::Full,
34         ..Default::default()
35     }
36 }