Commit 5d33d81 1 parent 993fd52 commit 5d33d81 Copy full SHA for 5d33d81
File tree 4 files changed +54
-2
lines changed
4 files changed +54
-2
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ WASM_LD?=wasm-ld-10
14
14
MO_LD? =../../src/mo-ld
15
15
16
16
_out/% .lib.o : % .c | _out
17
- $(WASM_CLANG ) --compile -fpic --std=c11 -- target=wasm32-unknown-unknown-wasm -fvisibility=hidden --optimize=3 \
17
+ $(WASM_CLANG ) --compile -fPIC --target=wasm32-unknown-emscripten --optimize=3 \
18
18
-fno-builtin -Wall \
19
19
$< --output $@
20
20
@@ -30,7 +30,7 @@ _out/%.linked.wasm: _out/%.base.wasm _out/%.lib.wasm
30
30
$(MO_LD ) -b _out/$* .base.wasm -l _out/$* .lib.wasm -o _out/$* .linked.wasm
31
31
32
32
_out/% .wat : _out/% .wasm
33
- wasm2wat --no-check $< -o $@
33
+ wasm2wat $< -o $@
34
34
35
35
_out/% .valid : _out/% .wasm
36
36
wasm-validate $< > $@ 2>&1 || true
Original file line number Diff line number Diff line change
1
+ __attribute__ ((visibility ("default" )))
2
+ int f (int x , int y )
3
+ {
4
+ return x + y ;
5
+ }
6
+
7
+ __attribute__ ((visibility ("default" )))
8
+ int (* exported (void )) (int x , int y )
9
+ {
10
+ return & f ;
11
+ }
Original file line number Diff line number Diff line change
1
+ (module
2
+ (type (;0;) (func (result i32 )))
3
+ (type (;1;) (func (param i32 ) (param i32 ) (result i32 )))
4
+ (import " rts" " exported" (func $exported (result i32 )))
5
+ (table (;0;) 0 0 anyfunc )
6
+ (memory (;0;) 2 )
7
+ (global $heap_base i32 (i32.const 65536 ))
8
+ (export " __heap_base" (global $heap_base ))
9
+ (func $call_imported (type 0 )
10
+ call $exported
11
+ i32.const 3
12
+ i32.const 5
13
+ call_indirect (type 1 )
14
+ )
15
+ )
Original file line number Diff line number Diff line change
1
+ (module
2
+ (type (;0;) (func (result i32)))
3
+ (type (;1;) (func (param i32 i32) (result i32)))
4
+ (type (;2;) (func))
5
+ (func $call_imported (type 0) (result i32)
6
+ call $exported
7
+ i32.const 3
8
+ i32.const 5
9
+ call_indirect (type 1))
10
+ (func $__wasm_call_ctors (type 2)
11
+ call $__wasm_apply_relocs)
12
+ (func $__wasm_apply_relocs (type 2))
13
+ (func $f (type 1) (param i32 i32) (result i32)
14
+ local.get 1
15
+ local.get 0
16
+ i32.add)
17
+ (func $exported (type 0) (result i32)
18
+ global.get 1)
19
+ (func $link_start (type 2)
20
+ call $__wasm_call_ctors)
21
+ (table (;0;) 1 1 funcref)
22
+ (memory (;0;) 2)
23
+ (global (;0;) i32 (i32.const 65536))
24
+ (global (;1;) (mut i32) (i32.const 0))
25
+ (start $link_start)
26
+ (elem (i32.const 0) func $f))
You can’t perform that action at this time.
0 commit comments