libtool
[Top][All Lists]
Advanced

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

Avoid -Wl,--whole-archive


From: Tim Rühsen
Subject: Avoid -Wl,--whole-archive
Date: Thu, 16 May 2019 15:31:21 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1

Hi,

at GNU Wget2 we are just splitting a (shared) library into several
smaller ones, grouped by functionality.

We depend on gnulib and have a single libgnu.a. Each of the shared
libraries just need a certain set of functions from libgnu.a.

To avoid adding everything from libgnu.a to each of the libraries, we
would like to avoid "-Wl,--whole-archive ../lib/.libs/libgnu.a
-Wl,--no-whole-archive".

There several ways to work around this situation (e.g. creating one
libgnu.a per library). The preferred one would be to have a new option
to libtool, '-no-whole-archive'.

A simple proof of concept is this patch:

--- libtool     2019-05-16 12:46:46.551527339 +0200
+++ libtool.no-whole-archive    2019-05-16 12:41:25.612879712 +0200
@@ -7700,6 +7700,11 @@
        continue
        ;;

+      -no-whole-archive)
+        whole_archive_flag_spec="\$convenience "
+        continue
+        ;;
+
       -objectlist)
        prev=objectlist
        continue

Maybe you have a better idea !?


With this patch a current snippet from Makefile.am looks like

lib_LTLIBRARIES += libwget_progress.la
libwget_progress_la_SOURCES =  bar.c
libwget_progress_la_CPPFLAGS = $(libwget_la_CPPFLAGS)
libwget_progress_la_LIBADD = ../lib/libgnu.la
libwget_progress_la_LDFLAGS = $(libwget_la_LDFLAGS) -no-whole-archive


If wanted, I am willing to write a real patch (some hints what to
consider would be nice - the codebase is currently unknown to me).

Regards, Tim

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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