libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to use --whole-archive ld arg with libtool?


From: Reid Spencer
Subject: Re: How to use --whole-archive ld arg with libtool?
Date: Fri, 04 Aug 2006 12:32:27 -0700

Dear libtoolers,

I'm a little stumped by libtools handling of the -Wl,--whole-archive
option. According to the documentation, such an option (-Wl,...) should
be placed on the linker's command line right where it is located on
libtool's command line. However, that does not appear to be the case.
It seems I have a situation that is similar to Alain BARBET's (circa
2002: http://lists.gnu.org/archive/html/libtool/2002-05/msg00045.html),
for which there was no answer. 

I need to ensure that certain libraries are included in their entirety
while others are not. Consider this example:

libtool --tag=CXX --tag=disable-shared --mode=link g++ \
  -o myprog -Wl,--whole-archive -llib1 -llib2 -Wl,--no-whole-archive \
  -llib3 -llib4

This seems to generate a link command like:

g++ -o myprog -Wl,--whole-archive -Wl,--no-whole-archive -llib1 -llib2
-llib3 -llib4 

which completely circumvents the point of the --whole-archive and
--no-whole-archive options in the first place.

The reason I need this capability is to ensure that all the symbols from
lib1 and lib2 are available to any dlopen'd modules that get loaded by
"myprog".  Without this capability, I'm forced to completely avoid use
of libtool when making lib1 and lib2 (static archives) and link all
the .o files in those archives as another .o file. This really slows
down build and link times.

As there was no answer to Alain's message in 2002, and this still seems
to be libtool's current behavior (version 1.5.22), I'm assuming this
isn't something that is implemented by libtool.  I'm willing to do the
leg work to prepare a patch, but I don't have a clue how libtool works
under the covers (it *is* afterall nearly 8000 lines of shell
scriptese).

Any ideas, help, or pointers would be very welcome.  BTW, this is for
use with both the LLVM ( http://llvm.org/ ) and HLVM
( http://hlvm.org/ ) projects.

Reid Spencer
http://reidspencer.com/






reply via email to

[Prev in Thread] Current Thread [Next in Thread]