Linking dependencies into static library

Nick Clifton nickc@redhat.com
Thu Jan 10 19:23:00 GMT 2008
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



More information about the Binutils mailing list