-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Use an ObjectWriter-based PE writer for crossgen2 #120454
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
jkoritzinsky
merged 73 commits into
dotnet:main
from
jkoritzinsky:unified-object-writer
Oct 28, 2025
Merged
Changes from 68 commits
Commits
Show all changes
73 commits
Select commit
Hold shift + click to select a range
63638bf
1st pass PEWriter based on CoffObjectWriter
jkoritzinsky e683065
Add export header support
jkoritzinsky 485ce2d
Emit PE relocs instead of COFF relocs and streamline the exports dire…
jkoritzinsky 70db624
Move files to Common in prep for inclusion in cg2
jkoritzinsky 2d4d8f3
Seal record type
jkoritzinsky aadac54
Split out Unwind/Debug info into nativeaot-specific files as we don't…
jkoritzinsky 2e29838
Remove support for merging grouped sections. The only sections where …
jkoritzinsky 9d5aa00
Fixup expected sections for R2R to be coded into the nodes themselves.
jkoritzinsky 1c18952
Add TODOs for determinism/checksums in the new PE writer
jkoritzinsky 7ba3359
Add support for symbol-size reloc
jkoritzinsky a09bade
Add support for custom section alignment
jkoritzinsky 1620f1d
Fix sections for code to avoid AV issues
jkoritzinsky 5cf1dea
Fix R2RCodegenCompilation -> R2RObjectWriter calls
jkoritzinsky 6ef1d40
Add missing alignment set
jkoritzinsky 0cb628b
Fix reloc handling and start moving over weird fixup paths to work on…
jkoritzinsky eb2554c
Fix typos
jkoritzinsky 89a797c
Remove object dumper as null is okay
jkoritzinsky 93bb15a
Fix how we include/exclude the runtime functions table for component …
jkoritzinsky 626e8fc
Put debug data in .text in the existing linker for now
jkoritzinsky 23a755b
We don't have info about output format at this time, so always put th…
jkoritzinsky 3e87601
Add suppression
jkoritzinsky 482d035
Root the delay load method thunks range node
jkoritzinsky fd585d9
Copy all metadata into the .cormeta section
jkoritzinsky 871c1a1
Add support for a symbol that represents a range between two symbols …
jkoritzinsky f1196a2
Write in the DOS program stub
jkoritzinsky f64f152
Fix UsesSubsectionsViaSymbols to not assume that anything targeting A…
jkoritzinsky 1f6bbce
Remove R2R-specific types from OutputInfoBuilder so it (or a version …
jkoritzinsky 25cda14
Integrate OutputInfoBuilder as an optional component of ObjectWriter
jkoritzinsky 6698c91
Add try-finally
jkoritzinsky ed7e475
Add a command line option for format and get enough working to genera…
jkoritzinsky 2551c9b
Fix writing PE optional header
jkoritzinsky 0f7e93b
Fix writing section contents and writing out the CLR header.
jkoritzinsky 674c2aa
Fix emitting symbol size for non-methods on R2R (needed for the "size…
jkoritzinsky f806ffd
Fix ilc build
jkoritzinsky 5631b07
Fix section layout to include section sizes for sections added after …
jkoritzinsky c357981
Emit cold method code nodes as part of the late phase.
jkoritzinsky dde50fb
Don't include padding in recorded section layout
jkoritzinsky 9ecea74
Fix absolute file relocs and recording symbol offsets in OutputInfoBu…
jkoritzinsky a4cc254
Generate the perfmap debug entry during build. We have the informatio…
jkoritzinsky f1a3fae
Add a concept of a "checksum" reloc to enable a generalized system fo…
jkoritzinsky eb8829d
Make outputInfoBuilder optional again as we don't need it for back-pa…
jkoritzinsky abffd27
Handle COFF timestamp and exporting the RTR header for composite mode
jkoritzinsky e1e5bdb
Fix 32-bit relative relocs in PEObjectWriter
jkoritzinsky 85c4a9b
Change format default
jkoritzinsky df0c0fa
Port over the rest of the reloc types supported by the PEWriter infra…
jkoritzinsky 4119e55
Fix rel32 relocs to calculate from the end of the reloc (not the start)
jkoritzinsky 57ab7c9
Fix calculating in-page RVA for the reloc map and use the new format …
jkoritzinsky 0d0ca5a
Output the node type name correctly into the map file
jkoritzinsky 43a6c0d
Provide large-enough spans for all R2R-used relocation types.
jkoritzinsky 60a8f06
Add support for all R2R arch targets to PEObjectWriter/CoffObjectWriter
jkoritzinsky 2a6187e
Change the ARM64 import thunks to only emit aligned relocs.
jkoritzinsky 80b1082
Fix ImportThunk offset handling for non-arm64
jkoritzinsky 8b2825a
Always put CLR metadata into the cormeta section (that's how the PE o…
jkoritzinsky 6aabbaf
Remove OriginalName (it's not used since we got rid of the grouped sy…
jkoritzinsky aca3844
COFF section indexes are 1-based.
jkoritzinsky 0249851
Correctly account for custom PE alignment and add the non-Windows fil…
jkoritzinsky 564de70
Handle section with no alignment bit set
jkoritzinsky 178c2a6
Fix ILC build
jkoritzinsky f9d0033
Align RiscV and LoongArch64 import thunk relocs
jkoritzinsky 9646f56
Fix machine kind for ARM to match R2R expectation
jkoritzinsky d9c623c
Correctly use PE32+ for riscv and loongarch64
jkoritzinsky 5ab5fc3
Add handling for multiple thumb bits in PEObjectWriter and unify thum…
jkoritzinsky e34d7d0
Only add the thumb bit when it was there initially
jkoritzinsky a3e7f26
Add imageBase for non-pcrel reloc
jkoritzinsky 98221a4
Set up resource directory so resources show up in the structure
jkoritzinsky 32ce05e
We should determine section by format (not exposed yet) instead of ta…
jkoritzinsky fc7a2e8
Go back to original R2R handling for the thumb bit for R2R. We should…
jkoritzinsky c28a7a6
Remove LegacyPE builder now that we're passing on Pri0 everywhere
jkoritzinsky 72cbdd5
Handle empty symbol ranges.
jkoritzinsky 5a7e03b
PR feedback
jkoritzinsky 082b414
Fix PDataSection reference
jkoritzinsky 3f754dc
Merge branch 'main' into unified-object-writer
jkoritzinsky 4cc19ca
Have each import thunk report being marked itself instead of checking…
jkoritzinsky File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
File renamed without changes.
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.