#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.
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.
| int | mwlr_fd | fd of file file to over map |
| vm_prot_t | mwlr_protections | protections for new overmapping |
| uint64_t | mwlr_file_offset | offset in file of start of mapping |
| mach_vm_address_t | mwlr_address | start address of existing region |
| mach_vm_size_t | mwlr_size | size of existing region |
macroMWL_INFO_VERS
#define MWL_INFO_VERS 7
structmwl_info_hdr
| uint32_t | mwli_version | version of info blob, currently 7 |
| uint16_t | mwli_page_size | 0x1000 or 0x4000 (for sanity checking) |
| uint16_t | mwli_pointer_format | DYLD_CHAINED_PTR_* value |
| uint32_t | mwli_binds_offset | offset within this blob of bind pointers table |
| uint32_t | mwli_binds_count | number of pointers in bind pointers table (for range checks) |
| uint32_t | mwli_chains_offset | offset within this blob of dyld_chained_starts_in_image |
| uint32_t | mwli_chains_size | size of dyld_chained_starts_in_image |
| uint64_t | mwli_slide | slide to add to rebased pointers |
| uint64_t | mwli_image_address | add 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)