[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC 3/6] configure: add --enable-plugins
From: |
Emilio G. Cota |
Subject: |
[Qemu-devel] [RFC 3/6] configure: add --enable-plugins |
Date: |
Wed, 6 Sep 2017 16:28:45 -0400 |
For now only add it for ELF platforms, since we rely on the linker's
--dynamic-list flag to pass a list of symbols to be exported to the
executable. An alternative would be to use -rdynamic, but that would
expose all of QEMU's objects to plugins.
I have no experience with non-ELF systems but I suspect adding support
for those should be pretty easy.
Signed-off-by: Emilio G. Cota <address@hidden>
---
configure | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 52 insertions(+)
diff --git a/configure b/configure
index 987f59b..45f7af5 100755
--- a/configure
+++ b/configure
@@ -30,6 +30,7 @@ TMPO="${TMPDIR1}/${TMPB}.o"
TMPCXX="${TMPDIR1}/${TMPB}.cxx"
TMPE="${TMPDIR1}/${TMPB}.exe"
TMPMO="${TMPDIR1}/${TMPB}.mo"
+TMPTXT="${TMPDIR1}/${TMPB}.txt"
rm -f config.log
@@ -404,6 +405,8 @@ tcmalloc="no"
jemalloc="no"
replication="yes"
vxhs=""
+plugins="no"
+ld_dynamic_list="no"
supported_cpu="no"
supported_os="no"
@@ -1282,6 +1285,10 @@ for opt do
;;
--enable-vxhs) vxhs="yes"
;;
+ --enable-plugins) plugins="yes"
+ ;;
+ --disable-plugins) plugins="no"
+ ;;
*)
echo "ERROR: unknown option $opt"
echo "Try '$0 --help' for more information"
@@ -1442,6 +1449,8 @@ Advanced options (experts only):
xen pv domain builder
--enable-debug-stack-usage
track the maximum stack usage of stacks created by
qemu_alloc_stack
+ --enable-plugins
+ enable plugins via shared library loading
Optional features, enabled with --enable-FEATURE and
disabled with --disable-FEATURE, default is enabled if available:
@@ -4745,6 +4754,42 @@ if compile_prog "" "" ; then
atomic64=yes
fi
+#########################################
+# See if --dynamic-list is supported by the linker
+
+cat > $TMPTXT <<EOF
+{
+ foo;
+};
+EOF
+
+cat > $TMPC <<EOF
+#include <stdio.h>
+void foo(void);
+
+void foo(void)
+{
+ printf("foo\n");
+}
+
+int main(void)
+{
+ foo();
+ return 0;
+}
+EOF
+
+if compile_prog "" "-Wl,--dynamic-list=$TMPTXT" ; then
+ ld_dynamic_list="yes"
+else
+ if test "$plugins" = "yes" ; then
+ error_exit \
+ "Plugin support requires specifying a set of symbols that " \
+ "are exported to plugins. Unfortunately your linker doesn't " \
+ "support the flag (--dynamic-list) used for this purpose."
+ fi
+fi
+
########################################
# check if getauxval is available.
@@ -5388,6 +5433,7 @@ echo "jemalloc support $jemalloc"
echo "avx2 optimization $avx2_opt"
echo "replication support $replication"
echo "VxHS block device $vxhs"
+echo "plugin support $plugins"
if test "$sdl_too_old" = "yes"; then
echo "-> Your SDL version is too old - please upgrade to have SDL support"
@@ -6053,6 +6099,12 @@ if test "$vxhs" = "yes" ; then
echo "VXHS_LIBS=$vxhs_libs" >> $config_host_mak
fi
+if test "$plugins" = "yes" ; then
+ echo "CONFIG_PLUGINS=y" >> $config_host_mak
+ LIBS="-ldl $LIBS"
+ LDFLAGS="-Wl,--dynamic-list=\$(SRC_PATH)/qemu-plugins.symbols $LDFLAGS"
+fi
+
if test "$tcg_interpreter" = "yes"; then
QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/tci $QEMU_INCLUDES"
elif test "$ARCH" = "sparc64" ; then
--
2.7.4
- [Qemu-devel] [RFC 0/6] initial plugin support, Emilio G. Cota, 2017/09/06
- [Qemu-devel] [RFC 6/6] linux-user: support -plugin option, Emilio G. Cota, 2017/09/06
- [Qemu-devel] [RFC 3/6] configure: add --enable-plugins,
Emilio G. Cota <=
- [Qemu-devel] [RFC 4/6] Makefile: install qemu-api.h as include/qemu-plugin.h, Emilio G. Cota, 2017/09/06
- [Qemu-devel] [RFC 5/6] vl: support -plugin option, Emilio G. Cota, 2017/09/06
- [Qemu-devel] [RFC 1/6] tcg: keep a pointer to the current TB in TCGContext, Emilio G. Cota, 2017/09/06
- [Qemu-devel] [RFC 2/6] plugin: add initial plugin support, Emilio G. Cota, 2017/09/06
- Re: [Qemu-devel] [RFC 0/6] initial plugin support, Peter Maydell, 2017/09/14
- Re: [Qemu-devel] [RFC 0/6] initial plugin support, Stefan Hajnoczi, 2017/09/18