Illink shouldn't emit compat junk for the PE envelope
- Dominant language
- C#
- Stars
- 392
- Forks
- 128
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 2
Description
This might end up being a Cecil issue, but the assemblies produced by illink currently generate the native entrypoint shim that was used to bootstrap the .NET runtime circa Windows 98 timeframe.
```
C:\git\runtime\artifacts\bin\ILLinkTrimAssembly\net6.0-windows-Release-x64\trimmed-runtimepack>dumpbin /imports System.Text.Json.dll
Microsoft (R) COFF/PE Dumper Version 14.28.29337.0
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file System.Text.Json.dll
File Type: DLL
Section contains the following imports:
mscoree.dll
402000 Import Address Table
4511FC Import Name Table
0 time date stamp
0 Index of first forwarder reference
0 _CorDllMain
Summary
2000 .reloc
2000 .rsrc
50000 .text
```
This costs about 90 bytes in the import table, about 10 bytes in the machine code that does the jump to the _CorDllMain entrypoint and 512 bytes in the `.reloc` section to describe the sole relocation needed for the jump to _CorDllMain.
We could potentially also generate resources into the .text section instead of the .rsrc section for another ~256 byte saving on average (the padding between sections is 512 bytes).
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.