Paul Winalski <paul.winalski(a)gmail.com> wrote:
I can't think of any reason why ar(1) would care
about the file format
or internal contents of any of the modules it archives. ar(1) is a
general archiving tool and can archive anything. It happens that the
designers of ld(1) decided to use ar(1) to provide searchable object
file libraries.
ranlib(1) is a different matter. In order to index global symbols it
has to understand the object file format(s) of the modules it is
indexing. ranlib(1) most certainly would have to be taught to
understand COFF. But not ar(1).
You are correct that ar(1) was originally just an archiver. However,
the System V people built ranlib into it; the .a file for a library
has a sort of hidden extra member that is the list of symbols in
the archive.
With tar and cpio, ar apparently fell out of use as a general
archiver, and today it's only used for libraries of relocatable
object files.
Arnold