Mach-O
From Wikipedia, the free encyclopedia
Mach-O | |
---|---|
File name extension | none, .o, .dylib |
Uniform Type Identifier | com.apple.mach-o-binary |
Developed by | Carnegie Mellon University/Apple Inc. |
Type of format | Binary, executable, object, shared libraries, core dump |
Container for | ARM, SPARC, PA-RISC, PowerPC and x86 executable code, memory image dumps |
Mach-O, short for Mach object file format, is a file format for executables, object code, shared libraries, dynamically-loaded code, and core dumps. A derivation of the a.out format, Mach-O offered more extensibility and faster access to information in the symbol table.
Mach-O was once used by most systems based on the Mach kernel. NeXTSTEP, Darwin and Mac OS X are examples of systems that have used this format for native executables, libraries and object code. GNU Hurd, which uses GNU Mach as its microkernel, uses ELF, and not Mach-O, as its standard binary format.
[edit] Mach-O 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 by first the object and then the symbol name.
Multiple Mach-O files can be combined in a multi-architecture binary; this allows a single binary file to contain code to support multiple instruction set architectures. For example, a multi-architecture binary for Mac OS X could contain both 32-bit and 64-bit PowerPC code, or could contain both 32-bit PowerPC or x86 code, or could contain 32-bit PowerPC code, 64-bit PowerPC code, 32-bit x86 code, and 64-bit x86 (x86-64) code.
[edit] See also
- Fat binary
- Universal binary
- Apple Intel transition
- Xcode
- Mac OS X users can type man Mach-O in Terminal to see its man page, also available online [1].
[edit] External links
- Mach-O File Format Reference (Apple Inc.)