This is the mail archive of the
mailing list for the binutils project.
Re: ar: POSIX way of creating static library containing similarly named objects
- From: Cary Coutant <ccoutant at google dot com>
- To: nick clifton <nickc at redhat dot com>
- Cc: Miguel Guedes <miguel dot a dot guedes at gmail dot com>, Binutils <binutils at sourceware dot org>
- Date: Fri, 19 Apr 2013 14:20:46 -0700
- Subject: Re: ar: POSIX way of creating static library containing similarly named objects
- References: <kkoj1h$1bi$1 at ger dot gmane dot org> <5170F933 dot 20506 at redhat dot com>
>> Can `ar' be used to create a static library comprised of the objects
>> above without either of which replacing any symbols? In other words, both
>> namespace_foo/state.o and namespace_bar/state.o are put into the same
>> library but no symbols are replaced.
> Use the 'q' option rather than the 'r' option when adding the object files
> to the library - and create the symbol index after adding the objects,
> rather than at the same time. Ie:
If you don't need the archive to be self-contained, you can also use a
$ ar crT libstate.a src/namespace*/state.o
$ ar t libstate.a
Here, libstate.a contains just the symbol table, with references to
the object files in their separate directories.