Fwd: Re: Fix for --as-needed

Thiago Macieira thiago.macieira at kdemail.net
Mon Nov 22 20:14:01 GMT 2004

David Faure wrote:
>On Monday 22 November 2004 14:44, Michael Matz wrote:
>> This should do no harm.  It changes a bit the way how you can call the
>> lt-* binary.  After calling the script once it was self-contained
>> (i.e. contained all relevant RPATHs), so it was possible to call the
>> lt-* binary directly.  Now you really have to go through the script
>> for setting LD_LIBRARY_PATH.

The solution for that would be my second option, which I discarded: remove 
--as-needed from the relinking.

That would require a much more invasive change to libtool, which I am not 
confident in. It would be ideal for libtool's configure checks to test 
the flag and use it on its own for the release/installed binaries. But, 
when doing relinking, it would not use the flag, thus generating a binary 
which loaded all its dependencies -- or, at the very least, the 
uninstalled libraries.

If you really do gdb .libs/lt-foobar often -- sometimes I do -- you should 
remove the --as-needed flag from your compilation. It's just a matter of 
running your Makefile through sed 's/-Wl,--as-needed//'

>Ouch, that means no more "gdb .libs/lt-foobar core.12345" then...

That doesn't apply to core dumps. The libraries that were loaded are 
listed by full pathname in the core.

>>> 3) make the --as-needed flag usage default to yes only if 
>>> --enable-new-dtags is present as well
>>I don't like this.  The reason is, that some ld's (well, yes, SuSE's 
>>binutils) have this active by default.  On those it works without the 
>>flag.  I would expect that somewhen the default for using the new dtags 
>>will be switched globally.  So the dependency of as-needed on new-dtags 
>>should not be strict.

On those ld's, it should have no effect at all. If --enable-new-dtags is 
already active, passing it to the linker will not make a dent. We don't 
pass the --disable-new-dtags flag ever.

The dependency is on whether the flag is valid. Even after it becomes the 
default, I don't expect the flag to be gone soon. We will have plenty of 
time to fix that before binutils is released.

If it makes you feel better, we can add a comment:
dnl Remove this when --enable-new-dtags is deprecated
dnl and before it is removed from the linker


  Thiago Macieira  -  Registered Linux user #65028
   thiago (AT) macieira (DOT) info
    ICQ UIN: 1967141   PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20041122/4e6b1667/attachment.sig>

More information about the kde-core-devel mailing list