]>
Commit | Line | Data |
---|---|---|
c30ab7b3 SL |
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 | ||
cc61c64b XL |
11 | use LinkerFlavor; |
12 | use super::{LinkArgs, Target, TargetOptions}; | |
c30ab7b3 SL |
13 | |
14 | pub fn target() -> Result<Target, String> { | |
cc61c64b XL |
15 | let mut post_link_args = LinkArgs::new(); |
16 | post_link_args.insert(LinkerFlavor::Em, | |
17 | vec!["-s".to_string(), | |
18 | "BINARYEN=1".to_string(), | |
19 | "-s".to_string(), | |
20 | "ERROR_ON_UNDEFINED_SYMBOLS=1".to_string()]); | |
21 | ||
c30ab7b3 | 22 | let opts = TargetOptions { |
c30ab7b3 SL |
23 | dynamic_linking: false, |
24 | executables: true, | |
25 | // Today emcc emits two files - a .js file to bootstrap and | |
26 | // possibly interpret the wasm, and a .wasm file | |
27 | exe_suffix: ".js".to_string(), | |
28 | linker_is_gnu: true, | |
29 | allow_asm: false, | |
30 | obj_is_bitcode: true, | |
8bb4bdeb | 31 | is_like_emscripten: true, |
c30ab7b3 | 32 | max_atomic_width: Some(32), |
3b2f2976 | 33 | post_link_args, |
32a655c1 | 34 | target_family: Some("unix".to_string()), |
2c00a5a8 | 35 | codegen_backend: "emscripten".to_string(), |
c30ab7b3 SL |
36 | .. Default::default() |
37 | }; | |
38 | Ok(Target { | |
39 | llvm_target: "asmjs-unknown-emscripten".to_string(), | |
40 | target_endian: "little".to_string(), | |
41 | target_pointer_width: "32".to_string(), | |
ea8adc8c | 42 | target_c_int_width: "32".to_string(), |
c30ab7b3 SL |
43 | target_os: "emscripten".to_string(), |
44 | target_env: "".to_string(), | |
45 | target_vendor: "unknown".to_string(), | |
46 | data_layout: "e-p:32:32-i64:64-v128:32:128-n32-S128".to_string(), | |
47 | arch: "wasm32".to_string(), | |
cc61c64b | 48 | linker_flavor: LinkerFlavor::Em, |
c30ab7b3 SL |
49 | options: opts, |
50 | }) | |
51 | } |