Skip to content

Disable unused ReadyToRun metadata on WebAssembly - #134690

Open
davidwrighton wants to merge 1 commit into
dotnet:mainfrom
davidwrighton:wasm-strip-inlining-info
Open

davidwrighton wants to merge 1 commit into
dotnet:mainfrom
davidwrighton:wasm-strip-inlining-info

Conversation

@davidwrighton

Copy link
Copy Markdown
Member

Summary

Avoid emitting and loading ReadyToRun metadata that CoreCLR WebAssembly cannot consume.

  • Remove CoreCLR runtime support for the legacy InliningInfo section while retaining R2RDump support.
  • Derive FEATURE_INLINE_TRACKING_ENABLED from the profiling, ReJIT, and code-versioning feature macros, which leaves inline tracking disabled in WebAssembly builds.
  • Skip loading modern inline-tracking sections when no runtime feature consumes them.
  • Strip inline and debug information by default from Browser and WASI ReadyToRun images, including System.Private.CoreLib.wasm and framework-library .wasm files. The existing PublishReadyToRunStripInliningInfo=false and PublishReadyToRunStripDebugInfo=false opt-outs remain available.
  • Remove R2R version checks that are always true now that the minimum supported major version is 26.

Validation

  • ./build.sh clr -c Checked
  • ./build.sh clr+libs -os browser -c Release
  • Temporarily added a compile-time #error for TARGET_WASM && FEATURE_INLINE_TRACKING_ENABLED; the Browser/Wasm CoreCLR build succeeded, confirming the feature is disabled.
  • Verified the Crossgen2 command for System.Private.CoreLib.wasm contains both --strip-inlining-info and --strip-debug-info.
  • Used R2RDump to confirm System.Private.CoreLib.wasm and all 101 Release framework-library .wasm images contain none of:
    • DebugInfo
    • InliningInfo
    • InliningInfo2
    • CrossModuleInlineInfo
  • Compared CoreCLR section readers with Crossgen2 emission sites; no other runtime-consumed R2R section lacks a corresponding emitter.

Note

This pull request description was generated with GitHub Copilot.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 4 pipeline(s).
12 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@lewing

lewing commented Sep 25, 2026

Copy link
Copy Markdown
Member

related #134689

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @agocke
See info in area-owners.md if you want to be subscribed.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Correct the unsafe derived-to-base pointer-to-pointer cast in ReadyToRun section loading.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 Low severity

Open (1)
What changed in this PR

Disables unsupported ReadyToRun metadata emission and loading for WebAssembly builds.

Changes:

  • Gates inline-tracking support on runtime features.
  • Strips inline and debug metadata from Browser/WASI images.
  • Removes legacy version checks and documents supported sections.
File Summary
src/​tasks/​Crossgen2Tasks/​Microsoft.NET.CrossGen.targets Adds Browser/WASI stripping flags.
src/​coreclr/​vm/​zapsig.cpp Removes obsolete version gating.
src/​coreclr/​vm/​readytoruninfo.h Gates inline-tracking state and APIs.
src/​coreclr/​vm/​readytoruninfo.cpp Updates metadata loading and removes legacy checks.
src/​coreclr/​vm/​loaderallocator.cpp Gates inline-tracking cleanup locking.
src/​coreclr/​vm/​inlinetracking.h Removes legacy map definitions and gates support.
src/​coreclr/​vm/​inlinetracking.cpp Removes legacy map implementation.
src/​coreclr/​vm/​ceemain.cpp Gates inline-tracking initialization.
src/​coreclr/​vm/​ceeload.h Gates related declarations and state.
src/​coreclr/​vm/​ceeload.cpp Gates related implementations.
src/​coreclr/​inc/​switches.h Defines the feature condition.
src/​coreclr/​crossgen-corelib.proj Adds stripping flags for CoreLib WASM output.
docs/​design/​coreclr/​botr/​readytorun-format.md Documents runtime section consumption.

Comment thread src/coreclr/vm/readytoruninfo.cpp
#endif // _DEBUG

#if defined(PROFILING_SUPPORTED) || defined(PROFILING_SUPPORTED_DATA) || defined(FEATURE_REJIT) || defined(FEATURE_CODE_VERSIONING)
#define FEATURE_INLINE_TRACKING_ENABLED

@jkotas jkotas Sep 26, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
#define FEATURE_INLINE_TRACKING_ENABLED
#define FEATURE_INLINE_TRACKING

_ENABLED suffix is redundant on FEATURE_ macros. None of the existing FEATURE_ macros have it.

lewing added a commit that referenced this pull request Sep 26, 2026
#134690 adds --strip-debug-info and --strip-inlining-info for browser and
wasi ReadyToRun where the other strip defaults live, so the wasm pack
shouldn't add its own.

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

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants