Skip to content

[wasm][coreclr] Put generated callhelpers into libcoreclr_gen_static library#128248

Open
radekdoulik wants to merge 2 commits into
dotnet:mainfrom
radekdoulik:wasm-coreclr-separate-generated-lib
Open

[wasm][coreclr] Put generated callhelpers into libcoreclr_gen_static library#128248
radekdoulik wants to merge 2 commits into
dotnet:mainfrom
radekdoulik:wasm-coreclr-separate-generated-lib

Conversation

@radekdoulik
Copy link
Copy Markdown
Member

@radekdoulik radekdoulik commented May 15, 2026

Move callhelpers-interp-to-managed.cpp, callhelpers-reverse.cpp, and
callhelpers-pinvoke.cpp out of cee_wks_core/coreclr_static into a new
cee_wks_gen object library and coreclr_gen_static static library.

This allows relinking with just libcoreclr_static plus newly generated
callhelper sources, without rebuilding the entire coreclr.

The new library is linked in all WASM/coreclr consumers: corerun,
browserhost, and installed alongside coreclr_static.

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

radekdoulik and others added 2 commits May 15, 2026 11:00
Move callhelpers-interp-to-managed.cpp, callhelpers-reverse.cpp, and
callhelpers-pinvoke.cpp out of cee_wks_core/coreclr_static into a new
cee_wks_gen object library and coreclr_gen_static static library.

This allows relinking with just libcoreclr_static plus newly generated
callhelper sources, without rebuilding the entire coreclr.

The new library is linked in all WASM/coreclr consumers: corerun,
browserhost, and installed alongside coreclr_static.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 15, 2026 09:31
@radekdoulik radekdoulik added arch-wasm WebAssembly architecture area-Infrastructure-coreclr Only use for closed issues labels May 15, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR separates the auto-generated WASM callhelpers (callhelpers-interp-to-managed.cpp, callhelpers-reverse.cpp, and optionally callhelpers-pinvoke.cpp) out of libcoreclr_static.a and into a new libcoreclr_gen_static.a archive. This avoids duplicate symbol errors when the app-level WASM build compiles its own generated reverse-pinvoke-table.cpp: previously the default reverse-thunk table was already embedded in libcoreclr_static.a, forcing the app build to skip recompiling it. With the generated objects split into a separate archive that the app can choose not to link against the default version of, the app can now compile and use its own reverse-pinvoke table.

Changes:

  • Introduce a new cee_wks_gen OBJECT target and coreclr_gen_static STATIC library for WASM only, holding the generated callhelpers.
  • Re-enable compilation of the app-generated reverse-pinvoke-table.cpp in BrowserWasmApp.CoreCLR.targets and link the new archive into corerun/browserhost.
  • Register libcoreclr_gen_static.a in the Microsoft.NETCore.App platform manifest.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/coreclr/vm/CMakeLists.txt Moves generated callhelpers sources from VM_SOURCES_WKS_ARCH into new VM_SOURCES_WKS_GEN list and absolute-path-converts it.
src/coreclr/vm/wks/CMakeLists.txt Creates the cee_wks_gen OBJECT target on WASM with PCH and the same dependency wiring as the other wks targets.
src/coreclr/dlls/mscoree/coreclr/CMakeLists.txt Defines the coreclr_gen_static STATIC library from cee_wks_gen objects and installs it for WASM/mobile destinations.
src/coreclr/hosts/corerun/CMakeLists.txt Links coreclr_gen_static into corerun when available.
src/native/corehost/browserhost/CMakeLists.txt Adds libcoreclr_gen_static.a to the browserhost native link list.
src/mono/browser/build/BrowserWasmApp.CoreCLR.targets Re-enables compiling the app-generated reverse-pinvoke-table.cpp and removes the now-stale duplicate-symbol comment.
src/installer/pkg/sfx/Microsoft.NETCore.App/Directory.Build.props Registers the new static archive in the platform manifest.

@radekdoulik radekdoulik changed the title [wasm][corecl] Put generated callhelpers into libcoreclr_gen_static library [wasm][coreclr] Put generated callhelpers into libcoreclr_gen_static library May 15, 2026
@radekdoulik radekdoulik requested a review from jkoritzinsky May 15, 2026 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arch-wasm WebAssembly architecture area-Infrastructure-coreclr Only use for closed issues

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants