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