]>
Commit | Line | Data |
---|---|---|
e74abb32 | 1 | use super::wasm32_base; |
dfeec247 | 2 | use super::{LinkArgs, LinkerFlavor, PanicStrategy, Target, TargetOptions}; |
c30ab7b3 SL |
3 | |
4 | pub fn target() -> Result<Target, String> { | |
cc61c64b | 5 | let mut post_link_args = LinkArgs::new(); |
dfeec247 XL |
6 | post_link_args.insert( |
7 | LinkerFlavor::Em, | |
8 | vec![ | |
9 | "-s".to_string(), | |
10 | "ERROR_ON_UNDEFINED_SYMBOLS=1".to_string(), | |
11 | "-s".to_string(), | |
12 | "ASSERTIONS=1".to_string(), | |
13 | "-s".to_string(), | |
14 | "ABORTING_MALLOC=0".to_string(), | |
15 | "-Wl,--fatal-warnings".to_string(), | |
16 | ], | |
17 | ); | |
cc61c64b | 18 | |
c30ab7b3 | 19 | let opts = TargetOptions { |
e74abb32 XL |
20 | // emcc emits two files - a .js file to instantiate the wasm and supply platform |
21 | // functionality, and a .wasm file. | |
c30ab7b3 | 22 | exe_suffix: ".js".to_string(), |
e74abb32 | 23 | linker: None, |
c30ab7b3 | 24 | linker_is_gnu: true, |
8bb4bdeb | 25 | is_like_emscripten: true, |
e74abb32 | 26 | panic_strategy: PanicStrategy::Unwind, |
3b2f2976 | 27 | post_link_args, |
32a655c1 | 28 | target_family: Some("unix".to_string()), |
dfeec247 | 29 | ..wasm32_base::options() |
c30ab7b3 SL |
30 | }; |
31 | Ok(Target { | |
e74abb32 | 32 | llvm_target: "wasm32-unknown-emscripten".to_string(), |
c30ab7b3 SL |
33 | target_endian: "little".to_string(), |
34 | target_pointer_width: "32".to_string(), | |
ea8adc8c | 35 | target_c_int_width: "32".to_string(), |
c30ab7b3 | 36 | target_os: "emscripten".to_string(), |
b7449926 | 37 | target_env: String::new(), |
c30ab7b3 | 38 | target_vendor: "unknown".to_string(), |
e74abb32 | 39 | data_layout: "e-m:e-p:32:32-i64:64-n32:64-S128".to_string(), |
c30ab7b3 | 40 | arch: "wasm32".to_string(), |
cc61c64b | 41 | linker_flavor: LinkerFlavor::Em, |
c30ab7b3 SL |
42 | options: opts, |
43 | }) | |
44 | } |