From: Fam Zheng <famz@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "Michael Tokarev" <mjt@tls.msk.ru>,
"QEMU Developers" <qemu-devel@nongnu.org>,
"Alex Bligh" <alex@alex.org.uk>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Miroslav Rezanina" <mrezanin@redhat.com>,
"Lluís Vilanova" <vilanova@ac.upc.edu>,
"Richard Henderson" <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH v15 6/9] module: implement module loading
Date: Tue, 14 Jan 2014 11:18:14 +0800 [thread overview]
Message-ID: <20140114031814.GC9212@T430.nay.redhat.com> (raw)
In-Reply-To: <CAFEAcA8GP28ZfRAjLswghKQuRk8++T9P9JBcB8qpDg8Y=OTK5g@mail.gmail.com>
On Mon, 01/13 22:09, Peter Maydell wrote:
> On 13 January 2014 16:59, Paolo Bonzini <pbonzini@redhat.com> wrote:
> > From: Fam Zheng <famz@redhat.com>
> >
> > This patch adds loading, stamp checking and initialization of modules.
> >
> > The init function of dynamic module is no longer directly called as
> > __attribute__((constructor)) in static linked version, it is called
> > only after passed the checking of presense of stamp symbol:
> >
> > qemu_stamp_$(date +%s$$$RANDOM)
> >
> > With this, modules built from a different tree/version/configure will
> > not be loaded.
> >
> > The module loading code requires gmodule-2.0.
> >
> > Signed-off-by: Fam Zheng <famz@redhat.com>
> > Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> > ---
> > Makefile | 3 +
> > configure | 31 +++++++++-----
> > include/qemu/module.h | 12 +++++
> > rules.mak | 7 ++-
> > scripts/create_config | 14 ++++++
> > util/module.c | 107 ++++++++++++++++++++++++++++++++++++++++++++++++-
> > 6 files changed, 158 insertions(+), 16 deletions(-)
> >
> > diff --git a/Makefile b/Makefile
> > index 9de66cb..670ce44 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -203,6 +203,9 @@ Makefile: $(version-obj-y) $(version-lobj-y)
> > libqemustub.a: $(stub-obj-y)
> > libqemuutil.a: $(util-obj-y) qapi-types.o qapi-visit.o
> >
> > +block-modules = $(foreach o,$(block-obj-m),"$(basename $(subst /,-,$o))",) NULL
> > +util/module.o-cflags = -D'CONFIG_BLOCK_MODULES=$(block-modules)'
> > +
> > ######################################################################
> >
> > qemu-img.o: qemu-img-cmds.h
> > diff --git a/configure b/configure
> > index 6b46c66..c382044 100755
> > --- a/configure
> > +++ b/configure
> > @@ -677,7 +677,8 @@ for opt do
> > ;;
> > --disable-debug-info)
> > ;;
> > - --enable-modules) modules="yes"
> > + --enable-modules)
> > + modules="yes"
> > ;;
> > --cpu=*)
> > ;;
> > @@ -1130,7 +1131,7 @@ Advanced options (experts only):
> > --libdir=PATH install libraries in PATH
> > --sysconfdir=PATH install config in PATH$confsuffix
> > --localstatedir=PATH install local state in PATH (set at runtime on win32)
> > - --with-confsuffix=SUFFIX suffix for QEMU data inside datadir and sysconfdir [$confsuffix]
> > + --with-confsuffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir [$confsuffix]
> > --enable-modules enable modules support
> > --enable-debug-tcg enable TCG debugging
> > --disable-debug-tcg disable TCG debugging (default)
> > @@ -2346,15 +2347,19 @@ if test "$mingw32" = yes; then
> > else
> > glib_req_ver=2.12
> > fi
> > -if $pkg_config --atleast-version=$glib_req_ver gthread-2.0; then
> > - glib_cflags=`$pkg_config --cflags gthread-2.0`
> > - glib_libs=`$pkg_config --libs gthread-2.0`
> > - CFLAGS="$glib_cflags $CFLAGS"
> > - LIBS="$glib_libs $LIBS"
> > - libs_qga="$glib_libs $libs_qga"
> > -else
> > - error_exit "glib-$glib_req_ver required to compile QEMU"
> > -fi
> > +
> > +for i in gthread-2.0 gmodule-2.0; do
> > + if $pkg_config --atleast-version=$glib_req_ver $i; then
> > + glib_cflags=`$pkg_config --cflags $i`
> > + glib_libs=`$pkg_config --libs $i`
> > + CFLAGS="$glib_cflags $CFLAGS"
> > + LIBS="$glib_libs $LIBS"
> > + libs_qga="$glib_libs $libs_qga"
> > + else
> > + error_exit "glib-$glib_req_ver required to compile QEMU"
> > + fi
> > +done
>
> Also, isn't this going to give rather unhelpful error messages if
> the system has glib and gthread but not gmodule? (Or is it
> guaranteed that they come as a set? If so then we can either
> not bother checking or print a "your system's glib seems to be
> busted" message...)
>
I think they all usually come with one glib package. But it doean't hurt to
check, it's easy enough to include $i in the error message.
Fam
next prev parent reply other threads:[~2014-01-14 3:18 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-13 16:59 [Qemu-devel] [PATCH v15 0/9] Shared library module support Paolo Bonzini
2014-01-13 16:59 ` [Qemu-devel] [PATCH v15 1/9] rules.mak: fix $(obj) to a real relative path Paolo Bonzini
2014-01-13 16:59 ` [Qemu-devel] [PATCH v15 2/9] rules.mak: allow per object cflags and libs Paolo Bonzini
2014-01-13 16:59 ` [Qemu-devel] [PATCH v15 3/9] block: use per-object " Paolo Bonzini
2014-01-13 16:59 ` [Qemu-devel] [PATCH v15 4/9] darwin: do not use -mdynamic-no-pic Paolo Bonzini
2014-01-13 22:11 ` Peter Maydell
2014-01-13 16:59 ` [Qemu-devel] [PATCH v15 5/9] build-sys: introduce common-obj-m and block-obj-m for DSO Paolo Bonzini
2014-01-13 16:59 ` [Qemu-devel] [PATCH v15 6/9] module: implement module loading Paolo Bonzini
2014-01-13 22:05 ` Peter Maydell
2014-01-14 3:21 ` Fam Zheng
2014-01-13 22:09 ` Peter Maydell
2014-01-14 3:18 ` Fam Zheng [this message]
2014-01-13 22:15 ` Richard Henderson
2014-01-14 3:06 ` Fam Zheng
2014-01-14 14:47 ` Richard Henderson
2014-01-14 15:19 ` Paolo Bonzini
2014-01-14 15:25 ` Peter Maydell
2014-01-14 15:31 ` Paolo Bonzini
2014-01-14 15:43 ` Richard Henderson
2014-01-14 15:47 ` Daniel P. Berrange
2014-01-14 15:45 ` Daniel P. Berrange
2014-01-15 8:28 ` Fam Zheng
2014-01-13 16:59 ` [Qemu-devel] [PATCH v15 7/9] Makefile: install modules with "make install" Paolo Bonzini
2014-01-13 16:59 ` [Qemu-devel] [PATCH v15 8/9] .gitignore: ignore module related files (dll, so, mo) Paolo Bonzini
2014-01-13 16:59 ` [Qemu-devel] [PATCH v15 9/9] block: convert block drivers linked with libs to modules Paolo Bonzini
2014-01-13 22:01 ` [Qemu-devel] [PATCH v15 0/9] Shared library module support Peter Maydell
2014-01-14 7:47 ` Fam Zheng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140114031814.GC9212@T430.nay.redhat.com \
--to=famz@redhat.com \
--cc=alex@alex.org.uk \
--cc=mjt@tls.msk.ru \
--cc=mrezanin@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
--cc=vilanova@ac.upc.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).