https://bugs.winehq.org/show_bug.cgi?id=54831
--- Comment #4 from Brendan Shanks bshanks@codeweavers.com --- (In reply to Fabian Maurer from comment #3)
Why does the preloader has to depend on libSystem to begin with? I thought the point of the preloader is that it runs before any other library functions, so making it run after libSystem sounds weird. If we use that zerofill approach, would the preloader still be needed?
Yes that is the idea of the preloader, but macOS doesn’t provide any supported way to do this and our unsupported method has been increasingly problematic on recent macOS versions (particularly since Monterey). dyld is now reserving some low memory before the preloader runs, and libSystem has to be initialized at some point.
You’re right that the preloader running after libSystem is weird, this is really just a step towards hopefully removing it (for x86_64). My hope is that a large-enough zerofill section (over the low 8GB) would reserve anywhere that an EXE needs to load and then the preloader will no longer be needed. (This is possible now that the PE separation is complete, since there are no requirements on where dlopen()’d libraries end up in memory)