Mach-O
Mach-O
Main page

Mach-O

logo
Community Hub0 subscribers
What are your thoughts?
Be the first to start a discussion here.
Be the first to start a discussion here.
Mach-O

Mach-O (Mach object) file format, 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.

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 structures are written in the byte order of the host for which the code was produced.

For big-endian binaries (as in, the architecture uses big endian), magic number for 32-bit code is 0xfeedface while the magic number for 64-bit architectures is 0xfeedfacf. For little-endian binaries, it will be 0xcefaedfe for 32-bit and 0xcffaedfe for 64-bit. These latter two are just the former but with inverted endianness.

The reserved value is only present in 64-bit Mach-O files. It is reserved for future use or extension of the 64-bit header.

The CPU type indicates the instruction set architecture for the code. If the file is for the 64-bit version of the instruction set architecture, the CPU type value has the 0x01000000 bit set.

See all
User Avatar
No comments yet.