]> git.proxmox.com Git - rustc.git/blob - compiler/rustc_target/src/spec/cloudabi_base.rs
New upstream version 1.49.0+dfsg1
[rustc.git] / compiler / rustc_target / src / spec / cloudabi_base.rs
1 use crate::spec::{LinkArgs, LinkerFlavor, RelroLevel, TargetOptions, TlsModel};
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,--gc-sections".to_string(),
11 ],
12 );
13
14 TargetOptions {
15 os: "cloudabi".to_string(),
16 executables: true,
17 os_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: TlsModel::LocalExec,
33 relro_level: RelroLevel::Full,
34 ..Default::default()
35 }
36 }