Avoid -Wl,--whole-archive

Tim Rühsen <[email protected]>
Newsgroups gmane.comp.gnu.libtool.general
Message-ID <[email protected]>
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

_______________________________________________
https://lists.gnu.org/mailman/listinfo/libtool
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEHLJ9vJhhSy1YQWRtCDAttqJnBCgFAlzdZi0ACgkQCDAttqJn
BCjdwxAAuJ4UZJekqShLosFZ0fV5n7DNye7K7hJDpfGoIOgknbv6tpPJuKuFhnkI
KGUAlxvZYg5ea/idN3/T4KDw2BMHRxfw07NvH49bIPNMvE/X6Xd/RX5BvodpxT1n
6kcxqZRoKNMq5ywFUgOQWetsvfdW6xcpIKE44l0RUd2bsK8yBI3pwWyHPasHBDNw
LXXesvmh7bZfH8nBlh6gYGXwRiIJSWGZg2Aw4skIIfN43SrL2YIAqLGR2sZvwE2l
q2mrZ7RHrTa1z5DUJUo+JAAOlOjuol2Bwzrf5O7IwyazX2G/axkXvv+WnYQwM7ey
3DLC9myTZaFckyOftOmRDVfGHaoCQp9CPf7e/T451gAsvEMQ/nJbmNzVzrNIpQ0m
MUvyb7TwwcswrVQtky4nCGwGvoOKcCNlj6GHrDGkPKEzioSf6ooyEcu/8QrrRzrU
l8ljRKp8Ox0DgUqLdmVbbzrdiv3zdZwABR9QS2XUmJt+XwF2KpZrhbOIpCsJxc0n
U8OQiWNKQaTFkfLfja0SsfQ9o8iVxINsx4bum8FG5CRnv865vH8PpCcnKYOy5GiP
Kpgjs56I6Z64LwVnnhCx6+xdaicuSAE7VIKJq1haWAqyg8hRBfYldMOMV1fbo0qk
mOiHVWD/00+o53yuKZDyhCp177/YcXFO6iZ4RZe1z9DIS+smrXg=
=KyeJ
-----END PGP SIGNATURE-----
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.