- Mach-O
Infobox file format
name = Mach-O
icon =
extension = none, .o, .dylib
mime =
type code =
uniform type = com.apple.mach-o-binary
owner =Carnegie Mellon University /Apple Inc.
genre = Binary,executable , object,shared libraries ,core dump
container for = ARM,SPARC ,PA-RISC ,PowerPC and x86executable code, memory image dumps
contained by =
extended from =
extended to =
standard =Mach-O, short for Mach object file format, is a
file format forexecutable s,object code ,shared libraries , dynamically-loaded code, andcore dump s. A derivation of thea.out format, Mach-O offered more extensibility and faster access to information in thesymbol table .Mach-O was once used by most systems based on the
Mach kernel .NeXTSTEP , Darwin andMac OS X are examples of systems that have used this format for native executables, libraries and object code.GNU Hurd , which usesGNU Mach as itsmicrokernel , uses ELF, and not Mach-O, as its standard binary format.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.
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. The Accent file format was in turn, based on an idea from
Spice Lisp .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 both32-bit and64-bit PowerPC code, or could contain both 32-bit PowerPC orx86 code, or could contain 32-bit PowerPC code, 64-bit PowerPC code, 32-bit x86 code, and 64-bit x86 (x86-64 ) code.ee 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 [http://developer.apple.com/documentation/Darwin/Reference/ManPages/man5/Mach-O.5.html] .External links
* [http://developer.apple.com/documentation/DeveloperTools/Conceptual/MachORuntime/index.html Mach-O File Format Reference] (Apple Inc.)
Wikimedia Foundation. 2010.