[llvm] [llvm-readobj][COFF] Add support for more CET and hotpatch flags (PR #150967)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 28 22:38:09 PDT 2025
kkent030315 wrote:
> Thanks, the direction looks good!
>
> > Decreased the size of existing has-cet.exe.
>
> Can you elaborate a little about what has changed to make it that much smaller?
With a combination of MSVC linker flags and a special stub, the binary being commited to the repo can be made much smaller (around ~5kb).
- `/ENTRY:raw_main`: Avoid CRT wrappers being linked
- `/STUB:stub`: A specifically crafted DOS stub (minimum possible size of 64 bytes -- which isless than the default)
- ```
4D 5A 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
```
- `/NOCOFFGRPINFO`: No POGO metadata in debug directory
- `/EMITTOOLVERSIONINFO:NO`: No Rich header
- `/EMITPOGOPHASEINFO`: Eliminates ILTCG debug directory entry
- `/NOVCFEATURE`: Eliminate `IMAGE_DEBUG_TYPE_VC_FEATURE` debug directory (contains tool version data but different one from Rich)
- `/MANIFEST:NO`: No manifest.xml being made in `.rsrc`
> Instead of adding a handful of binaries, one for checking each individual flag, can we have one binary with as many flags set as possible within one file? Or are these flags mutually exclusive? (Or perhaps we don't need test coverage for every single possible flag, as long as we test some of them?)
None of those flags are mutually exclusive. I will squash all those new `has-*.exe` into the one and will add comments on how-to generate the binary. But we'd probably want to keep every test file separated (or should I squash `has-*.test` into the one as well?).
https://github.com/llvm/llvm-project/pull/150967
More information about the llvm-commits
mailing list