Supporting GNU ld's --as-needed flag

David Faure faure at
Thu Nov 4 17:12:54 GMT 2004

On Sunday 17 October 2004 19:13, Szombathelyi György wrote:
> Hello!
> I wrote about 5 months ago that what can be done to _not_ link all indirect 
> library dependencies into all KDE programs/libraries:
> I learned that GNU ld's --as-needed flag could done this. I always compile KDE 
> libraries and programs with this option, with very good results. So I think 
> it would be nice to add this flag for the KDE build process. The only problem 
> which prevents the use of CFLAGS="-Wl,--as-needed" is that libtool puts this 
> option to the end of the parameter list, which simply makes the option 
> non-working. I attached a patch to the KDE version of libtool, and also a 
> configure check for the availabilty of the flag.
> Can it be added to CVS? Last time I posted a similar patch it was not applied, 
> but now there's enough time for testing.

I asked Michael Matz and he said the patch looks OK, so I'm about to commit it.

But why does the patch say:

Does this mean there is no support for checking for undefined symbols anymore?
We still need that, at least in debug builds (for developers).
For end users (--disable-debug) it's ok if there's no more no-undefined test when linking.

David Faure, faure at, sponsored by Trolltech to work on KDE,
Konqueror (, and KOffice (

More information about the kde-core-devel mailing list