Introduction
The static libraries on Linux and most Unix systems are ar archives in the System V layout, which GNU Binutils extended. Each member is usually an ELF object file. MinGW writes the same layout for Windows libraries, with COFF objects inside.
Structure
0signature!<arch>\n8 bytes8symbol index/, or/SYM64/with 64-bit offsets60 bytes + size…long names//, if any60 bytes + size…members60 bytes + size, even offsets
See the member header, the symbol index and long names.
Not described
The gaps are those on the archive overview; the layout
statements on this page were checked against GNU Binutils 2.47 (bfd/archive.c, include/aout/ar.h)
and member names against llvm-ar.
Also used for
- Assembly language source – Machine instructions as text; the syntax varies by assembler and processor.
Variants
- System V and GNU static library – the ar archive format of Linux and most Unix systems
- BSD and macOS static library – the ar archive format of macOS and the BSDs
- GNU thin archive – an archive that lists its members but leaves their data in other files
- AIX big archive – IBM AIX’s archive with linked members and 32-bit and 64-bit symbol tables
- AIX small archive – the older AIX archive with narrower fields
Links
Software
- GNU Binutils – GNU’s binary tools, with
ar,ranlibandnm(Linux, macOS, Windows) - LLVM – compiler toolkit with
llvm-arandllvm-nm(Linux, macOS, Windows)