]> git.lizzy.rs Git - rust.git/blob - src/librustc_back/target/asmjs_unknown_emscripten.rs
Auto merge of #47926 - mikhail-m1:subslice_pattern_array_drop2, r=nikomatsakis
[rust.git] / src / librustc_back / target / asmjs_unknown_emscripten.rs
1 // Copyright 2015 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 LinkerFlavor;
12 use super::{LinkArgs, Target, TargetOptions};
13 use super::emscripten_base::{cmd};
14
15 pub fn target() -> Result<Target, String> {
16     let mut args = LinkArgs::new();
17     args.insert(LinkerFlavor::Em,
18                 vec!["-s".to_string(),
19                      "ERROR_ON_UNDEFINED_SYMBOLS=1".to_string()]);
20
21     let opts = TargetOptions {
22         linker: cmd("emcc"),
23
24         dynamic_linking: false,
25         executables: true,
26         exe_suffix: ".js".to_string(),
27         linker_is_gnu: true,
28         allow_asm: false,
29         obj_is_bitcode: true,
30         is_like_emscripten: true,
31         max_atomic_width: Some(32),
32         post_link_args: args,
33         target_family: Some("unix".to_string()),
34         codegen_backend: "emscripten".to_string(),
35         .. Default::default()
36     };
37     Ok(Target {
38         llvm_target: "asmjs-unknown-emscripten".to_string(),
39         target_endian: "little".to_string(),
40         target_pointer_width: "32".to_string(),
41         target_c_int_width: "32".to_string(),
42         target_os: "emscripten".to_string(),
43         target_env: "".to_string(),
44         target_vendor: "unknown".to_string(),
45         data_layout: "e-p:32:32-i64:64-v128:32:128-n32-S128".to_string(),
46         arch: "asmjs".to_string(),
47         linker_flavor: LinkerFlavor::Em,
48         options: opts,
49     })
50 }