Re: --as-needed compile option?

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

 



On Thu, Mar 31, 2005 at 04:58:52PM +0200, Harald Hoyer wrote:
> Arjan van de Ven wrote:
> >On Thu, Mar 31, 2005 at 09:23:42AM -0500, Dan Williams wrote:
> >
> >>On Thu, 2005-03-31 at 15:34 +0200, Arjan van de Ven wrote:
> >>
> >>>we've looked at this; one of the problems is that this needs to be a per
> >>>package thing; there are valid setups where --as-needed breaks (eg apps
> >>>that have plugins can break).
> >>
> >>What kind of stuff do they do that breaks?  I assume that apps that use
> >>dlopen() have error checking for it.  Are we talking about weak-linking
> >>here or something? (weak linking AIUI == ld not resolving symbols until
> >>they are actually used)
> >
> >
> >the most obvious bad case is where a program links to a lib in order to 
> >have
> >plugins use functionality from those libs, but where the program itself
> >doesn't use any functions from the lib. 
> >
> 
> And why does the plugin not link to the libs?

We had all sorts of problems with Apache and OpenSSL in this arena:

if httpd was not linked aganist -lssl -lcrypto, when mod_ssl, or any
particular PHP extension using OpenSSL, was reloaded during a graceful
restart, you risked getting libssl.so unmapped but not libcrypto.so,
depending on the direction of the wind.  This caused havoc because some
global variables in libcrypto would not get reinitialized, but those in
libssl.so would.  Not fun.

So when I link httpd using -lssl -lcrypto, despite the fact that httpd
itself does not use any symbols from those libraries, I *must* get an
httpd with DT_NEEDED of libssl and libcrypto to ensure both stay mapped
for the lifetime of the process.  That's why use of --as-needed must
only be done as directed by the application.

joe


[Index of Archives]     [Fedora Desktop]     [Fedora SELinux]     [Photo Sharing]     [Yosemite Forum]     [KDE Users]