Repository navigation
Fix NativeAOT WASM math helper calling conventions - #136208
Merged
MichalStrehovsky merged 2 commits intoOct 22, 2026
Merged
Conversation
Route x86 and WASM math calls through distinct runtime wrappers, including floating-point remainder helpers, while preserving direct libc imports on other architectures. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 50455c2b-3074-4f0c-a48f-2486534e5002
Contributor
|
Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara |
|
Azure Pipelines: Successfully started running 3 pipeline(s). 13 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @agocke, @dotnet/ilc-contrib |
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
Cross-architecture calling-convention changes need x86 and WASM link-and-run validation, which was not performed during this review.
No open issues 🎉
What changed in this PR
Fixes NativeAOT math calling-convention mismatches by routing x86 and WASM calls through dedicated runtime wrappers.
Changes:
- Renames math wrappers with the
Rhpprefix and enables them for WASM. - Updates managed imports and remainder helper mappings while preserving direct libc calls on other architectures.
| File | Description |
|---|---|
| src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/KnownExternFunctions.cs | Routes x86/WASM remainder helpers through wrappers. |
| src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/RuntimeImports.cs | Selects architecture-specific math imports. |
| src/coreclr/nativeaot/Runtime/MathHelpers.cpp | Renames wrappers and enables WASM support. |
Review effort: Balanced
Member
Author
|
/azp run runtime-nativeaot-outerloop |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
jkotas
reviewed
Oct 21, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 8bd8db78-9e93-4d8e-a82f-9456de1c8328
jkotas
approved these changes
Oct 22, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Wasm was running into linker warnings (visible in our first CI results!):
Route x86 and WASM math calls through distinct runtime wrappers, including floating-point remainder helpers, while preserving direct libc imports on other architectures.
x86 used some
/alternatenamelinker tricks to keep the names as their C library function, but I don't think it's possible on WASM because WASM doesn't do the x86 Windows symbol name manglings andsinissin.