The librarian program is called ar (for "archiver") and is found in the GNU Binutils project. This program will have been built for the AVR target and will therefore be named avr-ar.

The job of the librarian program is simple: aggregate a list of object modules into a single library (archive) and create an index for the linker to use. The name that you create for the library filename must follow a specific pattern: libname.a. The name part is the unique part of the filename that you create. It makes it easier if the name part relates to what the library is about. This name part must be prefixed by "lib", and it must have a file extension of .a, for "archive". The reason for the special form of the filename is for how the library gets used by the toolchain, as we will see later on.

The command line is fairly simple:

avr-ar rcs <library name> <list of object modules>

The r command switch tells the program to insert the object modules into the archive with replacement. The c command line switch tells the program to create the archive. And the s command line switch tells the program to write an object-file index into the archive, or update an existing one. This last switch is very important as it helps the linker to find what it needs to do its job.

See the GNU Binutils manual for more information on the ar program.