about summary refs log tree commit diff
path: root/src/librustc_back/target
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2015-11-26 19:05:10 +0000
committerBrian Anderson <banderson@mozilla.com>2016-02-06 20:56:14 +0000
commitd6c0d859f6d859aa6e418b5ec58246071efbc9de (patch)
tree0faba720f79f5047f27173e7173501b104503903 /src/librustc_back/target
parent34af2de4096b3b1c5d3a5b70171c6e27822aaefb (diff)
downloadrust-d6c0d859f6d859aa6e418b5ec58246071efbc9de.tar.gz
rust-d6c0d859f6d859aa6e418b5ec58246071efbc9de.zip
Add the asmjs-unknown-emscripten triple. Add cfgs to libs.
Backtraces, and the compilation of libbacktrace for asmjs, are disabled.

This port doesn't use jemalloc so, like pnacl, it disables jemalloc *for all targets*
in the configure file.

It disables stack protection.
Diffstat (limited to 'src/librustc_back/target')
-rw-r--r--src/librustc_back/target/asmjs_unknown_emscripten.rs37
-rw-r--r--src/librustc_back/target/mod.rs3
2 files changed, 39 insertions, 1 deletions
diff --git a/src/librustc_back/target/asmjs_unknown_emscripten.rs b/src/librustc_back/target/asmjs_unknown_emscripten.rs
new file mode 100644
index 00000000000..4197ae7c661
--- /dev/null
+++ b/src/librustc_back/target/asmjs_unknown_emscripten.rs
@@ -0,0 +1,37 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use super::{Target, TargetOptions};
+
+pub fn target() -> Target {
+    let opts = TargetOptions {
+        linker: "emcc".to_string(),
+        ar: "emar".to_string(),
+
+        dynamic_linking: false,
+        executables: true,
+        exe_suffix: ".js".to_string(),
+        no_compiler_rt: true,
+        linker_is_gnu: true,
+        allow_asm: false,
+        archive_format: "gnu".to_string(),
+        .. Default::default()
+    };
+    Target {
+        llvm_target: "asmjs-unknown-emscripten".to_string(),
+        target_endian: "little".to_string(),
+        target_pointer_width: "32".to_string(),
+        target_os: "emscripten".to_string(),
+        target_env: "".to_string(),
+        target_vendor: "unknown".to_string(),
+        arch: "asmjs".to_string(),
+        options: opts,
+    }
+}
diff --git a/src/librustc_back/target/mod.rs b/src/librustc_back/target/mod.rs
index 4c08ec4f544..443be6729ba 100644
--- a/src/librustc_back/target/mod.rs
+++ b/src/librustc_back/target/mod.rs
@@ -461,7 +461,8 @@ impl Target {
             x86_64_pc_windows_msvc,
             i686_pc_windows_msvc,
 
-            le32_unknown_nacl
+            le32_unknown_nacl,
+            asmjs_unknown_emscripten
         );