-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix a number of issues with WASI libraries 1) Write and consume the exports list 2) Do not call "_initialize" twice. 3) Add "-mexec-model=reactor" to the linker command line * Add a test * Error out on missing SDKs * Fully specify the target triplet Avoids warnings such as the following: EXEC : warning : overriding the module target triple with wasm32-unknown-wasi [-Woverride-module] * Up node the NodeJS version for CI v18.16 is missing the WASI package. * Make the flag TU-local Co-authored-by: Jan Kotas <[email protected]> --------- Co-authored-by: Jan Kotas <[email protected]>
- Loading branch information
1 parent
09417c1
commit 68cf326
Showing
10 changed files
with
100 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
src/tests/nativeaot/SmokeTests/SharedLibrary/SharedLibraryDriver.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { readFile } from 'node:fs/promises'; | ||
import { WASI } from 'wasi'; | ||
import { argv, env } from 'node:process'; | ||
|
||
const wasi = new WASI({ | ||
version: 'preview1', | ||
args: argv, | ||
env | ||
}); | ||
|
||
const wasm = await WebAssembly.compile( | ||
await readFile(new URL("./SharedLibrary.wasm", import.meta.url)), | ||
); | ||
|
||
const instance = await WebAssembly.instantiate(wasm, wasi.getImportObject()); | ||
|
||
wasi.initialize(instance); | ||
|
||
if (instance.exports.ReturnsPrimitiveInt() != 10) | ||
process.exit(1); | ||
|
||
if (instance.exports.ReturnsPrimitiveBool() != 1) | ||
process.exit(2); | ||
|
||
if (instance.exports.ReturnsPrimitiveChar() != 97) // 'a' | ||
process.exit(3); | ||
|
||
// As long as no unmanaged exception is thrown managed class loaders were initialized successfully. | ||
instance.exports.EnsureManagedClassLoaders(); | ||
|
||
// #if !CODEGEN_WASI - for some reason tries to create a background thread? | ||
// if (instance.exports.CheckSimpleGCCollect() != 100) | ||
// process.exit(4); | ||
|
||
// #if !CODEGEN_WASI - enable when we support exception handling | ||
// if (instance.exports.CheckSimpleExceptionHandling() != 100) | ||
// process.exit(5); | ||
|
||
process.exit(100); |