Re: Avoid -Wl,--whole-archive

Bob Friesenhahn <[email protected]>
Newsgroups gmane.comp.gnu.libtool.general
Message-ID <[email protected]>
On Tue, 21 May 2019, Thomas Jahns wrote:

> On 5/16/19 5:00 PM, Bob Friesenhahn wrote:
>> Convenience libraries are evil.  Convenience libraries slow down your build 
>> process dramatically and they cause 'make' not to be aware of the actual 
>> underlying dependencies, so that it does much more work than is required 
>> each type you invoke 'make'.  If you can enumerate the actual dependencies 
>> in the Makefile and avoid needless intermediate product generation, then 
>> you will achive a maximally parallel build which builds much faster on 
>> modern systems.
>
> Except when they don't actually slow you down: ar and ranlib provide for a 
> lookup table that in my experience is beneficial to build times, especially 
> when you have a network filesystem, where access to individual file system 
> objects can be more expensive.

These features are not used by convenience libraries.  The fact that 
convenience libraries store object files in an archive file is just an 
artifact of its implementation.  An alternative would have been to use 
pax or tar, but these require creating the whole file from scratch and 
are not as portably available (for compilation) as 'ar'.  When a 
convenience library is linked with a shared library, all of its 
contained object files may be first extracted, and then the list of 
object files is supplied to the linker.  This happens when 
-Wl,--whole-archive is not available.

Given that convenience libraries do use the 'ar' format and are 
compiled as PIC when building shared libraries (if needed), an 
alternative way of referencing the archive file from the Makefile 
would likely avoid the -Wl,--whole-archive problem.

Bob
-- 
Bob Friesenhahn
[email protected], http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/
Public Key,     http://www.simplesystems.org/users/bfriesen/public-key.txt

_______________________________________________
https://lists.gnu.org/mailman/listinfo/libtool
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.