--as-needed compile option?

Harald Hoyer harald at redhat.com
Thu Mar 31 15:11:51 UTC 2005

Joe Orton wrote:
> 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

Wow, global vars that are not static and are not properly initialized... hmm... design problem?

Also, maybe the libdl could be taught to unload/unmap the other libs as well (which would be the right fix)

More information about the test mailing list