Archives
Overview
A static library is a format for packaging multiple relocatable object files together. When the linker builds the output executable, it only copies the object modules in the library referenced by the application program.
On Linux systems, static libraries are typically stored on disk as an archive. An archive is a collection of concatenated relocatable object files with a header that describes the size and location of each member object file.
Symbol Resolution
During symbol resolution, the linker scans the relocatable object files and archives left to right in the same order they appear on the command line. During this scan, the linker maintains three sets:
, a set of relocatable object files to be merged into the final executable; , a set of unresolved symbols, , a set of symbols defined in previous input files.
For each input file, the linker determines if its an object file or archive. If the former, the three sets are updated. If the latter, the linker attempts to match symbols in
If