Fix symbol exports & remove duplicated libvirt_util.la linkage

The libvirt_util.la library was mistakenly linked into libvirtd
directly. Since libvirt_util.la is already linked to libvirt.so,
this resulted in libvirtd getting two copies of the code and
more critically 2 copies of static global variables.

Testing in turn exposed a issue with loadable modules. The
gnulib replacement functions are not exported to loadable
modules. Rather than trying to figure out the name sof all
gnulib functions & export them, just linkage all loadable
modules against libgnu.la statically.

* daemon/Makefile.am: Remove linkage of libvirt_util.la
  and libvirt_driver.la
* src/Makefile.am: Link driver modules against libgnu.la
* src/libvirt.c: Don't try to load modules which were
  compiled out
* src/libvirt_private.syms: Export all other internal
  symbols that are required  by drivers
This commit is contained in:
Daniel P. Berrange 2010-10-12 12:23:18 +01:00
parent b8e2de8899
commit 9bd3cce0d2
4 changed files with 81 additions and 8 deletions

View File

@ -99,11 +99,9 @@ libvirtd_LDADD = \
$(SASL_LIBS) \
$(POLKIT_LIBS)
libvirtd_LDADD += ../src/libvirt_util.la ../src/libvirt-qemu.la
libvirtd_LDADD += ../src/libvirt-qemu.la
if WITH_DRIVER_MODULES
libvirtd_LDADD += ../src/libvirt_driver.la
else
if ! WITH_DRIVER_MODULES
if WITH_QEMU
libvirtd_LDADD += ../src/libvirt_driver_qemu.la
endif

View File

@ -83,7 +83,7 @@ UTIL_SOURCES = \
util/uuid.c util/uuid.h \
util/util.c util/util.h \
util/xml.c util/xml.h \
util/virtaudit.c util/virtaudit.h \
util/virtaudit.c util/virtaudit.h \
util/virterror.c util/virterror_internal.h
EXTRA_DIST += util/threads-pthread.c util/threads-win32.c
@ -567,6 +567,7 @@ libvirt_driver_xen_la_CFLAGS = \
libvirt_driver_xen_la_LDFLAGS = $(AM_LDFLAGS)
libvirt_driver_xen_la_LIBADD = $(XEN_LIBS)
if WITH_DRIVER_MODULES
libvirt_driver_xen_la_LIBADD += ../gnulib/lib/libgnu.la
libvirt_driver_xen_la_LDFLAGS += -module -avoid-version
endif
libvirt_driver_xen_la_SOURCES = $(XEN_DRIVER_SOURCES)
@ -580,6 +581,10 @@ noinst_LTLIBRARIES += libvirt_driver_phyp.la
libvirt_la_BUILT_LIBADD += libvirt_driver_phyp.la
endif
libvirt_driver_phyp_la_LIBADD = $(LIBSSH2_LIBS)
if WITH_DRIVER_MODULES
libvirt_driver_phyp_la_LIBADD += ../gnulib/lib/libgnu.la
libvirt_driver_phyp_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
endif
libvirt_driver_phyp_la_CFLAGS = $(LIBSSH2_CFLAGS) \
-I@top_srcdir@/src/conf $(AM_CFLAGS)
libvirt_driver_phyp_la_SOURCES = $(PHYP_DRIVER_SOURCES)
@ -595,6 +600,7 @@ endif
libvirt_driver_openvz_la_CFLAGS = \
-I@top_srcdir@/src/conf $(AM_CFLAGS)
if WITH_DRIVER_MODULES
libvirt_driver_openvz_la_LIBADD = ../gnulib/lib/libgnu.la
libvirt_driver_openvz_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
endif
libvirt_driver_openvz_la_SOURCES = $(OPENVZ_DRIVER_SOURCES)
@ -609,10 +615,11 @@ libvirt_la_BUILT_LIBADD += libvirt_driver_vbox.la
endif
libvirt_driver_vbox_la_CFLAGS = \
-I@top_srcdir@/src/conf $(AM_CFLAGS)
libvirt_driver_vbox_la_LIBADD = $(DLOPEN_LIBS)
if WITH_DRIVER_MODULES
libvirt_driver_vbox_la_LIBADD += ../gnulib/lib/libgnu.la
libvirt_driver_vbox_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
endif
libvirt_driver_vbox_la_LIBADD = $(DLOPEN_LIBS)
libvirt_driver_vbox_la_SOURCES = $(VBOX_DRIVER_SOURCES)
endif
@ -628,6 +635,7 @@ libvirt_driver_xenapi_la_CFLAGS = $(LIBXENSERVER_CFLAGS) $(LIBCURL_CFLAGS) \
libvirt_driver_xenapi_la_LDFLAGS = $(AM_LDFLAGS)
libvirt_driver_xenapi_la_LIBADD = $(LIBXENSERVER_LIBS) $(LIBCURL_LIBS)
if WITH_DRIVER_MODULES
libvirt_driver_xenapi_la_LIBADD += ../gnulib/lib/libgnu.la
libvirt_driver_xenapi_la_LDFLAGS += -module -avoid-version
endif
libvirt_driver_xenapi_la_SOURCES = $(XENAPI_DRIVER_SOURCES)
@ -646,6 +654,7 @@ libvirt_driver_qemu_la_CFLAGS = $(NUMACTL_CFLAGS) \
libvirt_driver_qemu_la_LDFLAGS = $(AM_LDFLAGS)
libvirt_driver_qemu_la_LIBADD = $(NUMACTL_LIBS)
if WITH_DRIVER_MODULES
libvirt_driver_qemu_la_LIBADD += ../gnulib/lib/libgnu.la
libvirt_driver_qemu_la_LDFLAGS += -module -avoid-version
endif
libvirt_driver_qemu_la_SOURCES = $(QEMU_DRIVER_SOURCES)
@ -671,6 +680,7 @@ endif
libvirt_driver_lxc_la_CFLAGS = \
-I@top_srcdir@/src/conf $(AM_CFLAGS)
if WITH_DRIVER_MODULES
libvirt_driver_lxc_la_LIBADD = ../gnulib/lib/libgnu.la
libvirt_driver_lxc_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
endif
libvirt_driver_lxc_la_SOURCES = $(LXC_DRIVER_SOURCES)
@ -696,6 +706,7 @@ libvirt_driver_uml_la_CFLAGS = $(NUMACTL_CFLAGS) \
libvirt_driver_uml_la_LDFLAGS = $(AM_LDFLAGS)
libvirt_driver_uml_la_LIBADD = $(NUMACTL_LIBS)
if WITH_DRIVER_MODULES
libvirt_driver_uml_la_LIBADD += ../gnulib/lib/libgnu.la
libvirt_driver_uml_la_LDFLAGS += -module -avoid-version
endif
libvirt_driver_uml_la_SOURCES = $(UML_DRIVER_SOURCES)
@ -715,6 +726,7 @@ libvirt_driver_one_la_LDFLAGS = $(AM_LDFLAGS)
libvirt_driver_one_la_LIBADD = $(XMLRPC_LIBS)
#libvirt_driver_one_la_CFLAGS = "-DWITH_ONE"
if WITH_DRIVER_MODULES
libvirt_driver_one_la_LIBADD += ../gnulib/lib/libgnu.la
libvirt_driver_one_la_LDFLAGS += -module -avoid-version
endif
libvirt_driver_one_la_SOURCES = $(ONE_DRIVER_SOURCES)
@ -738,6 +750,7 @@ libvirt_driver_esx_la_CFLAGS = $(LIBCURL_CFLAGS) \
libvirt_driver_esx_la_LDFLAGS = $(AM_LDFLAGS)
libvirt_driver_esx_la_LIBADD = $(LIBCURL_LIBS)
if WITH_DRIVER_MODULES
libvirt_driver_esx_la_LIBADD += ../gnulib/lib/libgnu.la
libvirt_driver_esx_la_LDFLAGS += -module -avoid-version
endif
libvirt_driver_esx_la_SOURCES = $(ESX_DRIVER_SOURCES)
@ -755,6 +768,7 @@ endif
libvirt_driver_network_la_CFLAGS = \
-I@top_srcdir@/src/conf $(AM_CFLAGS)
if WITH_DRIVER_MODULES
libvirt_driver_network_la_LIBADD = ../gnulib/lib/libgnu.la
libvirt_driver_network_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
endif
libvirt_driver_network_la_SOURCES = $(NETWORK_DRIVER_SOURCES)
@ -776,6 +790,7 @@ libvirt_driver_interface_la_CFLAGS = $(NETCF_CFLAGS) \
libvirt_driver_interface_la_LDFLAGS = $(AM_LDFLAGS)
libvirt_driver_interface_la_LIBADD = $(NETCF_LIBS)
if WITH_DRIVER_MODULES
libvirt_driver_interface_la_LIBADD += ../gnulib/lib/libgnu.la
libvirt_driver_interface_la_LDFLAGS += -module -avoid-version
endif
libvirt_driver_interface_la_SOURCES = $(INTERFACE_DRIVER_SOURCES)
@ -792,8 +807,8 @@ endif
libvirt_driver_secret_la_CFLAGS = \
-I@top_srcdir@/src/conf $(AM_CFLAGS)
if WITH_DRIVER_MODULES
libvirt_driver_secret_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
libvirt_driver_secret_la_LIBADD = ../gnulib/lib/libgnu.la
libvirt_driver_secret_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
endif
libvirt_driver_secret_la_SOURCES = $(SECRET_DRIVER_SOURCES)
endif
@ -813,6 +828,7 @@ noinst_LTLIBRARIES += libvirt_driver_storage.la
#libvirt_la_BUILT_LIBADD += libvirt_driver_storage.la
endif
if WITH_DRIVER_MODULES
libvirt_driver_storage_la_LIBADD += ../gnulib/lib/libgnu.la
libvirt_driver_storage_la_LDFLAGS += -module -avoid-version
endif
libvirt_driver_storage_la_SOURCES += $(STORAGE_DRIVER_SOURCES)
@ -868,6 +884,7 @@ libvirt_driver_nodedev_la_LIBADD += $(UDEV_LIBS) $(PCIACCESS_LIBS)
endif
if WITH_DRIVER_MODULES
libvirt_driver_nodedev_la_LIBADD += ../gnulib/lib/libgnu.la
libvirt_driver_nodedev_la_LDFLAGS += -module -avoid-version
endif
endif
@ -885,8 +902,8 @@ libvirt_driver_nwfilter_la_CFLAGS = $(LIBPCAP_CFLAGS) \
libvirt_driver_nwfilter_la_LDFLAGS = $(LD_AMFLAGS)
libvirt_driver_nwfilter_la_LIBADD = $(LIBPCAP_LIBS)
if WITH_DRIVER_MODULES
libvirt_driver_nwfilter_la_LDFLAGS += -module -avoid-version
libvirt_driver_nwfilter_la_LIBADD += ../gnulib/lib/libgnu.la
libvirt_driver_nwfilter_la_LDFLAGS += -module -avoid-version
endif
libvirt_driver_nwfilter_la_SOURCES = $(NWFILTER_DRIVER_SOURCES)
endif

View File

@ -355,13 +355,27 @@ virInitialize(void)
* If they try to open a connection for a module that
* is not loaded they'll get a suitable error at that point
*/
# ifdef WITH_TEST
virDriverLoadModule("test");
# endif
# ifdef WITH_XEN
virDriverLoadModule("xen");
# endif
# ifdef WITH_OPENVZ
virDriverLoadModule("openvz");
# endif
# ifdef WITH_VBOX
virDriverLoadModule("vbox");
# endif
# ifdef WITH_ESX
virDriverLoadModule("esx");
# endif
# ifdef WITH_XENAPI
virDriverLoadModule("xenapi");
# endif
# ifdef WITH_REMOTE
virDriverLoadModule("remote");
# endif
#else
# ifdef WITH_TEST
if (testRegister() == -1) return -1;

View File

@ -3,6 +3,10 @@
# more details.
#
# authhelper.h
virRequestUsername;
virRequestPassword;
# bitmap.h
virBitmapAlloc;
@ -21,6 +25,8 @@ virBufferContentAndReset;
virBufferError;
virBufferURIEncodeString;
virBufferFreeAndReset;
virBufferUse;
virBufferStrcat;
# caps.h
@ -153,8 +159,12 @@ virDomainDiskInsert;
virDomainDiskInsertPreAlloced;
virDomainDiskRemove;
virDomainDiskDefAssignAddress;
virDomainDiskTypeToString;
virDomainDiskTypeFromString;
virDomainControllerInsert;
virDomainControllerInsertPreAlloced;
virDomainControllerModelTypeFromString;
virDomainControllerModelTypeToString;
virDomainFindByID;
virDomainFindByName;
virDomainFindByUUID;
@ -168,6 +178,8 @@ virDomainHostdevSubsysTypeToString;
virDomainInputDefFree;
virDomainLifecycleTypeFromString;
virDomainLifecycleTypeToString;
virDomainLifecycleCrashTypeFromString;
virDomainLifecycleCrashTypeToString;
virDomainLoadAllConfigs;
virDomainNetDefFree;
virDomainNetTypeToString;
@ -232,11 +244,17 @@ virDomainSnapshotHasChildren;
virDomainSnapshotObjUnref;
virDomainSnapshotDefParseString;
virDomainSnapshotDefFormat;
virDomainSnapshotDefFree;
virDomainSnapshotAssignDef;
virDomainObjAssignDef;
virDomainChrDefForeach;
virDomainDiskDefForeachPath;
virDomainChrConsoleTargetTypeToString;
virDomainChrConsoleTargetTypeFromString;
virDomainChrTcpProtocolTypeToString;
virDomainChrTcpProtocolTypeFromString;
virDomainDiskCacheTypeToString;
virDomainDiskCacheTypeFromString;
# domain_event.h
@ -283,6 +301,11 @@ virDomainConfNWFilterInstantiate;
virDomainConfNWFilterTeardown;
virDomainConfVMNWFilterTeardown;
# driver.h
virDriverLoadModule;
# ebtables.h
ebtablesAddForwardAllowIn;
ebtablesAddForwardPolicyReject;
@ -510,6 +533,8 @@ virNodeDeviceDefFree;
virNodeDevCapsDefFree;
virNodeDeviceDefFormat;
virNodeDeviceDefParseString;
virNodeDeviceDefParseNode;
virNodeDeviceDefParseFile;
virNodeDeviceObjLock;
virNodeDeviceObjUnlock;
virNodeDeviceAssignDef;
@ -653,6 +678,7 @@ virStorageFileIsSharedFS;
# threads.h
virMutexInit;
virMutexInitRecursive;
virMutexDestroy;
virMutexLock;
virMutexUnlock;
@ -708,6 +734,7 @@ virParseVersionString;
virPipeReadUntilEOF;
virAsprintf;
virRun;
virRunWithHook;
virSkipSpaces;
virKillProcess;
virGetUserDirectory;
@ -718,6 +745,17 @@ virFileFindMountPoint;
virFileWaitForDevices;
virFileMatchesNameSuffix;
virArgvToString;
virStrcpy;
virStrncpy;
virBuildPathInternal;
virFileStripSuffix;
virFileOperation;
virFork;
virRandom;
virRandomInitialize;
virDirCreate;
virIndexToDiskName;
# interface.h
ifaceCtrl;
@ -742,6 +780,12 @@ virUUIDParse;
virSetHostUUIDStr;
virGetHostUUID;
# virtaudit.h
virAuditClose;
virAuditLog;
virAuditOpen;
virAuditSend;
# virterror_internal.h
virReportErrorHelper;