The OpenD Programming Language

MH_OBJECT

The layout of the file depends on the filetype. For all but the MH_OBJECT file type the segments are padded out and aligned on a segment alignment boundary for efficient demand pageing. The MH_EXECUTE, MH_FVMLIB, MH_DYLIB, MH_DYLINKER and MH_BUNDLE file types also have the headers included as part of their first segment.

The file type MH_OBJECT is a compact format intended as output of the assembler and input (and possibly output) of the link editor (the .o format). All sections are in one unnamed segment with no segment padding. This format is used as an executable format when the file is so small the segment padding greatly increases its size.

The file type MH_PRELOAD is an executable format intended for things that are not executed under the kernel (proms, stand alones, kernels, etc). The format can be executed under the kernel but may demand paged it and not preload it before execution.

A core file is in MH_CORE format and can be any in an arbitrary legal Mach-O file.

Constants for the filetype field of the mach_header

Values

ValueMeaning
MH_OBJECT

Relocatable object file.

MH_EXECUTE

Demand paged executable file.

MH_FVMLIB

Fixed VM shared library file.

MH_CORE

Core file.

MH_PRELOAD

Preloaded executable file.

MH_DYLIB

Dynamically bound shared library.

MH_DYLINKER

Dynamic link editor.

MH_BUNDLE

Dynamically bound bundle file.

MH_DYLIB_STUB

Shared library stub for static linking only, no section contents.

MH_DSYM

Companion file with only debug sections.

MH_KEXT_BUNDLE

X86_64 kexts.

Meta