Expand description
Load-time initializers (S_MOD_INIT_FUNC_POINTERS / S_INIT_FUNC_OFFSETS).
After map + bind, dyld runs module constructors bottom-up (dependencies
before dependents) before transferring to LC_MAIN. Phase 7 implements the
same order for mapped images using kh_runtime::call_guest.
Modern Apple toolchains emit __TEXT,__init_offsets (S_INIT_FUNC_OFFSETS)
with 32-bit image-relative offsets instead of classic pointer arrays. Real
guests such as 7zz use that form; older images keep mod_init_func.
Structs§
- Init
Func - One initializer to invoke (already slide-adjusted guest VA).
Constants§
- SECTION_
TYPE - Mask for Mach-O section type bits in
flags. - S_
INIT_ FUNC_ OFFSETS - Section type: 32-bit offsets to initializers (
S_INIT_FUNC_OFFSETS). - S_
MOD_ INIT_ FUNC_ POINTERS - Section type: array of function pointers run at load (
S_MOD_INIT_FUNC_POINTERS).
Functions§
- collect_
mod_ init - Collects initializer VAs for one mapped image.
- plan_
initializers - Bottom-up initializer list: mapped dylibs in reverse map order, then main.
- run_
initializers - Runs all planned initializers on
guest_sp(16-byte aligned).