From 88f81890f0416465ad8313a6b428b5fb469a6b94 Mon Sep 17 00:00:00 2001 From: yowl Date: Sat, 5 Jul 2025 15:20:43 -0500 Subject: [PATCH 1/2] Add WasmCoreModule to build Wasm core modules as opposed to components. --- docs/using-nativeaot/compiling.md | 10 ++++++++++ .../BuildIntegration/Microsoft.NETCore.Native.targets | 5 +++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/docs/using-nativeaot/compiling.md b/docs/using-nativeaot/compiling.md index 46057c169966..3f0bbcce5644 100644 --- a/docs/using-nativeaot/compiling.md +++ b/docs/using-nativeaot/compiling.md @@ -115,6 +115,16 @@ Note that assemblies other than the one being published (e. g. those from refere See also the [NativeLibrary sample](../../samples/NativeLibrary). +### WebAssembly Core Modules for WASI + +NativeAOT-LLVM by default will produce Wasi component modules using the `wasm32-unknown-wasip2` triple. If you need to produce WebAssemblyCore modules from a library project, add +```xml + + true + +``` +to your project file. This can be useful for uses that do not support WebAssembly components, e.g. extism. + ## WebAssembly module imports Functions in other WebAssembly modules can be imported and invoked using `DllImport` and `WasmImportLinkage` e.g. diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets index d1ea61f025f9..4d8686b9d772 100644 --- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets +++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets @@ -125,7 +125,8 @@ The .NET Foundation licenses this file to you under the MIT license. -Oz wasm32-unknown-emscripten - wasm32-unknown-wasip2 + wasm32-unknown-wasip2 + wasm32-unknown-wasi 1048576 $(EmccStackSize) 1024 @@ -582,7 +583,7 @@ The .NET Foundation licenses this file to you under the MIT license. - + From f48887c929893245025f9b8a6fea40dc49b52eb8 Mon Sep 17 00:00:00 2001 From: yowl Date: Sun, 6 Jul 2025 09:34:04 -0500 Subject: [PATCH 2/2] typos --- .../BuildIntegration/Microsoft.NETCore.Native.targets | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets index 4d8686b9d772..8218d4b454d7 100644 --- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets +++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets @@ -125,8 +125,8 @@ The .NET Foundation licenses this file to you under the MIT license. -Oz wasm32-unknown-emscripten - wasm32-unknown-wasip2 - wasm32-unknown-wasi + wasm32-unknown-wasip2 + wasm32-unknown-wasi 1048576 $(EmccStackSize) 1024 @@ -583,7 +583,7 @@ The .NET Foundation licenses this file to you under the MIT license. - +