]> git.proxmox.com Git - rustc.git/blob - src/librustc_target/spec/cloudabi_base.rs
New upstream version 1.27.1+dfsg1
[rustc.git] / src / librustc_target / spec / cloudabi_base.rs
1 // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 use spec::{LinkArgs, LinkerFlavor, TargetOptions, RelroLevel};
12
13 pub fn opts() -> TargetOptions {
14 let mut args = LinkArgs::new();
15 args.insert(LinkerFlavor::Gcc, vec![
16 "-Wl,-Bstatic".to_string(),
17 "-Wl,--no-dynamic-linker".to_string(),
18 "-Wl,--eh-frame-hdr".to_string(),
19 "-Wl,--gc-sections".to_string(),
20 ]);
21
22 TargetOptions {
23 executables: true,
24 target_family: None,
25 linker_is_gnu: true,
26 pre_link_args: args,
27 position_independent_executables: true,
28 // As CloudABI only supports static linkage, there is no need
29 // for dynamic TLS. The C library therefore does not provide
30 // __tls_get_addr(), which is normally used to perform dynamic
31 // TLS lookups by programs that make use of dlopen(). Only the
32 // "local-exec" and "initial-exec" TLS models can be used.
33 //
34 // "local-exec" is more efficient than "initial-exec", as the
35 // latter has one more level of indirection: it accesses the GOT
36 // (Global Offset Table) to obtain the effective address of a
37 // thread-local variable. Using a GOT is useful only when doing
38 // dynamic linking.
39 tls_model: "local-exec".to_string(),
40 relro_level: RelroLevel::Full,
41 exe_allocation_crate: super::maybe_jemalloc(),
42 .. Default::default()
43 }
44 }