NeXTSTEP, macOS, and iOS are examples of systems that use this format for native executables, libraries and object code.
[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.
This is required by tools that modify the multi-architecture binary, in order for them to keep the image properly aligned.
The permissions on a region of the virtual address space may be changed by application or library code with calls to routines such as mprotect(); the maximum virtual memory protections limit what permissions may be granted for access to the segment.
You can easily use file offset without using the RAM addresses and relocations to build a symbol reader and to read the link edit sections and even map method calls or design a disassembler.
Link libraries are the same as any other Mach-O binary, just that there is no command that specifies the main entry point at which the program begins.
Load command type 0x0000000C are for the full file path to the dynamically linked shared library.
Load command type 0x0000000D are for dynamically linked shared locations from the application's current path.
Load command type 0x00000018 is for a dynamically linked shared library that is allowed to be missing.
The library is located by ordinal number in the compressed and uncompressed link edit information sections.
Only undefined symbols use the data info section to specify a library ordinal number and linker options.
A Pointer is a value that is read by the program machine code to call a method from another binary file.
Altering the order would cause the wrong method to be called during machine code execution.
The size of each JUMP instruction is based on processor type and is stored in the reserved2 value under the section32/64 of a segment load command.
If you are designing a disassembler you can easily map just the symbol name to the offset address of each stub and pointer to show the method or function call taking place without looking for the undefined symbol address location in other Mach-O files.
The indirect symbol table and location of the stubs and pointer sections are no longer required.
The indirect symbol table still exists in the case of building backwards compatible Mach-O files that load on newer and older OS versions.
Weak binding means that if the set library to look in by library ordinal number, and the set symbol name does not exist but exists under a different previously loaded Mach-O file then the symbol location is used from the other Mach-O file.
A load command starting with type 0x00000028 is used to specify the address location the application begins at.
If the segments/sections of the program do not have to be relocated to run, then the main entry point is the exact address location.
This replaced the old load command 0x00000005 which varied by CPU type as it stored the state that all the registers should be at before the program starts.
A load command starting with type 0x0000001B is used to specify the universally unique identifier (UUID) of the application.
A load command starting with type 0x00000032 is used to specify the minimum OS version information.
With the introduction of Mac OS X 10.6 platform the Mach-O file underwent a significant modification that causes binaries compiled on a computer running 10.6 or later to be (by default) executable only on computers running Mac OS X 10.6 or later.
The difference stems from load commands that the dynamic linker, in previous Mac OS X versions, does not understand.
Most desktops are x86, meaning that a Mach-O with an x86 binary will run without problems if you load the sections into memory.
The Mach-O files stored on the device can vary between iPhone (iOS), macOS, watchOS, and tvOS.
As a more extensive solution based on this loader, the Darling Project aims at providing a complete environment allowing macOS applications to run on Linux.
For the Ruby programming language, the ruby-macho[18] library provides an implementation of a Mach-O binary parser and editor.