This is the mail archive of the
mailing list for the binutils project.
preventing ld from discarding all symbols from archive files
- To: bug-binutils at gnu dot org, binutils at sources dot redhat dot com
- Subject: preventing ld from discarding all symbols from archive files
- From: Adam Williams <broadcast at earthling dot net>
- Date: Wed, 05 Sep 2001 09:22:05 -0700
If I run the following command:
ld -shared -o sharedlibrary.so part1.a part2.a part3.a
the linker discards every symbol in the .a files and produces an empty
shared library called sharedlibrary.so, not what any sane person wants.
What the linker formally does is treat any object files as targets and
archive files as dependancies, removing all symbols from the archive
files which aren't used in the targets. Since there are no objects
this clears all the symbols.
Is there any way to force ld to keep all the symbols in the archive
files? It's really inconvenient to specify the name of all the object
files in multiple directories or require a runtime environment to
contain 100 shared libraries.
The following flags have no success: