From 698f8c2f01ea549d77d7dc3338a12e04c11057b9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:02:58 +0200 Subject: Adding upstream version 1.64.0+dfsg1. Signed-off-by: Daniel Baumann --- src/test/run-make/wasm-symbols-not-imported/Makefile | 13 +++++++++++++ src/test/run-make/wasm-symbols-not-imported/foo.rs | 14 ++++++++++++++ .../wasm-symbols-not-imported/verify-no-imports.js | 10 ++++++++++ 3 files changed, 37 insertions(+) create mode 100644 src/test/run-make/wasm-symbols-not-imported/Makefile create mode 100644 src/test/run-make/wasm-symbols-not-imported/foo.rs create mode 100644 src/test/run-make/wasm-symbols-not-imported/verify-no-imports.js (limited to 'src/test/run-make/wasm-symbols-not-imported') diff --git a/src/test/run-make/wasm-symbols-not-imported/Makefile b/src/test/run-make/wasm-symbols-not-imported/Makefile new file mode 100644 index 000000000..7a923375c --- /dev/null +++ b/src/test/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/src/test/run-make/wasm-symbols-not-imported/foo.rs b/src/test/run-make/wasm-symbols-not-imported/foo.rs new file mode 100644 index 000000000..b25bdc980 --- /dev/null +++ b/src/test/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/src/test/run-make/wasm-symbols-not-imported/verify-no-imports.js b/src/test/run-make/wasm-symbols-not-imported/verify-no-imports.js new file mode 100644 index 000000000..90e3df1d9 --- /dev/null +++ b/src/test/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"); -- cgit v1.2.3