[Top][All Lists]

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

Re: Disable --whole-archive when using convenience archives

From: Ralf Wildenhues
Subject: Re: Disable --whole-archive when using convenience archives
Date: Thu, 3 Dec 2009 21:39:22 +0100
User-agent: Mutt/1.5.20 (2009-10-28)

Hello Alon,

please don't top-post, thanks.

* Alon Bar-Lev wrote on Thu, Dec 03, 2009 at 09:28:59PM CET:
> On Thu, Dec 3, 2009 at 10:17 PM, Ralf Wildenhues wrote:
> > * Alon Bar-Lev wrote on Thu, Dec 03, 2009 at 07:08:03PM CET:
> > > I have some convenience archives linked against several modules.
> > >
> > > I wish only required objects to be included in modules.
> >
> > Then make the convenience archives not be convenience archives any
> > longer, i.e., make them libtool libraries.
> > In either case, they may end up being shared libraries (or both), so if
> > you don't want that, add -static to libbar_la_LDFLAGS.
> I had to add -prefer-pic to CFLAGS in order it to work properly... :)
> Wow... this is an ugly workaround... Any reason why a simple switch to
> "libtool --mode=link" is not supported?

Yes, I think this is by intention.  What you do is, at least most of the
time, ugly.  Why do you need the library to be PIC?  Usually, the reason
for that is that does end up included in a, or a couple of, shared
libraries or modules somewhere.  And at that point, you risk (exposing
your users to) subtle bugs: if code from lib1 is present in several
places, and contains static state (example: last random number of a
RNG), then on some systems, different parts of the running executable
might suddenly use different instances of that state.  Eww.

Typically, that's the point at which developers reconsider to make lib1
a proper shared library.

> Is it the first time someone needs this?

No, but we've been able to convince most of the other guys that asked
for this to reconsider.  ;-)


reply via email to

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