This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Linking dependencies into static library / Partial linking
- From: Nick Clifton <nickc at redhat dot com>
- To: "Philip K.F. Hölzenspies" <p dot k dot f dot holzenspies at utwente dot nl>
- Cc: binutils at sourceware dot org
- Date: Wed, 09 Jan 2008 15:58:41 +0000
- Subject: Re: Linking dependencies into static library / Partial linking
- References: <200801071722.53421.p.k.f.holzenspies@utwente.nl>
Hi Philip,
In the end, I would really like to have a libhebe.a file that only exports the
symbols of the wrapper AND does not contain unresolved / undefined symbols
that impose linker dependencies. Is this at all possible?
What you want is partial linking. See the description of the --relocatable
linker command line switch in the linker manual. Couple that with whole
archive linking and you should get the result you want. ie something like this
will probably work:
% gcc *.cc wrapper.o -Wl,--whole-archive -lglpk -Wl,--no-whole-archive
-Wl,--relocatable -o hebe.o
Cheers
Nick