Assembly instructions depend mainly on the CPU instruction set. Why, then, do software downloads and compiler targets ask you to pick Linux, Windows, or macOS as well as x86-64 or ARM64? A CPU that can execute the machine instructions meets just one requirement for running the program. An ordinary application must also load into memory, call system services, use libraries, and follow binary interface agreements between those components.
First, an executable contains more than instructions for the CPU. The file tells the operating system and its loader where execution starts, how to load code and data into memory, and which dynamic libraries the program needs. Common file formats vary by system:
| Operating system | Common executable format |
|---|---|
| Linux | ELF |
| Windows | PE, part of the PE/COFF family |
| macOS | Mach-O |
Even on two x86-64 machines, a Linux program cannot run directly as a native macOS program. The CPU can recognize the instructions while the native loader cannot interpret the whole file. Renaming its extension does nothing to the internal format.
Second, programs obtain resources through the operating system. Reading and writing files, accessing the network, and creating threads usually go through system libraries or APIs and ultimately request kernel services. System call numbers, argument conventions, and behavior can differ. The same instruction for entering the kernel need not represent the same request on Linux and Windows. Changing the file format will not translate those requests into a form the other system understands.
Another easily overlooked agreement is the application binary interface (ABI). Caller and callee must agree on which registers or stack locations hold arguments, which registers to preserve, stack alignment, and data layout. For ordinary C function calls on x86-64, Linux and macOS generally follow the basic System V AMD64 ABI conventions, with some macOS-specific details. Windows generally uses the Microsoft x64 calling convention. Even if a CPU can execute both pieces of code, they may not be able to call each other directly. C++ symbol naming and exception handling also depend on the compiler and its ABI.
Libraries are part of the target environment too. Linux commonly uses .so files and a dynamic linker, macOS uses .dylib files and dyld, and Windows uses .dll files and its own loading mechanisms. Each has rules for finding libraries, resolving symbols, and applying relocations. A program written entirely in assembly still has to follow those rules when calling system libraries. Static linking can reduce dynamic library dependencies, but operating system interfaces still differ.
Even two Linux systems can be incompatible because their runtimes differ. glibc and musl are separate C library implementations. A program that depends on newer glibc symbols may fail to start in an older environment. Android uses the Linux kernel but has its own user-space components, including Bionic. That is why compilation targets are often more detailed than “CPU + OS”:
x86_64-unknown-linux-gnu
x86_64-unknown-linux-musl
aarch64-apple-darwin
x86_64-pc-windows-msvc
These names identify sets of platform conventions and can include architecture, vendor, operating system, and ABI or runtime information. When cross-compiling, the toolchain also needs the corresponding target headers, libraries, and linker configuration to produce a program suitable for that environment.
Bare-metal firmware, kernels, and bootloaders do without ordinary user-space OS interfaces, but their hardware platforms, boot protocols, memory layouts, and calling conventions still matter. The instruction set determines what a machine can execute. The full target platform determines how those instructions form a program that can load, interoperate, and run.
Adapted from a conversation in the ChatGPT web app on February 22, 2026, at 00:37.