#include <mach/dyld_pager.h> not included by <mach/mach.h> — include it explicitly

mach/dyld_pager.h

File: mach/dyld_pager.h protos and struct definitions for the pager that applies dyld fixups.
3 macros · 2 structs · 1 function

structmwl_region

These describe the address regions (mwlr_address, mwlr_size) to be mapped from the given file (mwlr_fd, mwlr_file_offset) with mwlr_protections.
size 32, align 8
intmwlr_fdfd of file file to over map
vm_prot_tmwlr_protectionsprotections for new overmapping
uint64_tmwlr_file_offsetoffset in file of start of mapping
mach_vm_address_tmwlr_addressstart address of existing region
mach_vm_size_tmwlr_sizesize of existing region

macroMWL_INFO_VERS

#define MWL_INFO_VERS 7

structmwl_info_hdr

size 40, align 8
uint32_tmwli_versionversion of info blob, currently 7
uint16_tmwli_page_size0x1000 or 0x4000 (for sanity checking)
uint16_tmwli_pointer_formatDYLD_CHAINED_PTR_* value
uint32_tmwli_binds_offsetoffset within this blob of bind pointers table
uint32_tmwli_binds_countnumber of pointers in bind pointers table (for range checks)
uint32_tmwli_chains_offsetoffset within this blob of dyld_chained_starts_in_image
uint32_tmwli_chains_sizesize of dyld_chained_starts_in_image
uint64_tmwli_slideslide to add to rebased pointers
uint64_tmwli_image_addressadd this to rebase offsets includes any slide

macroMWL_MAX_REGION_COUNT

#define MWL_MAX_REGION_COUNT 5
data, const, data auth, auth const, objc const

function__map_with_linking_np

extern int __map_with_linking_np(
	const struct mwl_region regions[],
	uint32_t regionCount,
	const struct mwl_info_hdr* blob,
	uint32_t blobSize
)
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/mach/dyld_pager.h, bsd/vm/vm_unix.c (map_with_linking_np)
Wrapper for the map_with_linking_np() system call, used by dyld to map data regions of a binary that need load-time relocation fixups. Each mwl_region names a file descriptor, file offset, protections, and an existing address range to overmap; the link info blob, beginning with a mwl_info_hdr (version MWL_INFO_VERS), carries the chained-fixup rebase and bind information plus the slide. The kernel maps the regions through a special pager that applies the fixups during page-in, so the pages remain clean and can be discarded and re-created under memory pressure instead of being swapped; the mappings behave as MAP_PRIVATE. At most MWL_MAX_REGION_COUNT (5) regions per call. Returns 0 on success. A process can permanently disable the call via shared_region_check_np() with DYLD_VM_END_MWL. Not intended for use outside dyld.

macroDYLD_VM_END_MWL

Special value for dyld to use with shared_region_check_np() to prevent anymore use of map_with_linking_np() in a process
#define DYLD_VM_END_MWL (-1ull)