Repository navigation
Synthesize managed ilasm native exports without explicit fixups - #137453
Conversation
Co-authored-by: Copilot App <[email protected]>
|
Azure Pipelines: Successfully started running 5 pipeline(s). 10 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
|
Tagging subscribers to this area: @JulieLeeMSFT, @dotnet/jit-contrib |
There was a problem hiding this comment.
🟡 Changes recommended
Synthesized vtable layouts can assign conflicting slots or leave zero-token slots, allowing invalid mappings to pass validation and produce unloadable images.
1 open issue
What changed in this PR
This PR enables managed ilasm to emit native exports from .export directives without explicit .vtfixup declarations, using the existing export validation and PE-writing pipeline.
Changes:
- Synthesizes compact, pointer-sized fixup slots while preserving existing mapped data.
- Expands regression coverage for export metadata, sparse ordinals, diagnostics, and command-line flags.
- Updates documentation to describe export synthesis rather than intentional omission.
| File | Description |
|---|---|
src/tools/ilasm/tests/ILAssembler.Tests/NativeExportTests.cs |
Tests synthesized exports across architectures and ordinal layouts. |
src/tools/ilasm/tests/ILAssembler.Tests/ExportedTypeTests.cs |
Expects mixed-mode output for exports without fixups. |
src/tools/ilasm/tests/ilasm.Tests/CommandLineTests.cs |
Tests native exports with legacy and modern CLI flags. |
src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.BuildImage.cs |
Synthesizes fixups and integrates their associations into export validation. |
src/tools/ilasm/MANAGED-ILASM-FIXES.md |
Documents compact synthesized slots for sparse exports. |
Review effort: Balanced
Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
An empty-layout return bypasses association validation, allowing a lone native export with an invalid explicit .vtentry and no .vtfixup to be silently dropped without diagnostics.
1 open issue
1 resolved since last review
Review effort: Balanced
Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>


Synthesize a pointer-sized, writable vtable fixup table for
.exportdirectives when the source has no explicit.vtfixup. Feed the synthesized associations through the existing export validation and PE writer so native stubs, export names/ordinals, and mixed-mode flags are emitted normally.Explicit fixup declarations retain their existing handling. Synthesized slots are compact even for sparse export ordinals; existing mapped data is preserved. Update regression coverage and remove the documented claim that ignoring these exports was intentional.
Validation:
.\build.cmd clr+libs -rc release— passed, clean baseline..\dotnet.cmd build src\tools\ilasm\src\ILAssembler\ILAssembler.csproj— passed for net10.0, net11.0, and net472, without warnings..\dotnet.cmd test src\tools\ilasm\tests\ILAssembler.Tests\ILAssembler.Tests.csproj --logger trx --results-directory artifacts\tmp\ilasm-final— passed: 5,317 tests per framework (net10.0 and net11.0)..\dotnet.cmd test src\tools\ilasm\tests\ilasm.Tests\ilasm.Tests.csproj --logger trx --results-directory artifacts\tmp\ilasm-cli-final— passed: 567 tests, 3 existing platform/working-directory skips.src/tests/Loader/classloader/MixedMode/AutoExports.ilthrough the CLI using both-DLL -PE64 -X64and--dll --x64, plus x86 defaults with both flag styles. A standalone caller loaded each assembly on Windows x64 and Windows x86, resolvedTwiceandTriple, and verified first and repeated calls returned 74 and 111 for input 37. Native ilasm outputs passed the same caller on both architectures. ARM64 output is covered by PE assertions, not execution.Resolves #137448
Note
This pull request was generated by GitHub Copilot.