mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
Wasm: pre-link app-independent code before running tests (builtins, plaform & libc)
This commit is contained in:
parent
d0e3c45986
commit
5de9581b62
3 changed files with 21 additions and 55 deletions
|
@ -8,7 +8,6 @@ use wasmer::{Memory, WasmPtr};
|
|||
|
||||
use crate::helpers::from_wasm32_memory::FromWasm32Memory;
|
||||
use crate::helpers::wasm32_test_result::Wasm32TestResult;
|
||||
use roc_builtins::bitcode;
|
||||
use roc_can::builtins::builtin_defs_map;
|
||||
use roc_collections::all::{MutMap, MutSet};
|
||||
use roc_gen_wasm::{DEBUG_LOG_SETTINGS, MEMORY_NAME};
|
||||
|
@ -16,8 +15,6 @@ use roc_gen_wasm::{DEBUG_LOG_SETTINGS, MEMORY_NAME};
|
|||
// Should manually match build.rs
|
||||
const PLATFORM_FILENAME: &str = "wasm_test_platform";
|
||||
const OUT_DIR_VAR: &str = "TEST_GEN_OUT";
|
||||
const LIBC_PATH_VAR: &str = "TEST_GEN_WASM_LIBC_PATH";
|
||||
const COMPILER_RT_PATH_VAR: &str = "TEST_GEN_WASM_COMPILER_RT_PATH";
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use roc_mono::ir::PRETTY_PRINT_IR_SYMBOLS;
|
||||
|
@ -175,8 +172,6 @@ fn run_linker(
|
|||
let app_o_file = wasm_build_dir.join("app.o");
|
||||
let test_out_dir = std::env::var(OUT_DIR_VAR).unwrap();
|
||||
let test_platform_o = format!("{}/{}.o", test_out_dir, PLATFORM_FILENAME);
|
||||
let libc_a_file = std::env::var(LIBC_PATH_VAR).unwrap();
|
||||
let compiler_rt_o_file = std::env::var(COMPILER_RT_PATH_VAR).unwrap();
|
||||
|
||||
// write the module to a file so the linker can access it
|
||||
std::fs::write(&app_o_file, &app_module_bytes).unwrap();
|
||||
|
@ -185,10 +180,7 @@ fn run_linker(
|
|||
"wasm-ld",
|
||||
// input files
|
||||
app_o_file.to_str().unwrap(),
|
||||
bitcode::BUILTINS_WASM32_OBJ_PATH,
|
||||
&test_platform_o,
|
||||
&libc_a_file,
|
||||
&compiler_rt_o_file,
|
||||
// output
|
||||
"-o",
|
||||
final_wasm_file.to_str().unwrap(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue