[libvirt] [PATCH] src: don't statically link code that's already in libvirt.so

Daniel P. Berrangé posted 1 patch 4 years, 11 months ago
Test syntax-check passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20190516110957.10020-1-berrange@redhat.com
There is a newer version of this series
src/Makefile.am             | 2 +-
src/libvirt_remote.syms     | 1 +
src/locking/Makefile.inc.am | 4 +---
src/logging/Makefile.inc.am | 4 +---
4 files changed, 4 insertions(+), 7 deletions(-)
[libvirt] [PATCH] src: don't statically link code that's already in libvirt.so
Posted by Daniel P. Berrangé 4 years, 11 months ago
virtlockd and virtlogd statically link to libvirt-net-rpc-server.la
libvirt-net-rpc.la and libvirt_util.la. libvirt-iohelper statically
links to libvirt_util.la. All this code is all already built into
the main libvirt.so, so we should dynamically link all these pieces.

This reduces the size of the libvirt-daemon RPM from 5.4 MB down to
1.2 MB which is useful for container installs seeking minimal disk
footprint.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 src/Makefile.am             | 2 +-
 src/libvirt_remote.syms     | 1 +
 src/locking/Makefile.inc.am | 4 +---
 src/logging/Makefile.inc.am | 4 +---
 4 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index 7d452a9490..0b562dc250 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -851,7 +851,7 @@ libvirt_iohelper_LDFLAGS = \
 		$(PIE_LDFLAGS) \
 		$(NULL)
 libvirt_iohelper_LDADD = \
-		libvirt_util.la \
+		libvirt.la \
 		../gnulib/lib/libgnu.la
 if WITH_DTRACE_PROBES
 libvirt_iohelper_LDADD += libvirt_probes.lo
diff --git a/src/libvirt_remote.syms b/src/libvirt_remote.syms
index 98586d1584..3d68f6ce0a 100644
--- a/src/libvirt_remote.syms
+++ b/src/libvirt_remote.syms
@@ -176,6 +176,7 @@ virNetServerClientSetAuthLocked;
 virNetServerClientSetAuthPendingLocked;
 virNetServerClientSetCloseHook;
 virNetServerClientSetDispatcher;
+virNetServerClientSetQuietEOF;
 virNetServerClientSetReadonly;
 virNetServerClientStartKeepAlive;
 virNetServerClientWantCloseLocked;
diff --git a/src/locking/Makefile.inc.am b/src/locking/Makefile.inc.am
index da26fab91f..46ab11c2a9 100644
--- a/src/locking/Makefile.inc.am
+++ b/src/locking/Makefile.inc.am
@@ -145,10 +145,8 @@ virtlockd_LDFLAGS = \
 	$(NO_UNDEFINED_LDFLAGS) \
 	$(NULL)
 virtlockd_LDADD = \
+	libvirt.la \
 	libvirt_driver_admin.la \
-	libvirt-net-rpc-server.la \
-	libvirt-net-rpc.la \
-	libvirt_util.la \
 	../gnulib/lib/libgnu.la \
 	$(CYGWIN_EXTRA_LIBADD) \
 	$(NULL)
diff --git a/src/logging/Makefile.inc.am b/src/logging/Makefile.inc.am
index f5eba2a4f7..d57394cbde 100644
--- a/src/logging/Makefile.inc.am
+++ b/src/logging/Makefile.inc.am
@@ -80,9 +80,7 @@ virtlogd_LDFLAGS = \
 		$(NULL)
 virtlogd_LDADD = \
 		libvirt_driver_admin.la \
-		libvirt-net-rpc-server.la \
-		libvirt-net-rpc.la \
-		libvirt_util.la \
+		libvirt.la \
 		../gnulib/lib/libgnu.la \
 		$(CYGWIN_EXTRA_LIBADD) \
 		$(NULL)
-- 
2.21.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] src: don't statically link code that's already in libvirt.so
Posted by Ján Tomko 4 years, 11 months ago
On Thu, May 16, 2019 at 12:09:57PM +0100, Daniel P. Berrangé wrote:
>virtlockd and virtlogd statically link to libvirt-net-rpc-server.la
>libvirt-net-rpc.la and libvirt_util.la. libvirt-iohelper statically

libvirt_iohelper

>links to libvirt_util.la. All this code is all already built into
>the main libvirt.so, so we should dynamically link all these pieces.
>
>This reduces the size of the libvirt-daemon RPM from 5.4 MB down to
>1.2 MB which is useful for container installs seeking minimal disk
>footprint.
>
>Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
>---
> src/Makefile.am             | 2 +-
> src/libvirt_remote.syms     | 1 +
> src/locking/Makefile.inc.am | 4 +---
> src/logging/Makefile.inc.am | 4 +---
> 4 files changed, 4 insertions(+), 7 deletions(-)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

libvirt_parthelper and libvirt_leaseshelper could benefit from the same
change.

Jano
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] src: don't statically link code that's already in libvirt.so
Posted by Daniel P. Berrangé 4 years, 11 months ago
On Thu, May 16, 2019 at 02:56:21PM +0200, Ján Tomko wrote:
> On Thu, May 16, 2019 at 12:09:57PM +0100, Daniel P. Berrangé wrote:
> > virtlockd and virtlogd statically link to libvirt-net-rpc-server.la
> > libvirt-net-rpc.la and libvirt_util.la. libvirt-iohelper statically
> 
> libvirt_iohelper
> 
> > links to libvirt_util.la. All this code is all already built into
> > the main libvirt.so, so we should dynamically link all these pieces.
> > 
> > This reduces the size of the libvirt-daemon RPM from 5.4 MB down to
> > 1.2 MB which is useful for container installs seeking minimal disk
> > footprint.
> > 
> > Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> > ---
> > src/Makefile.am             | 2 +-
> > src/libvirt_remote.syms     | 1 +
> > src/locking/Makefile.inc.am | 4 +---
> > src/logging/Makefile.inc.am | 4 +---
> > 4 files changed, 4 insertions(+), 7 deletions(-)
> > 
> 
> Reviewed-by: Ján Tomko <jtomko@redhat.com>
> 
> libvirt_parthelper and libvirt_leaseshelper could benefit from the same
> change.

Ah good point, I forgot about those as they were in differnet RPMs

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list