File tree Expand file tree Collapse file tree 3 files changed +30
-0
lines changed
src/test/run-make/wasm-spurious-import Expand file tree Collapse file tree 3 files changed +30
-0
lines changed Original file line number Diff line number Diff line change 1+ -include ../../run-make-fulldeps/tools.mk
2+
3+ # only-wasm32-bare
4+
5+ all :
6+ $(RUSTC ) main.rs -C overflow-checks=yes -C panic=abort -C lto -C opt-level=z --target wasm32-unknown-unknown
7+ $(NODE ) verify.js $(TMPDIR ) /main.wasm
Original file line number Diff line number Diff line change 1+ #![ crate_type = "cdylib" ]
2+ #![ no_std]
3+
4+ #[ panic_handler]
5+ fn my_panic ( _info : & core:: panic:: PanicInfo ) -> ! {
6+ loop { }
7+ }
8+
9+ #[ no_mangle]
10+ pub fn multer ( a : i128 , b : i128 ) -> i128 {
11+ // Trigger usage of the __multi3 compiler intrinsic which then leads to an imported
12+ // panic function in case of a bug. We verify that no imports exist in our verifier.
13+ a * b
14+ }
Original file line number Diff line number Diff line change 1+ const fs = require ( 'fs' ) ;
2+ const process = require ( 'process' ) ;
3+ const assert = require ( 'assert' ) ;
4+ const buffer = fs . readFileSync ( process . argv [ 2 ] ) ;
5+
6+ let m = new WebAssembly . Module ( buffer ) ;
7+ let imports = WebAssembly . Module . imports ( m ) ;
8+ console . log ( 'imports' , imports ) ;
9+ assert . strictEqual ( imports . length , 0 ) ;
You can’t perform that action at this time.
0 commit comments