This commit is contained in:
parent
7fe9efae21
commit
744ddcde54
1 changed files with 11 additions and 1 deletions
|
@ -2,11 +2,21 @@
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
- Headers must be included in the __TEXT segment.
|
- The start of the file must be loaded in some segment.
|
||||||
|
- The start of the file must be marked as readable + executable.
|
||||||
- Load command size must be divisible by 8.
|
- Load command size must be divisible by 8.
|
||||||
|
- Segments must be page-aligned in the file[^1].
|
||||||
|
|
||||||
|
Due to the page alignment requirement on disk[^1] instead of just memory,
|
||||||
|
MacOS is the only OS that forces you to write bloated executables on disk.
|
||||||
|
|
||||||
|
Until this check is removed, we cannot produce smaller executables.
|
||||||
|
|
||||||
|
[^1]: https://github.com/apple-oss-distributions/xnu/blob/main/bsd/kern/mach_loader.c#L2021-L2027
|
||||||
|
|
||||||
## Links
|
## Links
|
||||||
|
|
||||||
|
- https://github.com/apple-oss-distributions/xnu/blob/main/bsd/kern/mach_loader.c
|
||||||
- https://github.com/apple-oss-distributions/xnu/blob/main/EXTERNAL_HEADERS/mach-o/loader.h
|
- https://github.com/apple-oss-distributions/xnu/blob/main/EXTERNAL_HEADERS/mach-o/loader.h
|
||||||
- https://en.wikipedia.org/wiki/Mach-O
|
- https://en.wikipedia.org/wiki/Mach-O
|
||||||
- https://github.com/aidansteele/osx-abi-macho-file-format-reference
|
- https://github.com/aidansteele/osx-abi-macho-file-format-reference
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue