roc
roc copied to clipboard
fix: allow unlinked wasm to be compiled via llvm
Outcome:
~/src/roc-lang/roc/examples/nodejs-interop/wasm main !3 ?2
❯ RUST_BACKTRACE=1 ~/src/roc-lang/roc/target/debug/roc build --target=wasm32 --no-link --optimize main.roc
0 errors and 0 warnings found in 125 ms
while successfully building:
main.wasm
~/src/roc-lang/roc/examples/nodejs-interop/wasm main !4 ?2
❯ file main.wasm
main.wasm: WebAssembly (wasm) binary module version 0x1 (MVP)
~/src/roc-lang/roc/examples/nodejs-interop/wasm main !4 ?2
❯ wasm-tools demangle main.wasm -t
(module
(type (;0;) (func (param i32)))
(type (;1;) (func (result i64)))
(import "env" "__linear_memory" (memory (;0;) 1))
(func (;0;) (type 0) (param i32)
local.get 0
i64.const 64424509455
i64.store offset=4 align=4
local.get 0
i32.const 4
i32.store
)
(func (;1;) (type 0) (param i32)
local.get 0
i64.const 64424509455
i64.store offset=4 align=4
local.get 0
i32.const 4
i32.store
)
(func (;2;) (type 1) (result i64)
i64.const 12
)
(data (;0;) (i32.const 0) "\00\00\00\00Hello from Roc!")
(@custom "linking" (after data) "\02\08\91\81\80\80\00\04\00\00\00\22roc__mainForHost_1_exposed_generic\01\02#.L_str_literal_12877311511037107618\00\00\13\00\00\01\1aroc__mainForHost_1_exposed\00\00\02\1froc__mainForHost_1_exposed_size\05\af\80\80\80\00\01+.rodata..L_str_literal_12877311511037107618\02\00")
(@custom "reloc.CODE" (after data) "\04\02\04\12\01\04\04,\01\04")
(@custom "target_features" (after data) "\02+\0fmutable-globals+\08sign-ext")
)