Topic summary

Mach-O

Mach-O

File format for executables, object code, shared libraries, and core dumps Mach-O (Mach object) is a file format for executables, object code, shared libraries, dynamically loaded code, and core dumps. It was developed to replace the a.out format. Mach-O is used by some systems based on the Mach kernel. NeXTSTEP, macOS, and iOS are examples of systems that use this format for native executables, libraries and object code. File layout Each Mach-O file is made up of one Mach-O header, followed by a series of load commands, followed by one or more segments, each of which contains between 0 and 255 sections. Mach-O uses the REL relocation format to handle references to symbols. When looking up symbols, Mach-O uses a two-level namespace that encodes each symbol into an 'object/symbol name' pair that is then linearly searched for, first by the object and then the symbol name. The basic structure—a list of variable-length "load commands" that reference pages of data elsewhere in the file—was also used in the executable file format for Accent.[citation needed] The Accent file format was, in turn, based on an idea from Spice Lisp.[citation needed] All multi-byte values in all data struc