Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ObjWriter] Emit the MH_SUBSECTIONS_VIA_SYMBOLS header flag for Mach-O (
#471) The flag tells the linker that there are no functions with overlapping code and thus the code sections can be divided into subsections based on the symbols. This is similar in effect to how `-ffunction-sections` behaves on ELF. Notably, this enables optimization such as dead code stripping and identical code folding, if requested through linker switches. Old ld64 linker tends to run into deep stack loop without this switch if `-dead_strip` is used (encountered in Xamarin, not used by regular NativeAOT), and often ends up stack overflowing. New Xcode 15+ linker completely fails to produce correct unwind tables without this flag, which results in the NativeAOT executables crashing during GC or on first stack walk.
- Loading branch information