Message ID | 20200723174615.2370096-6-dinechin@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Make SPICE a load module | expand |
On Thu, Jul 23, 2020 at 07:46:13PM +0200, Christophe de Dinechin wrote: > If we want to build spice as a separately loadable module, we need to > put all the spice code in one loadable module, because the build > system does not know how to deal with dependencies yet. I'd tend to think teaching qemu about module dependencies will work better. I've digged around in g_module_open() docs a bit. There seems to be no way to set a shared library search path, which makes it tricky to simply depend on the dynamic linker because features like loading modules from the build directory when qemu is started from the build directory will not work as expected then. So qemu has do deal with it, in the simplest case just a static dependency list compiled in which is checked on every module load. Symbols from other modules are available if they are loaded without G_MODULE_BIND_LOCAL. That will make module autoloading work better. Right now it works fine with -display spice-app. It doesn't work with a plain -spice. And "-audiodev spice,id=test" will not load the spice module either. I think we should have: (1) A audio-spice.so module (autoload will work, by naming convention for audio modules). (2) A chardev-spice.so module (autoload needs two lines in qom_modules in util/module.c, one for each chardev). (3) A ui/spice-app.so module (autoload works by naming convention). (4) A ui/spice-core.so module which all other spice modules depend on. qemu must explicitly load that one in case it finds -spice on the command line. take care, Gerd
diff --git a/audio/Makefile.objs b/audio/Makefile.objs index b4a4c11f31..298c895ff5 100644 --- a/audio/Makefile.objs +++ b/audio/Makefile.objs @@ -1,5 +1,5 @@ common-obj-y = audio.o audio_legacy.o noaudio.o wavaudio.o mixeng.o -common-obj-$(CONFIG_SPICE) += spiceaudio.o +spice-app.mo-objs += ../audio/spiceaudio.o common-obj-$(CONFIG_AUDIO_COREAUDIO) += coreaudio.o common-obj-$(CONFIG_AUDIO_DSOUND) += dsoundaudio.o common-obj-$(CONFIG_AUDIO_WIN_INT) += audio_win_int.o diff --git a/chardev/Makefile.objs b/chardev/Makefile.objs index 7cf05c9541..2add4319a9 100644 --- a/chardev/Makefile.objs +++ b/chardev/Makefile.objs @@ -26,5 +26,4 @@ baum.o-cflags := $(SDL_CFLAGS) baum.o-libs := $(BRLAPI_LIBS) endif -common-obj-$(CONFIG_SPICE) += spice.mo -spice.mo-objs := spice.o +spice-app.mo-objs += ../chardev/spice.o diff --git a/ui/Makefile.objs b/ui/Makefile.objs index 504b196479..1ab515e23d 100644 --- a/ui/Makefile.objs +++ b/ui/Makefile.objs @@ -11,7 +11,6 @@ common-obj-y += keymaps.o console.o cursor.o qemu-pixman.o common-obj-y += input.o input-keymap.o input-legacy.o kbd-state.o common-obj-y += input-barrier.o common-obj-$(CONFIG_LINUX) += input-linux.o -common-obj-$(CONFIG_SPICE) += spice-core.o spice-input.o spice-display.o common-obj-$(CONFIG_COCOA) += cocoa.o common-obj-$(CONFIG_VNC) += $(vnc-obj-y) common-obj-$(call lnot,$(CONFIG_VNC)) += vnc-stubs.o @@ -53,10 +52,11 @@ curses.mo-objs := curses.o curses.mo-cflags := $(CURSES_CFLAGS) $(ICONV_CFLAGS) curses.mo-libs := $(CURSES_LIBS) $(ICONV_LIBS) -ifeq ($(CONFIG_GIO)$(CONFIG_SPICE),yy) -common-obj-$(if $(CONFIG_MODULES),m,y) += spice-app.mo +common-obj-$(CONFIG_SPICE) += spice-app.mo +spice-app.mo-objs += spice-core.o spice-input.o spice-display.o +ifeq ($(CONFIG_GIO)$(CONFIG_SPICE),ym) +spice-app.mo-objs += spice-app.o endif -spice-app.mo-objs := spice-app.o spice-app.mo-cflags := $(GIO_CFLAGS) spice-app.mo-libs := $(GIO_LIBS)
If we want to build spice as a separately loadable module, we need to put all the spice code in one loadable module, because the build system does not know how to deal with dependencies yet. Signed-off-by: Christophe de Dinechin <dinechin@redhat.com> --- audio/Makefile.objs | 2 +- chardev/Makefile.objs | 3 +-- ui/Makefile.objs | 8 ++++---- 3 files changed, 6 insertions(+), 7 deletions(-)