A fat binary (or multiarchitecture binary) is a computer
executable program
In computer science, executable code, an executable file, or an executable program, sometimes simply referred to as an executable or binary, causes a computer "to perform indicated tasks according to encoded instructions", as opposed to a da ...
or
library
A library is a collection of Book, books, and possibly other Document, materials and Media (communication), media, that is accessible for use by its members and members of allied institutions. Libraries provide physical (hard copies) or electron ...
which has been expanded (or "fattened") with code native to multiple
instruction set
In computer science, an instruction set architecture (ISA) is an abstract model that generally defines how software controls the CPU in a computer or a family of computers. A device or program that executes instructions described by that ISA, s ...
s which can consequently be run on multiple processor types.
This results in a file larger than a normal one-architecture binary file, thus the name.
The usual method of implementation is to include a version of the
machine code
In computer programming, machine code is computer code consisting of machine language instructions, which are used to control a computer's central processing unit (CPU). For conventional binary computers, machine code is the binaryOn nonb ...
for each instruction set, preceded by a single
entry point
In computer programming, an entry point is the place in a program where the execution of a program begins, and where the program has access to command line arguments.
To start a program's execution, the loader or operating system passes co ...
with code compatible with all operating systems, which executes a jump to the appropriate section. Alternative implementations store different executables in different
forks
In cutlery or kitchenware, a fork (from 'pitchfork') is a Eating utensil, utensil, now usually made of metal, whose long handle terminates in a head that branches into several narrow and often slightly curved tine (structural), tines with whic ...
, each with its own entry point that is directly used by the operating system.
The use of fat binaries is not common in
operating system
An operating system (OS) is system software that manages computer hardware and software resources, and provides common daemon (computing), services for computer programs.
Time-sharing operating systems scheduler (computing), schedule tasks for ...
software; there are several alternatives to solve the same problem, such as the use of an
installer
Installation (or setup) of a computer program (including device drivers and plugins), is the act of making the program ready for execution. Installation refers to the particular configuration of software or hardware with a view to making it usabl ...
program to choose an architecture-specific binary at install time (such as with
Android multiple
APKs), selecting an architecture-specific binary at runtime (such as with
Plan 9's
union directories and
GNUstep
GNUstep is a free software implementation of the Cocoa (formerly OpenStep) Objective-C frameworks, widget toolkit, and application development tools for Unix-like operating systems and Microsoft Windows. It is part of the GNU Project.
GNUst ...
's fat bundles),
distributing software in
source code
In computing, source code, or simply code or source, is a plain text computer program written in a programming language. A programmer writes the human readable source code to control the behavior of a computer.
Since a computer, at base, only ...
form and
compiling
In computing, a compiler is a computer program that translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primarily used for programs tha ...
it in-place, or the use of a
virtual machine
In computing, a virtual machine (VM) is the virtualization or emulator, emulation of a computer system. Virtual machines are based on computer architectures and provide the functionality of a physical computer. Their implementations may involve ...
(such as with
Java
Java is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea (a part of Pacific Ocean) to the north. With a population of 156.9 million people (including Madura) in mid 2024, proje ...
) and
just-in-time compilation
In computing, just-in-time (JIT) compilation (also dynamic translation or run-time compilations) is compilation (of computer code) during execution of a program (at run time) rather than before execution. This may consist of source code transl ...
.
Apollo
Apollo's compound executables
In 1988,
Apollo Computer
Apollo Computer Inc. was an American technology corporation headquartered and founded in Chelmsford, Massachusetts. It was founded in 1980 by William Poduska (a founder of Prime Computer) and others. Apollo Computer developed and produced Apoll ...
's
Domain/OS SR10.1 introduced a new file type, "cmpexe" (compound executable), that bundled binaries for
Motorola 680x0 and
Apollo PRISM executables.
Apple
Apple's fat binary
A fat-binary scheme smoothed the
Apple Macintosh
Mac is a brand of personal computers designed and marketed by Apple Inc., Apple since 1984. The name is short for Macintosh (its official name until 1999), a reference to the McIntosh (apple), McIntosh apple. The current product lineup inclu ...
's transition, beginning in 1994, from
68k microprocessors to
PowerPC
PowerPC (with the backronym Performance Optimization With Enhanced RISC – Performance Computing, sometimes abbreviated as PPC) is a reduced instruction set computer (RISC) instruction set architecture (ISA) created by the 1991 Apple Inc., App ...
microprocessors. Many applications for the old platform ran transparently on the new platform under an evolving
emulation scheme, but emulated code generally runs slower than native code. Applications released as "fat binaries" took up more storage space, but they ran at full speed on either platform. This was achieved by packaging both a
68000
The Motorola 68000 (sometimes shortened to Motorola 68k or m68k and usually pronounced "sixty-eight-thousand") is a 16/32-bit complex instruction set computer (CISC) microprocessor, introduced in 1979 by Motorola Semiconductor Products Sector ...
-compiled version and a PowerPC-compiled version of the same program into their executable files.
The older 68K code (CFM-68K or classic 68K) continued to be stored in the
resource fork
A resource fork is a fork of a file on Apple's classic Mac OS operating system that is used to store structured data. It is one of the two forks of a file, along with the data fork, which stores data that the operating system treats as unstruct ...
, while the newer PowerPC code was contained in the
data fork, in
PEF format.
Fat binaries were larger than programs supporting only the PowerPC or 68k, which led to the creation of a number of utilities that would strip out the unneeded version.
In the era of small
hard drive
A hard disk drive (HDD), hard disk, hard drive, or fixed disk is an electro-mechanical data storage device that stores and retrieves digital data using magnetic storage with one or more rigid rapidly rotating hard disk drive platter, pla ...
s, when 80 MB hard drives were a common size, these utilities were sometimes useful, as program code was generally a large percentage of overall drive usage, and stripping the unneeded members of a fat binary would free up a significant amount of space on a hard drive.
NeXT's/Apple's multi-architecture binaries
NeXTSTEP Multi-Architecture Binaries
Fat binaries were a feature of
NeXT
NeXT, Inc. (later NeXT Computer, Inc. and NeXT Software, Inc.) was an American technology company headquartered in Redwood City, California that specialized in computer workstations for higher education and business markets, and later develope ...
's
NeXTSTEP
NeXTSTEP is a discontinued object-oriented, multitasking operating system based on the Mach kernel and the UNIX-derived BSD. It was developed by NeXT, founded by Steve Jobs, in the late 1980s and early 1990s and was initially used for its ...
/
OPENSTEP
OpenStep is an object-oriented application programming interface (API) specification developed by NeXT. It provides a framework for building graphical user interfaces (GUIs) and developing software applications. OpenStep was designed to be plat ...
operating system, starting with NeXTSTEP 3.1. In NeXTSTEP, they were called "Multi-Architecture Binaries". Multi-Architecture Binaries were originally intended to allow software to be compiled to run both on NeXT's Motorola 68k-based hardware and on Intel
IA-32
IA-32 (short for "Intel Architecture, 32-bit", commonly called ''i386'') is the 32-bit version of the x86 instruction set architecture, designed by Intel and first implemented in the i386, 80386 microprocessor in 1985. IA-32 is the first incarn ...
-based
PCs running NeXTSTEP, with a single binary file for both platforms.
It was later used to allow OPENSTEP applications to run on PCs and the various
RISC
In electronics and computer science, a reduced instruction set computer (RISC) is a computer architecture designed to simplify the individual instructions given to the computer to accomplish tasks. Compared to the instructions given to a comp ...
platforms OPENSTEP supported. Multi-Architecture Binary files are in a special archive format, in which a single file stores one or more
Mach-O subfiles for each architecture supported by the Multi-Architecture Binary. Every Multi-Architecture Binary starts with a structure () containing two unsigned integers. The first integer ("magic") is used as a
magic number to identify this file as a Fat Binary. The second integer () defines how many Mach-O Files the archive contains (how many instances of the same program for different architectures). After this header, there are ' number of fat_arch structures (). This structure defines the offset (from the start of the file) at which to find the file, the alignment, the size and the CPU type and subtype which the Mach-O binary (within the archive) is targeted at.
The version of the
GNU Compiler Collection
The GNU Compiler Collection (GCC) is a collection of compilers from the GNU Project that support various programming languages, Computer architecture, hardware architectures, and operating systems. The Free Software Foundation (FSF) distributes ...
shipped with the Developer Tools was able to
cross-compile
A cross compiler is a compiler capable of creating executable code for a platform other than the one on which the compiler is running. For example, a compiler that runs on a PC but generates code that runs on Android devices is a cross compil ...
source code for the different architectures on which
NeXTStep
NeXTSTEP is a discontinued object-oriented, multitasking operating system based on the Mach kernel and the UNIX-derived BSD. It was developed by NeXT, founded by Steve Jobs, in the late 1980s and early 1990s and was initially used for its ...
was able to run. For example, it was possible to choose the target architectures with multiple '-arch' options (with the architecture as argument). This was a convenient way to distribute a program for NeXTStep running on different architectures.
It was also possible to create libraries (e.g. using NeXTStep's ) with different targeted object files.
Mach-O and Mac OS X
Apple Computer acquired NeXT in 1996 and continued to work with the OPENSTEP code. Mach-O became the native object file format in Apple's free
Darwin operating system (2000) and Apple's
Mac OS X
macOS, previously OS X and originally Mac OS X, is a Unix, Unix-based operating system developed and marketed by Apple Inc., Apple since 2001. It is the current operating system for Apple's Mac (computer), Mac computers. With ...
(2001), and NeXT's Multi-Architecture Binaries continued to be supported by the operating system. Under Mac OS X, Multi-Architecture Binaries can be used to support multiple variants of an architecture, for instance to have different versions of
32-bit
In computer architecture, 32-bit computing refers to computer systems with a processor, memory, and other major system components that operate on data in a maximum of 32- bit units. Compared to smaller bit widths, 32-bit computers can perform la ...
code optimized for the
PowerPC G3,
PowerPC G4
PowerPC G4 is a designation formerly used by Apple Inc., Apple to describe a ''fourth generation'' of 32-bit PowerPC microprocessors. Apple has applied this name to various (though closely related) processor models from Freescale Semiconductor, Fr ...
, and
PowerPC 970
The PowerPC 970, PowerPC 970FX, and PowerPC 970MP are 64-bit PowerPC CPUs from IBM introduced in 2002. Apple branded the 970 as PowerPC G5 for its Power Mac G5.
Having created the PowerPC architecture in the early 1990s via the AIM alliance, t ...
generations of processors. It can also be used to support multiple architectures, such as 32-bit and
64-bit
In computer architecture, 64-bit integers, memory addresses, or other data units are those that are 64 bits wide. Also, 64-bit central processing units (CPU) and arithmetic logic units (ALU) are those that are based on processor registers, a ...
PowerPC, or PowerPC and
x86
x86 (also known as 80x86 or the 8086 family) is a family of complex instruction set computer (CISC) instruction set architectures initially developed by Intel, based on the 8086 microprocessor and its 8-bit-external-bus variant, the 8088. Th ...
, or
x86-64
x86-64 (also known as x64, x86_64, AMD64, and Intel 64) is a 64-bit extension of the x86 instruction set architecture, instruction set. It was announced in 1999 and first available in the AMD Opteron family in 2003. It introduces two new ope ...
and
ARM64
AArch64, also known as ARM64, is a 64-bit version of the ARM architecture family, a widely used set of computer processor designs. It was introduced in 2011 with the ARMv8 architecture and later became part of the ARMv9 series. AArch64 allows ...
.
Apple's Universal binary

In 2005, Apple announced another
transition, from PowerPC processors to Intel x86 processors. Apple promoted the distribution of new applications that support both PowerPC and x86 natively by using executable files in Multi-Architecture Binary format.
Apple calls such programs "
Universal applications" and calls the file format "
Universal binary" as perhaps a way to distinguish this new transition from the previous transition, or other uses of Multi-Architecture Binary format.
Universal binary format was not necessary for forward migration of pre-existing native PowerPC applications; from 2006 to 2011, Apple supplied
Rosetta
Rosetta ( ) or Rashid (, ; ) is a port city of the Nile Delta, east of Alexandria, in Egypt's Beheira governorate. The Rosetta Stone was discovered there in 1799.
Founded around the 9th century on the site of the ancient town of Bolbitine, R ...
, a PowerPC (PPC)-to-x86
dynamic binary translator, to play this role. However, Rosetta had a fairly steep performance overhead, so developers were encouraged to offer both PPC and Intel binaries, using Universal binaries. The obvious cost of Universal binary is that every installed executable file is larger, but in the years since the release of the PPC, hard-drive space has greatly outstripped executable size; while a Universal binary might be double the size of a single-platform version of the same application, free-space resources generally dwarf the code size, which becomes a minor issue. In fact, often a Universal-binary application will be smaller than two single-architecture applications because program resources can be shared rather than duplicated. If not all of the architectures are required, the and command-line applications can be used to remove versions from the Multi-Architecture Binary image, thereby creating what is sometimes called a ''thin binary''.
In addition, Multi-Architecture Binary executables can contain code for both 32-bit and 64-bit versions of PowerPC and x86, allowing applications to be shipped in a form that supports 32-bit processors but that makes use of the larger address space and wider data paths when run on 64-bit processors.
In versions of the
Xcode
Xcode is a suite of developer tools for building apps on Apple devices. It includes an integrated development environment (IDE) of the same name for macOS, used to develop software for macOS, iOS, iPadOS, watchOS, tvOS, and visionOS. It w ...
development environment from 2.1 through 3.2 (running on
Mac OS X 10.4
Mac OS X Tiger (version 10.4) is the 5th major release of macOS, Apple's desktop and server operating system for Mac computers. Tiger was released to the public on April 29, 2005, for US$129.95 as the successor to Mac OS X 10.3 Panther. Incl ...
through
Mac OS X 10.6), Apple included utilities which allowed applications to be targeted for both Intel and PowerPC architecture; universal binaries could eventually contain up to four versions of the executable code (32-bit PowerPC, 32-bit x86, 64-bit PowerPC, and
64-bit x86). However, PowerPC support was removed from Xcode 4.0 and is therefore not available to developers running
Mac OS X 10.7 or greater.
In 2020, Apple announced another
transition, this time from Intel x86 processors to
Apple silicon
Apple silicon is a series of system on a chip (SoC) and system in a package (SiP) processors designed by Apple Inc., mainly using the ARM architecture family, ARM architecture. They are used in nearly all of the company's devices including Mac ...
(ARM64 architecture). To smooth the transition Apple added support for the
Universal 2 binary format; Universal 2 binary files are Multi-Architecture Binary files containing both x86-64 and ARM64 executable code, allowing the binary to run natively on both 64-bit Intel and 64-bit Apple silicon. Additionally, Apple introduced
Rosetta 2 dynamic binary translation for x86 to Arm64 instruction set to allow users to run applications that do not have Universal binary variants.
Apple Fat EFI binary
In 2006, Apple switched from
PowerPC
PowerPC (with the backronym Performance Optimization With Enhanced RISC – Performance Computing, sometimes abbreviated as PPC) is a reduced instruction set computer (RISC) instruction set architecture (ISA) created by the 1991 Apple Inc., App ...
to
Intel
Intel Corporation is an American multinational corporation and technology company headquartered in Santa Clara, California, and Delaware General Corporation Law, incorporated in Delaware. Intel designs, manufactures, and sells computer compo ...
CPUs, and replaced
Open Firmware
Open Firmware is a standard defining the interfaces of a computer firmware system, formerly endorsed by the Institute of Electrical and Electronics Engineers (IEEE). It originated at Sun Microsystems where it was known as OpenBoot, and has bee ...
with
EFI. However, by 2008, some of their Macs used 32-bit EFI and some used 64-bit EFI. For this reason, Apple extended the EFI specification with "fat" binaries that contained both 32-bit and 64-bit EFI binaries.
CP/M and DOS
Combined COM-style binaries for CP/M-80 and DOS
CP/M-80,
MP/M-80,
Concurrent CP/M
MP/M (Multi-Programming Monitor Control Program) is a discontinued multi-user version of the CP/M operating system, created by Digital Research
Digital Research, Inc. (DR or DRI) was a privately held American software company created by ...
,
CP/M Plus,
Personal CP/M-80,
SCP and
MSX-DOS
MSX-DOS is a discontinued disk operating system developed by Microsoft's Japan subsidiary for the 8-bit home computer standard MSX, and is a cross between MS-DOS v1.25 and CP/M-80 v2.2.
MSX-DOS
MSX-DOS and the extended BASIC with 3½-in ...
executables for the
Intel 8080
The Intel 8080 is Intel's second 8-bit computing, 8-bit microprocessor. Introduced in April 1974, the 8080 was an enhanced successor to the earlier Intel 8008 microprocessor, although without binary compatibility.'' Electronic News'' was a week ...
(and
Zilog
Zilog, Inc. is an American manufacturer of microprocessors, microcontrollers, and application-specific embedded System on a chip, system-on-chip (SoC) products.
The company was founded in 1974 by Federico Faggin and Ralph Ungermann, who were soo ...
Z80
The Zilog Z80 is an 8-bit microprocessor designed by Zilog that played an important role in the evolution of early personal computing. Launched in 1976, it was designed to be software-compatible with the Intel 8080, offering a compelling altern ...
) processor families use the same
.COM file extension
File or filing may refer to:
Mechanical tools and processes
* File (tool), a tool used to remove fine amounts of material from a workpiece.
** Filing (metalworking), a material removal process in manufacturing
** Nail file, a tool used to gen ...
as
DOS
DOS (, ) is a family of disk-based operating systems for IBM PC compatible computers. The DOS family primarily consists of IBM PC DOS and a rebranded version, Microsoft's MS-DOS, both of which were introduced in 1981. Later compatible syste ...
-compatible operating systems for
Intel 8086
The 8086 (also called iAPX 86) is a 16-bit computing, 16-bit microprocessor chip designed by Intel between early 1976 and June 8, 1978, when it was released. The Intel 8088, released July 1, 1979, is a slightly modified chip with an external 8-b ...
binaries.
In both cases programs are loaded at offset +100h and executed by jumping to the first byte in the file.
As the
opcode
In computing, an opcode (abbreviated from operation code) is an enumerated value that specifies the operation to be performed. Opcodes are employed in hardware devices such as arithmetic logic units (ALUs), central processing units (CPUs), and ...
s of the two processor families are not compatible, attempting to start a program under the wrong operating system leads to incorrect and unpredictable behaviour.
In order to avoid this, some methods have been devised to build fat binaries which contain both a CP/M-80 and a DOS program, preceded by initial code which is interpreted correctly on both platforms.
The methods either combine two fully functional programs each built for their corresponding environment, or add
stub
Stub or Stubb may refer to:
Shortened objects and entities
* Stub, a tree cut and allowed to regrow from the trunk; see pollarding
* Pay stub, a receipt or record that the employer has paid an employee
* Stub period, period of time over which i ...
s which cause the program to
exit gracefully if started on the wrong processor. For this to work, the first few instructions (sometimes also called ''
gadget headers''
) in the .COM file have to be valid code for both 8086 and 8080 processors, which would cause the processors to branch into different locations within the code.
For example, the utilities in Simeon Cran's emulator MyZ80 start with the opcode sequence .
An 8086 sees this as a jump and reads its next instruction from offset +154h whereas an 8080 or compatible processor goes straight through and reads its next instruction from +103h.
A similar sequence used for this purpose is .
John C. Elliott's FATBIN
is a utility to combine a CP/M-80 and a DOS .COM file into one executable.
His derivative of the original
PMsfx modifies archives created by Yoshihiko Mino's
PMarc to be
self-extractable under ''both'', CP/M-80 and DOS, starting with to also include the "-pms-" signature for self-extracting
PMA archives,
thereby also representing a form of
executable ASCII code.
Another method to keep a DOS-compatible operating system from erroneously executing .COM programs for CP/M-80 and MSX-DOS machines
is to start the 8080 code with , which is decoded as a "RET" instruction by x86 processors, thereby gracefully exiting the program,
while it will be decoded as "JP 103h" instruction by 8080 processors and simply jump to the next instruction in the program. Similar, the CP/M assembler Z80ASM+ by SLR Systems would display an error message when erroneously run on DOS.
Some
CP/M-80 3.0 .COM files may have one or more
RSX overlays attached to them by
GENCOM.
If so, they start with an extra
256-byte header (one
page
Page most commonly refers to:
* Page (paper), one side of a leaf of paper, as in a book
Page, PAGE, pages, or paging may also refer to:
Roles
* Page (assistance occupation), a professional occupation
* Page (servant), traditionally a young m ...
). In order to indicate this, the first byte in the header is set to
magic byte , which works both as a signature identifying this type of COM file to the CP/M 3.0
executable loader, as well as a "RET" instruction for 8080-compatible processors which leads to a graceful exit if the file is executed under older versions of CP/M-80.
is never appropriate as the first byte of a program for any x86 processor (it has different meanings for different generations,
but is never a meaningful first byte); the executable loader in some versions of DOS rejects COM files that start with , avoiding incorrect operation.
Similar
overlapping code sequences have also been devised for combined Z80/
6502
The MOS Technology 6502 (typically pronounced "sixty-five-oh-two" or "six-five-oh-two") William Mensch and the moderator both pronounce the 6502 microprocessor as ''"sixty-five-oh-two"''. is an 8-bit microprocessor that was designed by a small ...
,
8086/
68000
The Motorola 68000 (sometimes shortened to Motorola 68k or m68k and usually pronounced "sixty-eight-thousand") is a 16/32-bit complex instruction set computer (CISC) microprocessor, introduced in 1979 by Motorola Semiconductor Products Sector ...
or x86/
MIPS/
ARM binaries.
Combined binaries for CP/M-86 and DOS
CP/M-86
CP/M-86 is a discontinued version of the CP/M operating system that Digital Research (DR) made for the Intel 8086 and Intel 8088. The system commands are the same as in CP/M-80. Executable files used the relocatable .CMD file format. Digital Re ...
and DOS do not share a common file extension for executables.
Thus, it is not normally possible to confuse executables. However, early versions of DOS had so much in common with CP/M in terms of its architecture that some early DOS programs were developed to share binaries containing executable code. One program known to do this was
WordStar 3.2x, which used identical
overlay files in their
port
A port is a maritime facility comprising one or more wharves or loading areas, where ships load and discharge cargo and passengers. Although usually situated on a sea coast or estuary, ports can also be found far inland, such as Hamburg, Manch ...
s for CP/M-86 and
MS-DOS
MS-DOS ( ; acronym for Microsoft Disk Operating System, also known as Microsoft DOS) is an operating system for x86-based personal computers mostly developed by Microsoft. Collectively, MS-DOS, its rebranding as IBM PC DOS, and a few op ...
,
and used dynamically fixed-up code to adapt to the differing calling conventions of these operating systems at
runtime.
Digital Research
Digital Research, Inc. (DR or DRI) was a privately held American software company created by Gary Kildall to market and develop his CP/M operating system and related 8-bit, 16-bit and 32-bit systems like MP/M, Concurrent DOS, FlexOS, Multiuser ...
's
GSX for CP/M-86 and DOS also shares binary identical 16-bit drivers.
Combined COM and SYS files
DOS
device driver
In the context of an operating system, a device driver is a computer program that operates or controls a particular type of device that is attached to a computer or automaton. A driver provides a software interface to hardware devices, enabli ...
s (typically with file extension
.SYS) start with a file header whose first four bytes are
FFFFFFFFh by convention, although this is not a requirement.
This is fixed up dynamically by the operating system when the driver
loads (typically in the
DOS BIOS when it executes
DEVICE statements in
CONFIG.SYS). Since DOS does not reject files with a .COM extension to be loaded per DEVICE and does not test for FFFFFFFFh, it is possible to combine a COM program and a device driver into the same file
by placing a jump instruction to the entry point of the embedded COM program within the first four bytes of the file (three bytes are usually sufficient).
If the embedded program and the device driver sections share a common portion of code, or data, it is necessary for the code to deal with being loaded at offset +0100h as a .COM style program, and at +0000h as a device driver.
For shared code loaded at the "wrong" offset but not designed to be
position-independent, this requires an internal address fix-up
similar to what would otherwise already have been carried out by a
relocating loader, except for that in this case it has to be done by the loaded program itself; this is similar to the situation with
self-relocating drivers but with the program already loaded at the target location by the operating system's loader.
Crash-protected system files
Under DOS, some files, by convention, have file extensions which do not reflect their actual file type.
For example,
COUNTRY.SYS is not a DOS device driver,
but a binary
NLS database file for use with the CONFIG.SYS
COUNTRY directive and the
NLSFUNC driver.
Likewise, the
PC DOS and
DR-DOS
DR-DOS is a disk operating system for IBM PC compatibles, originally developed by Gary A. Kildall's Digital Research, Inc. and derived from Concurrent PC DOS 6.0, which was an advanced successor of CP/M-86. Upon its introduction in 198 ...
system files
IBMBIO.COM and
IBMDOS.COM are special binary images loaded by
bootstrap loaders, not COM-style programs.
Trying to load COUNTRY.SYS with a DEVICE statement or executing IBMBIO.COM or IBMDOS.COM at the command prompt will cause unpredictable results.
It is sometimes possible to avoid this by utilizing techniques similar to those described above. For example,
DR-DOS 7.02 and higher incorporate a safety feature developed by Matthias R. Paul:
If these files are called inappropriately, tiny embedded stubs will just display some file version information and exit gracefully.
Additionally, the message is specifically crafted to follow certain
"magic" patterns recognized by the external
NetWare
NetWare is a discontinued computer network operating system developed by Novell, Inc. It initially used cooperative multitasking to run various services on a personal computer, using the IPX network protocol. The final update release was ver ...
& DR-DOS
VERSION
Version may refer to:
Computing
* Software version, a set of numbers that identify a unique evolution of a computer program
* VERSION (CONFIG.SYS directive), a configuration directive in FreeDOS
Music
* Cover version
* Dub version
* Remix
* ''V ...
file identification utility.
A similar protection feature was the 8080 instruction ("RST 0") at the very start of Jay Sage's and Joe Wright's
Z-System
CP/M, originally standing for Control Program/Monitor and later Control Program for Microcomputers, is a mass-market operating system created in 1974 for Intel 8080/ 85-based microcomputers by Gary Kildall of Digital Research, Inc. CP/M is ...
type-3 and type-4 "Z3ENV" programs
as well as "Z3TXT" language overlay files,
which would result in a
warm boot
In computing, rebooting is the process by which a running computer system is restarted, either intentionally or unintentionally. Reboots can be either a cold reboot (alternatively known as a hard reboot) in which the power to the system is physi ...
(instead of a crash) under CP/M-80 if loaded inappropriately.
In a distantly similar fashion, many (binary)
file format
A file format is a Computer standard, standard way that information is encoded for storage in a computer file. It specifies how bits are used to encode information in a digital storage medium. File formats may be either proprietary format, pr ...
s by convention include a byte (
ASCII
ASCII ( ), an acronym for American Standard Code for Information Interchange, is a character encoding standard for representing a particular set of 95 (English language focused) printable character, printable and 33 control character, control c ...
^Z) near the beginning of the file. This
control character
In computing and telecommunications, a control character or non-printing character (NPC) is a code point in a character encoding, character set that does not represent a written Character (computing), character or symbol. They are used as in-ba ...
will be interpreted as "soft"
end-of-file
In computing, end-of-file (EOF) is a condition in a computer operating system where no more data can be read from a data source. The data source is usually called a file or stream.
Details
In the C standard library, the character-reading functi ...
(EOF) marker when a file is opened in non-binary mode, and thus, under many operating systems (including the
PDP-6
The PDP-6, short for Programmed Data Processor model 6, is a computer developed by Digital Equipment Corporation (DEC) during 1963 and first delivered in the summer of 1964. It was an expansion of DEC's existing 18-bit systems to use a 36-bit da ...
monitor
and
RT-11
RT-11 (Real-time 11) is a discontinued small, low-end, single-user real-time operating system for the full line of Digital Equipment Corporation PDP-11 16-bit computers. RT-11 was first implemented in 1970. It was widely used for real-time compu ...
,
VMS,
TOPS-10
TOPS-10 System (Timesharing / Total Operating System-10) is a discontinued operating system from Digital Equipment Corporation (DEC) for the PDP-10 (or DECsystem-10) mainframe computer family. Launched in 1967, TOPS-10 evolved from the earlier "Mo ...
,
CP/M,
DOS,
and Windows
), it prevents "binary garbage" from being displayed when a file is accidentally printed at the console.
Linux
FatELF: Universal binaries for Linux
FatELF was a fat binary implementation for
Linux
Linux ( ) is a family of open source Unix-like operating systems based on the Linux kernel, an kernel (operating system), operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically package manager, pac ...
and other
Unix-like
A Unix-like (sometimes referred to as UN*X, *nix or *NIX) operating system is one that behaves in a manner similar to a Unix system, although not necessarily conforming to or being certified to any version of the Single UNIX Specification. A Uni ...
operating systems. Technically, a FatELF binary was a concatenation of
ELF
An elf (: elves) is a type of humanoid supernatural being in Germanic peoples, Germanic folklore. Elves appear especially in Norse mythology, North Germanic mythology, being mentioned in the Icelandic ''Poetic Edda'' and the ''Prose Edda'' ...
binaries with some meta data indicating which binary to use on what architecture.
Additionally to the CPU architecture abstraction (
byte order
'' Jonathan_Swift.html" ;"title="Gulliver's Travels'' by Jonathan Swift">Gulliver's Travels'' by Jonathan Swift, the novel from which the term was coined
In computing, endianness is the order in which bytes within a word (data type), word of d ...
,
word size
In computing, a word is any processor design's natural unit of data. A word is a fixed-sized datum handled as a unit by the instruction set or the hardware of the processor. The number of bits or digits in a word (the ''word size'', ''word wid ...
,
CPU instruction set, etc.), there is the advantage of binaries with support for multiple kernel
ABIs and versions.
FatELF has several use-cases, according to developers:
* Distributions no longer need to have separate downloads for various platforms.
* Separated ''/lib'', ''/lib32'' and ''/lib64'' trees are not required anymore in
OS directory structure.
* The correct binary and libraries are centrally chosen by the system instead of
shell script
A shell script is a computer program designed to be run by a Unix shell, a command-line interpreter. The various dialects of shell scripts are considered to be command languages. Typical operations performed by shell scripts include file manipu ...
s.
* If the ELF ABI changes someday, legacy users can be still supported.
* Distribution of web browser plug ins that work out of the box with multiple platforms.
* Distribution of one application file that works across Linux and
BSD OS variants, without a platform compatibility layer on them.
* One hard drive partition can be booted on different machines with different CPU architectures, for development and experimentation. Same root file system, different kernel and CPU architecture.
* Applications provided by network share or USB sticks, will work on multiple systems. This is also helpful for creating
portable application
A portable application (portable app), sometimes also called standalone software, is a computer program designed to operate without changing other files or requiring other software to be installed. In this way, it can be easily added to, run, ...
s and also
cloud computing
Cloud computing is "a paradigm for enabling network access to a scalable and elastic pool of shareable physical or virtual resources with self-service provisioning and administration on-demand," according to International Organization for ...
images for heterogeneous systems.
A proof-of-concept
Ubuntu 9.04 image is available.
, FatELF has not been integrated into the mainline Linux kernel.
Windows
Fatpack
Although the
Portable Executable
The Portable Executable (PE) format is a file format for executables, object file, object code, Dynamic-link library, dynamic-link-libraries (DLLs), and binary files used on 32-bit and 64-bit Microsoft Windows, Windows operating systems, as well ...
format used by Windows does not allow assigning code to platforms, it is still possible to make a loader program that dispatches based on architecture. This is because desktop versions of Windows on ARM have support for 32-bit
x86
x86 (also known as 80x86 or the 8086 family) is a family of complex instruction set computer (CISC) instruction set architectures initially developed by Intel, based on the 8086 microprocessor and its 8-bit-external-bus variant, the 8088. Th ...
emulation, making it a useful "universal" machine code target. Fatpack is a loader that demonstrates the concept: it includes a 32-bit x86 program that tries to run the executables packed into its resource sections one by one.
Arm64X
When developing Windows 11 ARM64, Microsoft introduced a new way to extend the
Portable Executable
The Portable Executable (PE) format is a file format for executables, object file, object code, Dynamic-link library, dynamic-link-libraries (DLLs), and binary files used on 32-bit and 64-bit Microsoft Windows, Windows operating systems, as well ...
format called Arm64X.
An Arm64X binary contains all the content that would be in separate x64/Arm64EC and Arm64 binaries, but merged into one more efficient file on disk. Visual C++ toolset has been upgraded to support producing such binaries. And when building Arm64X binaries are technically difficult, developers can build Arm64X pure forwarder DLLs instead.
Similar concepts
The following approaches are similar to fat binaries in that multiple versions of machine code of the same purpose are provided in the same file.
Heterogeneous computing
Since 2007, some specialized compilers for
heterogeneous platforms produce code files for
parallel execution on multiple types of processors, i.e. the CHI (
C for Heterogeneous Integration) compiler from the
Intel
Intel Corporation is an American multinational corporation and technology company headquartered in Santa Clara, California, and Delaware General Corporation Law, incorporated in Delaware. Intel designs, manufactures, and sells computer compo ...
EXOCHI (Exoskeleton Sequencer) development suite extends the
OpenMP
OpenMP is an application programming interface (API) that supports multi-platform shared-memory multiprocessing programming in C, C++, and Fortran, on many platforms, instruction-set architectures and operating systems, including Solaris, ...
pragma concept for
multithreading to produce fat binaries containing code sections for different
instruction set architecture
In computer science, an instruction set architecture (ISA) is an abstract model that generally defines how software controls the CPU in a computer or a family of computers. A device or program that executes instructions described by that ISA, ...
s (ISAs) from which the
runtime loader can dynamically initiate the parallel execution on multiple available CPU and
GPU cores in a heterogeneous system environment.
Introduced in 2006,
Nvidia
Nvidia Corporation ( ) is an American multinational corporation and technology company headquartered in Santa Clara, California, and incorporated in Delaware. Founded in 1993 by Jensen Huang (president and CEO), Chris Malachowsky, and Curti ...
's parallel computing platform
CUDA
In computing, CUDA (Compute Unified Device Architecture) is a proprietary parallel computing platform and application programming interface (API) that allows software to use certain types of graphics processing units (GPUs) for accelerated gene ...
(Compute Unified Device Architecture) is a software to enable general-purpose computing on GPUs (
GPGPU
General-purpose computing on graphics processing units (GPGPU, or less often GPGP) is the use of a graphics processing unit (GPU), which typically handles computation only for computer graphics, to perform computation in applications traditiona ...
). Its
LLVM
LLVM, also called LLVM Core, is a target-independent optimizer and code generator. It can be used to develop a Compiler#Front end, frontend for any programming language and a Compiler#Back end, backend for any instruction set architecture. LLVM i ...
-based compiler
NVCC can create
ELF
An elf (: elves) is a type of humanoid supernatural being in Germanic peoples, Germanic folklore. Elves appear especially in Norse mythology, North Germanic mythology, being mentioned in the Icelandic ''Poetic Edda'' and the ''Prose Edda'' ...
-based fat binaries containing so called
PTX virtual
assembly (as text) which the CUDA runtime driver can later
just-in-time compile into some SASS (Streaming Assembler) binary executable code for the actually present target GPU. The executables can also include so called ''CUDA binaries'' (aka ''cubin'' files) containing dedicated executable code sections for one or more specific GPU architectures from which the CUDA runtime can choose from at load-time.
Fat binaries are also supported by , a GPU
simulator
A simulation is an imitative representation of a process or system that could exist in the real world. In this broad sense, simulation can often be used interchangeably with model. Sometimes a clear distinction between the two terms is made, in ...
introduced in 2007 as well.
Multi2Sim (M2S), an
OpenCL
OpenCL (Open Computing Language) is a software framework, framework for writing programs that execute across heterogeneous computing, heterogeneous platforms consisting of central processing units (CPUs), graphics processing units (GPUs), di ...
heterogeneous system simulator framework (originally only for either
MIPS or x86 CPUs, but later extended to also support
ARM CPUs and GPUs like the
AMD
Advanced Micro Devices, Inc. (AMD) is an American multinational corporation and technology company headquartered in Santa Clara, California and maintains significant operations in Austin, Texas. AMD is a hardware and fabless company that de ...
/
ATI Evergreen
In botany, an evergreen is a plant which has Leaf, foliage that remains green and functional throughout the year. This contrasts with deciduous plants, which lose their foliage completely during the winter or dry season. Consisting of many diffe ...
&
Southern Islands as well as
Nvidia Fermi &
Kepler
Johannes Kepler (27 December 1571 – 15 November 1630) was a German astronomer, mathematician, astrologer, natural philosopher and writer on music. He is a key figure in the 17th-century Scientific Revolution, best known for his laws of p ...
families)
supports ELF-based fat binaries as well.
Fat objects
GNU Compiler Collection
The GNU Compiler Collection (GCC) is a collection of compilers from the GNU Project that support various programming languages, Computer architecture, hardware architectures, and operating systems. The Free Software Foundation (FSF) distributes ...
(GCC) and LLVM do not have a fat binary format, but they do have fat ''object files'' for
link-time optimization
Interprocedural optimization (IPO) is a collection of compiler techniques used in computer programming to improve performance in programs containing many frequently used functions of small or medium length. IPO differs from other compiler optimi ...
(LTO). Since LTO involves delaying the compilation to link-time, the
object file
An object file is a file that contains machine code or bytecode, as well as other data and metadata, generated by a compiler or assembler from source code during the compilation or assembly process. The machine code that is generated is kno ...
s must store the
intermediate representation
An intermediate representation (IR) is the data structure or code used internally by a compiler or virtual machine to represent source code. An IR is designed to be conducive to further processing, such as optimization and translation. A "good" ...
(IR), but on the other hand machine code may need to be stored too (for speed or compatibility). An LTO object containing both IR and machine code is known as a ''fat object''.
Function multi-versioning
Even in a program or
library
A library is a collection of Book, books, and possibly other Document, materials and Media (communication), media, that is accessible for use by its members and members of allied institutions. Libraries provide physical (hard copies) or electron ...
intended for the same
instruction set architecture
In computer science, an instruction set architecture (ISA) is an abstract model that generally defines how software controls the CPU in a computer or a family of computers. A device or program that executes instructions described by that ISA, ...
, a programmer may wish to make use of some newer instruction set extensions while keeping compatibility with an older CPU. This can be achieved with ''function multi-versioning'' (FMV): versions of the same function are written into the program, and a piece of code decides which one to use by detecting the CPU's capabilities (such as through
CPUID
In the x86 architecture, the CPUID instruction (identified by a CPUID opcode) is a processor supplementary instruction (its name derived from " CPU Identification") allowing software to discover details of the processor. It was introduced by Int ...
).
Intel C++ Compiler
Intel oneAPI DPC++/C++ Compiler and Intel C++ Compiler Classic (deprecated icc and icl is in Intel OneAPI HPC toolkit) are Intel’s C, C++, SYCL, and Data Parallel C++ (DPC++) compilers for Intel processor-based systems, available for Wind ...
, GCC, and LLVM all have the ability to automatically generate multi-versioned functions.
This is a form of
dynamic dispatch
In computer science, dynamic dispatch is the process of selecting which implementation of a polymorphic operation (method or function) to call at run time. It is commonly employed in, and considered a prime characteristic of, object-oriented ...
without any semantic effects.
Many math libraries feature hand-written assembly routines that are automatically chosen according to CPU capability. Examples include
glibc
The GNU C Library, commonly known as glibc, is the GNU Project implementation of the C standard library. It provides a wrapper around the system calls of the Linux kernel and other kernels for application use. Despite its name, it now also dir ...
,
Intel MKL, and
OpenBLAS. In addition, the library loader in glibc supports loading from alternative paths for specific CPU features.
A similar, but byte-level granular approach originally devised by Matthias R. Paul and Axel C. Frinke is to let a small self-discarding,
relaxing and
relocating loader embedded into the executable file alongside any number of alternative binary code snippets conditionally build a size- or speed-optimized runtime image of a program or driver necessary to perform (or not perform) a particular function in a particular target environment at
load-time through a form of
dynamic dead code elimination (DDCE).
See also
*
Cross-platform software
Within computing, cross-platform software (also called multi-platform software, platform-agnostic software, or platform-independent software) is computer software that is designed to work in several computing platforms. Some cross-platform soft ...
*
DOS stub
*
Fat pointer
In computer science, dynamic dispatch is the process of selecting which implementation of a polymorphic operation (method or function) to call at run time. It is commonly employed in, and considered a prime characteristic of, object-oriented ...
*
Linear Executable The Linear Executable (LE) format is a file format for executables, object code, and DLLs designed for 32-bit protected mode operating systems. Originally used by the OS/2 operating system and adopted by various DOS extenders, it also served as the ...
(LX)
*
New Executable
The New Executable (NE or NewEXE) is a 16-bit executable file format, a successor to the DOS MZ executable format. It was used in Windows 1.0–3.x, Windows 9x, multitasking MS-DOS 4.0, OS/2 1.x, and the OS/2 subset of Windows NT up to versio ...
(NE)
*
Portable Executable
The Portable Executable (PE) format is a file format for executables, object file, object code, Dynamic-link library, dynamic-link-libraries (DLLs), and binary files used on 32-bit and 64-bit Microsoft Windows, Windows operating systems, as well ...
(PE)
*
Position-independent code
In computing, position-independent code (PIC) or position-independent executable (PIE) is a body of machine code that executes properly regardless of its memory address. PIC is commonly used for shared libraries, so that the same library code c ...
(PIC)
*
Side effect
In medicine, a side effect is an effect of the use of a medicinal drug or other treatment, usually adverse but sometimes beneficial, that is unintended. Herbal and traditional medicines also have side effects.
A drug or procedure usually use ...
*
Universal hex format, a "fat" hex file format targeting multiple platforms
*
Alphanumeric executable, executable code camouflaged as (sometimes even readable) text
*
Multi-architecture shellcode
In hacker (computer security), hacking, a shellcode is a small piece of code used as the Payload (computing), payload in the exploit (computer security), exploitation of a software Vulnerability (computing), vulnerability. It is called "shellco ...
, shellcode targeting multiple platforms (and sometimes even camouflaged as alphanumeric text)
Notes
References
Further reading
* ;
*
*
*
*
*
* {{cite web , title=AmigaOS 3.9 - Features , work=AmigaOS: multimedia, multi-threaded, multi-tasking , author-first=Matthias , author-last=Münch , date=2006 , orig-date=2005 , url=https://os.amigaworld.de/index.php?lang=en&page=7 , access-date=2021-09-29 , url-status=live , archive-url=https://web.archive.org/web/20210929081348/https://os.amigaworld.de/index.php?lang=en&page=7 , archive-date=2021-09-29
Executable file formats