Merge remote-tracking branch 'origin/main' into pch/wasi_common_cap_std
This commit is contained in:
@@ -19,6 +19,12 @@ use wasmtime_wasi::snapshots::preview_1::Wasi as WasiSnapshot1;
|
||||
#[cfg(feature = "wasi-nn")]
|
||||
use wasmtime_wasi_nn::{WasiNn, WasiNnCtx};
|
||||
|
||||
#[cfg(feature = "wasi-crypto")]
|
||||
use wasmtime_wasi_crypto::{
|
||||
WasiCryptoAsymmetricCommon, WasiCryptoCommon, WasiCryptoCtx, WasiCryptoSignatures,
|
||||
WasiCryptoSymmetric,
|
||||
};
|
||||
|
||||
fn parse_module(s: &OsStr) -> Result<PathBuf, OsString> {
|
||||
// Do not accept wasmtime subcommand names as the module name
|
||||
match s.to_str() {
|
||||
@@ -368,5 +374,14 @@ fn populate_with_wasi(
|
||||
wasi_nn.add_to_linker(linker)?;
|
||||
}
|
||||
|
||||
#[cfg(feature = "wasi-crypto")]
|
||||
{
|
||||
let cx_crypto = WasiCryptoCtx::new();
|
||||
WasiCryptoCommon::new(linker.store(), cx_crypto.clone()).add_to_linker(linker)?;
|
||||
WasiCryptoAsymmetricCommon::new(linker.store(), cx_crypto.clone()).add_to_linker(linker)?;
|
||||
WasiCryptoSignatures::new(linker.store(), cx_crypto.clone()).add_to_linker(linker)?;
|
||||
WasiCryptoSymmetric::new(linker.store(), cx_crypto.clone()).add_to_linker(linker)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ pub fn compile_to_obj(
|
||||
);
|
||||
|
||||
let environ = ModuleEnvironment::new(compiler.isa().frontend_config(), &tunables, &features);
|
||||
let (mut translation, types) = environ
|
||||
let (_main_module, mut translation, types) = environ
|
||||
.translate(wasm)
|
||||
.context("failed to translate module")?;
|
||||
assert_eq!(translation.len(), 1);
|
||||
|
||||
Reference in New Issue
Block a user