Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Mach-O
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Multi-architecture binaries == Multiple Mach-O files can be combined in a [[Fat binary#NeXT's/Apple's multi-architecture binaries|multi-architecture binary]]. This allows a single binary file to contain code to support multiple instruction set architectures, for example for different generations and types of Apple devices, including different processor architectures<ref>{{cite web |work=OS X ABI Mach-O File Format Reference |title=Universal Binaries and 32-bit/64-bit PowerPC Binaries |date=2009-02-04 |orig-date=2003 |publisher=[[Apple Inc.]] |url=https://developer.apple.com/library/mac/documentation/developertools/conceptual/MachORuntime/Reference/reference.html#//apple_ref/doc/uid/20001298-154889 |url-status=dead |archive-url=https://web.archive.org/web/20140904004108/https://developer.apple.com/library/mac/documentation/developertools/conceptual/MachORuntime/Reference/reference.html#//apple_ref/doc/uid/20001298-154889 |archive-date=2014-09-04}}</ref> such as [[ARM64]] and [[x86-64]].<ref>{{cite web|url=https://developer.apple.com/documentation/apple-silicon/building-a-universal-macos-binary|title=Building a Universal macOS Binary|website=Apple Developer}}</ref> All fields in the universal header are big-endian.<ref name="mach-o-ref-data-types" /> The universal header is in the following form:<ref>{{cite web |work=OS X ABI Mach-O File Format Reference |title=fat_header |url=https://developer.apple.com/library/mac/documentation/developertools/conceptual/MachORuntime/Reference/reference.html#//apple_ref/c/tag/fat_header |date=2009-02-04 |orig-date=2003 |publisher=[[Apple Inc.]] |archive-url=https://web.archive.org/web/20140904004108/https://developer.apple.com/library/mac/documentation/developertools/conceptual/MachORuntime/Reference/reference.html#//apple_ref/c/tag/fat_header |archive-date=2014-09-04 |url-status=dead}}</ref> {|class="wikitable" |+ Mach-O universal header |- ! Offset !! Bytes !! Description |- | 0 || 4 || Magic number |- | 4 || 4 || Number of binaries |} The magic number in a multi-architecture binary is {{code|0xcafebabe}} in big-endian byte order, so the first 4 bytes of the header will always be {{code|0xca 0xfe 0xba 0xbe}}, in that order. The number of binaries is the number of entries that follow the header. The header is followed by a sequence of entries in the following form:<ref>{{cite web |work=OS X ABI Mach-O File Format Reference |title=fat_arch |url=https://developer.apple.com/library/mac/documentation/developertools/conceptual/MachORuntime/Reference/reference.html#//apple_ref/c/tag/fat_arch |date=2009-02-04 |orig-date=2003 |publisher=[[Apple Inc.]] |archive-url=https://web.archive.org/web/20140904004108/https://developer.apple.com/library/mac/documentation/developertools/conceptual/MachORuntime/Reference/reference.html#//apple_ref/c/tag/fat_arch |archive-date=2014-09-04 |url-status=dead}}</ref> {|class="wikitable" |+ Mach-O universal file entries |- ! Offset !! Bytes !! Description |- | 0 || 4 || CPU type |- | 4 || 4 || CPU subtype |- | 8 || 4 || File offset |- | 12 || 4 || Size |- | 16 || 4 || Section alignment (Power of 2) |} The sequence of entries is followed by a sequence of Mach-O images. Each entry refers to a Mach-O image. The CPU type and subtype for an entry must be the same as the CPU type and subtype for the Mach-O image to which the entry refers. The file offset and size are the offset in the file of the beginning of the Mach-O image, and the size of the Mach-O image, to which the entry refers. The section alignment is the logarithm, base 2, of the byte alignment in the file required for the Mach-O image to which the entry refers; for example, a value of 14 means that the image must be aligned on a 2<sup>14</sup>-byte boundary, i.e. a 16384-byte boundary. This is required by tools that modify the multi-architecture binary, in order for them to keep the image properly aligned.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)