diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
commit | 218caa410aa38c29984be31a5229b9fa717560ee (patch) | |
tree | c54bd55eeb6e4c508940a30e94c0032fbd45d677 /tests/run-make/wasm-symbols-not-imported | |
parent | Releasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip |
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/run-make/wasm-symbols-not-imported')
-rw-r--r-- | tests/run-make/wasm-symbols-not-imported/Makefile | 13 | ||||
-rw-r--r-- | tests/run-make/wasm-symbols-not-imported/foo.rs | 14 | ||||
-rw-r--r-- | tests/run-make/wasm-symbols-not-imported/verify-no-imports.js | 10 |
3 files changed, 37 insertions, 0 deletions
diff --git a/tests/run-make/wasm-symbols-not-imported/Makefile b/tests/run-make/wasm-symbols-not-imported/Makefile new file mode 100644 index 000000000..dc7618c19 --- /dev/null +++ b/tests/run-make/wasm-symbols-not-imported/Makefile @@ -0,0 +1,13 @@ +include ../../run-make-fulldeps/tools.mk + +# only-wasm32-bare + +all: + $(RUSTC) foo.rs --target wasm32-unknown-unknown + $(NODE) verify-no-imports.js $(TMPDIR)/foo.wasm + $(RUSTC) foo.rs --target wasm32-unknown-unknown -C lto + $(NODE) verify-no-imports.js $(TMPDIR)/foo.wasm + $(RUSTC) foo.rs --target wasm32-unknown-unknown -O + $(NODE) verify-no-imports.js $(TMPDIR)/foo.wasm + $(RUSTC) foo.rs --target wasm32-unknown-unknown -O -C lto + $(NODE) verify-no-imports.js $(TMPDIR)/foo.wasm diff --git a/tests/run-make/wasm-symbols-not-imported/foo.rs b/tests/run-make/wasm-symbols-not-imported/foo.rs new file mode 100644 index 000000000..b25bdc980 --- /dev/null +++ b/tests/run-make/wasm-symbols-not-imported/foo.rs @@ -0,0 +1,14 @@ +#![crate_type = "cdylib"] +#![no_std] + +use core::panic::PanicInfo; + +#[no_mangle] +pub extern fn foo() { + panic!() +} + +#[panic_handler] +fn panic(_info: &PanicInfo) -> ! { + loop {} +} diff --git a/tests/run-make/wasm-symbols-not-imported/verify-no-imports.js b/tests/run-make/wasm-symbols-not-imported/verify-no-imports.js new file mode 100644 index 000000000..90e3df1d9 --- /dev/null +++ b/tests/run-make/wasm-symbols-not-imported/verify-no-imports.js @@ -0,0 +1,10 @@ +const fs = require('fs'); +const process = require('process'); +const assert = require('assert'); +const buffer = fs.readFileSync(process.argv[2]); + +let m = new WebAssembly.Module(buffer); +let list = WebAssembly.Module.imports(m); +console.log('imports', list); +if (list.length !== 0) + throw new Error("there are some imports"); |