Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds the MH_IMPLICIT_PAGEZERO Mach-O header flag constant that was introduced in Apple's Xcode 15.3 SDK. While the flag appears to be unused in practice (possibly an abandoned feature), it was officially reserved in the macOS SDK and should be included for completeness and SDK compatibility.
Changes:
- Added
MH_IMPLICIT_PAGEZEROconstant with value0x10000000to theMH_FLAGShash in headers.rb
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Another confusing one I didn't include yet: a reference to a ruby-macho does have a typo and calls it |
Demonstration of this: $ clang main.c
$ otool -hv a.out
a.out:
Mach header
magic cputype cpusubtype caps filetype ncmds sizeofcmds flags
MH_MAGIC_64 ARM64 ALL 0x00 EXECUTE 16 744 NOUNDEFS DYLDLINK TWOLEVEL PIE
$ clang -Wl,-no_dynamic_access main.c
$ otool -hv a.out
a.out:
Mach header
magic cputype cpusubtype caps filetype ncmds sizeofcmds flags
MH_MAGIC_64 ARM64 ALL 0x00 EXECUTE 16 744 NOUNDEFS DYLDLINK TWOLEVEL NOFIXPREBINDING PIE |
This one is pretty confusing. It was added to
ld-classicbut not regularldin Xcode 15.3, as well as read support inotool.But as far as I can tell I don't see anywhere that actually uses it, unless it's in some unusual closed source part of dyld or xnu.
And now that
ld -ld_classicno longer allows options that only existed under ld-classic, the only way to actually use it is to point to theld-classicexecutable directly.I suspect it might have been an abandoned idea that still partially shipped but nevertheless, the bit was reserved and the name for it shipped in the macOS SDK.