]> git.proxmox.com Git - rustc.git/blob - src/librustc_back/target/wasm32_unknown_emscripten.rs
a06980767fd75cd58baded41b2fabe298191e15a
[rustc.git] / src / librustc_back / target / wasm32_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 super::{Target, TargetOptions};
12 use super::emscripten_base::{cmd};
13
14 pub fn target() -> Result<Target, String> {
15 let opts = TargetOptions {
16 linker: cmd("emcc"),
17 ar: cmd("emar"),
18
19 dynamic_linking: false,
20 executables: true,
21 // Today emcc emits two files - a .js file to bootstrap and
22 // possibly interpret the wasm, and a .wasm file
23 exe_suffix: ".js".to_string(),
24 linker_is_gnu: true,
25 allow_asm: false,
26 obj_is_bitcode: true,
27 max_atomic_width: Some(32),
28 post_link_args: vec!["-s".to_string(), "BINARYEN=1".to_string(),
29 "-s".to_string(), "ERROR_ON_UNDEFINED_SYMBOLS=1".to_string()],
30 target_family: Some("unix".to_string()),
31 .. Default::default()
32 };
33 Ok(Target {
34 llvm_target: "asmjs-unknown-emscripten".to_string(),
35 target_endian: "little".to_string(),
36 target_pointer_width: "32".to_string(),
37 target_os: "emscripten".to_string(),
38 target_env: "".to_string(),
39 target_vendor: "unknown".to_string(),
40 data_layout: "e-p:32:32-i64:64-v128:32:128-n32-S128".to_string(),
41 arch: "wasm32".to_string(),
42 options: opts,
43 })
44 }