Program, library and object file formats
Compiled machine code. A compiler turns each source file into an object file, with gaps
left for the addresses of things defined elsewhere; a linker joins object files and
libraries, fills the gaps and writes a program or library that the operating system loads
and runs. Each system has its own formats: Windows uses PE (and before it NE and MS-DOS MZ),
Linux and most Unix systems use ELF, and Apple’s systems use Mach-O. One .exe
extension covers several formats, and so does .obj: see
the .EXE overview and
the .OBJ overview for how to tell them apart.
Formats
.A
Static library archiveUnix static libraries: object files in an ar archive with a symbol index.
.COM
MS-DOS COM programSmall DOS programs with no header, loaded at offset 0x100.
.DYLIB
Mach-O executable and libraryPrograms, .dylib libraries and universal binaries on macOS and iOS.
.ELF
Executable and Linkable FormatPrograms, libraries and object files on Linux and Unix systems.
.EXE
Linear Executable (LE)32-bit Windows VxD drivers and DOS extender programs, in paged objects.
.EXE
OS/2 executable (LX)32-bit OS/2 programs and DLLs, in paged objects.
.EXE
MS-DOS executable (MZ)16-bit DOS programs: an MZ header, relocations and the code.
.EXE
16-bit Windows executable (NE)Windows 3.x and early OS/2 programs and DLLs, in movable segments.
.EXE
Windows Portable Executable (PE)32-bit and 64-bit Windows programs and DLLs: headers, sections and imports.
.KO
Linux kernel moduleLoadable Linux drivers and features: ELF objects with module info.
.LIB
Windows static and import libraryWindows linker libraries: COFF objects or DLL import records in an archive.
.OBJ
COFF object fileCompiled code from Windows compilers, waiting for the linker.
.OBJ
OMF object fileIntel’s object format for 16-bit DOS and Windows compilers, in typed records.
.OUT
Unix a.out executableThe original Unix executable: a 32-byte header, text, data and symbols.