[Top][All Lists]

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

Supporting ld's --as-needed flag

From: Szombathelyi György
Subject: Supporting ld's --as-needed flag
Date: Mon, 14 Jun 2004 12:00:40 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; hu-HU; rv:1.6) Gecko/20040113


Some weeks ago I started a thread about how to _not_ link a library or a program against its indirect dependencies:

The conclusion was that libtool cannot solve this easily, because some platform must link all libraries, and platforms which are not require the full linking if shared libraries used, may require full linking when static libraries used. Luckily, the developers of GNU ld added a linker flag, --as-needed to achieve the desired effect. Unfortunately libtool will add this flag to the end of the compiler/linker options (if LDFLAGS=-Wl,--as-needed variable set), so the option will be useless. I posted a patch which simply puts $compiler_flags _before_ any deplibs, so GNU ld can do its job to remove unneeded libraries:

This patch is against libtool 1.5.6. I understand that it may broke linking in some platforms (however I don't know exactly which platforms, I also don't know if there are linkers who needs the flags after the objects and libraries). My questions are: is my approach good? Can this (or similar) patch go into CVS? If it's I will gladly create a new version against CVS. Or is there any other plans for supporting this very useful feature of ld? I already compiled KDE with these changes on a x86/Linux, and the results were very convencing, the dependencies of all KDE libraries and applications went down significally.

P.S: A spam filter would be very good for this list.


reply via email to

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