1 use super::wasm32_base;
2 use super::{LinkArgs, LinkerFlavor, Target, TargetOptions, PanicStrategy};
4 pub fn target() -> Result<Target, String> {
5 let mut post_link_args = LinkArgs::new();
6 post_link_args.insert(LinkerFlavor::Em,
8 "ERROR_ON_UNDEFINED_SYMBOLS=1".to_string(),
10 "ASSERTIONS=1".to_string(),
12 "DISABLE_EXCEPTION_CATCHING=1".to_string(),
13 // FIXME(tlively): Enable this linker option once libc type errors
14 // are resolved. See https://github.com/rust-lang/libc/pull/1478.
15 // "-Wl,--fatal-warnings".to_string(),
18 let opts = TargetOptions {
19 // emcc emits two files - a .js file to instantiate the wasm and supply platform
20 // functionality, and a .wasm file.
21 exe_suffix: ".js".to_string(),
24 is_like_emscripten: true,
25 // FIXME(tlively): Emscripten supports unwinding, but we would have to pass
26 // -enable-emscripten-cxx-exceptions to LLVM at codegen time and merge
27 // https://reviews.llvm.org/rG5c3cdef84b82464756bb571c13c31cf7773860c3to use it.
28 panic_strategy: PanicStrategy::Abort,
30 target_family: Some("unix".to_string()),
31 .. wasm32_base::options()
34 llvm_target: "wasm32-unknown-emscripten".to_string(),
35 target_endian: "little".to_string(),
36 target_pointer_width: "32".to_string(),
37 target_c_int_width: "32".to_string(),
38 target_os: "emscripten".to_string(),
39 target_env: String::new(),
40 target_vendor: "unknown".to_string(),
41 data_layout: "e-m:e-p:32:32-i64:64-n32:64-S128".to_string(),
42 arch: "wasm32".to_string(),
43 linker_flavor: LinkerFlavor::Em,