- initial minimally invasive eXtended Span implementation
- rename ptr_diff to ptr_diff_bytes
- move some files to util subdir
- lots of cleanups
- start using the new checked pointers - this needs some real-world testing
Requirements for success after snipping a loader_command:
"codesign -s - my_app" must succeed.
"lldb my_app; process launch -s; continue" must succeed.
Optional loader_commands (macho-snip can remove these successfully):
LC_UUID, LC_BUILD_VERSION, LC_SOURCE_VERISON,
LC_DATA_IN_CODE (when 0==datasize)
Apple "strip -N" clears out LC_SYMTAB and LC_DYSYMTAB, but leaves
LC_DYLD_INFO_ONLY.export_size. Perhaps this could be zero if
constructed that way; snipping seems tedious because codesign
requires that __LINKEDIT must have no gaps.
LC_FUNCTION_STARTS seems to be required by codesign.
codesign wants offsets that point into __LINKEDIT to be in order:
LC_DYLD_INFO_ONLY, LC_FUNCTION_STARTS, LC_DATA_IN_CODE, LC_SYMTAB
MacOS seesm to require LC_LOAD_DYLINKER (else "zsh: Kiled"),
which seems to require LD_LOAD_DYLIB (else SIGABRT).
https://github.com/upx/upx/issues/446
----
modified: macho-snip.c
modified: udf.s
when building a tool to investigate "minimal" Mach-O executable
on Apple MacOS Big Sur using Apple M1 hardware (aarch64).
https://github.com/upx/upx/issues/567
modified: stub/tools/macho-snip/Makefile
modified: stub/tools/macho-snip/macho-snip.c
modified: stub/tools/macho-snip/udf.s