From nobody Thu Nov 6 10:38:32 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1540489066961903.6845400321765; Thu, 25 Oct 2018 10:37:46 -0700 (PDT) Received: from localhost ([::1]:56092 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFjZe-0004RD-PB for importer@patchew.org; Thu, 25 Oct 2018 13:37:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40311) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFjKg-0006hn-24 for qemu-devel@nongnu.org; Thu, 25 Oct 2018 13:22:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFjKb-0000MJ-TH for qemu-devel@nongnu.org; Thu, 25 Oct 2018 13:22:03 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:57675) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFjKb-0000C4-IX for qemu-devel@nongnu.org; Thu, 25 Oct 2018 13:22:01 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id F1685221C9; Thu, 25 Oct 2018 13:21:16 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 13:21:16 -0400 Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 3D862E4AB9; Thu, 25 Oct 2018 13:21:16 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=FuYhJcRsEANKO2wrKj9v/dx0BceTs4MLE9f3oGgohck=; b=wRjPd lhT3E4yf+YLPUzl9pKLPGkJrIOdrJwB8UAkUi/UW/h9gPTWDjaS8jZaiUWFP5Nux ehy6nTwWUmHrXbgJgwU94u/Tla/wCc8M37UXv8FcCmrbHYZeZyaBXfFCDngrgb3+ kQDq1/mjU2TbrF4F7gcmrm3mWmVynabm5yPkPw= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=FuYhJcRsEANKO2wrKj9v/dx0BceTs 4MLE9f3oGgohck=; b=HB42xCcSo8RnaI6hEd1u/lGuvEOGHkc+2D26B99APrD+I DJMpCOpYu/8jzolgz4MAnXsX8YExcI+3SBtzhV4w5KGeL5blmwQtpufBlgIsJOpZ ClVI2K409CzTWgTBwsLFEnhkDS2YoahoXugzEa8j7ObR6JYN+Kh8XRLWSxdWm/xm ro+4lOI1NCE1GflU5wH7IncMTv6E1ZeKjk4tu7ZpXeZnCnzUuEQwIZ4V/jBU0b4D g+7DDu3GoFurLr7Ju/JxgSSQPuXDwab2Ea7GDmKQUwDypTHYJOdjJXuaf7CXh+Xr gUyYS2zQ20r0L1JcosgWySjwnaxzVEC0iV3dH6BTg== X-ME-Sender: X-ME-Proxy: From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 13:20:50 -0400 Message-Id: <20181025172057.20414-42-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025172057.20414-1-cota@braap.org> References: <20181025172057.20414-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC 41/48] configure: add --enable-plugins X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Llu=C3=ADs=20Vilanova?= , Pavel Dovgalyuk , Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Alex Benn=C3=A9e --- configure | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/configure b/configure index 03bf719ca7..78e86098e5 100755 --- a/configure +++ b/configure @@ -30,6 +30,7 @@ TMPO=3D"${TMPDIR1}/${TMPB}.o" TMPCXX=3D"${TMPDIR1}/${TMPB}.cxx" TMPE=3D"${TMPDIR1}/${TMPB}.exe" TMPMO=3D"${TMPDIR1}/${TMPB}.mo" +TMPTXT=3D"${TMPDIR1}/${TMPB}.txt" =20 rm -f config.log =20 @@ -477,6 +478,7 @@ libxml2=3D"" docker=3D"no" debug_mutex=3D"no" libpmem=3D"" +plugins=3D"no" =20 # cross compilers defaults, can be overridden with --cross-cc-ARCH cross_cc_aarch64=3D"aarch64-linux-gnu-gcc" @@ -1443,6 +1445,10 @@ for opt do ;; --disable-libpmem) libpmem=3Dno ;; + --enable-plugins) plugins=3D"yes" + ;; + --disable-plugins) plugins=3D"no" + ;; *) echo "ERROR: unknown option $opt" echo "Try '$0 --help' for more information" @@ -1633,6 +1639,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 =20 Optional features, enabled with --enable-FEATURE and disabled with --disable-FEATURE, default is enabled if available: @@ -5204,6 +5212,42 @@ if compile_prog "" "" ; then atomic64=3Dyes fi =20 +######################################### +# See if --dynamic-list is supported by the linker + +cat > $TMPTXT < $TMPC < +void foo(void); + +void foo(void) +{ + printf("foo\n"); +} + +int main(void) +{ + foo(); + return 0; +} +EOF + +if compile_prog "" "-Wl,--dynamic-list=3D$TMPTXT" ; then + ld_dynamic_list=3D"yes" +else + if test "$plugins" =3D "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 + ######################################## # See if 16-byte vector operations are supported. # Even without a vector unit the compiler may expand these. @@ -6091,6 +6135,7 @@ echo "VxHS block device $vxhs" echo "capstone $capstone" echo "docker $docker" echo "libpmem support $libpmem" +echo "plugin support $plugins" =20 if test "$sdl_too_old" =3D "yes"; then echo "-> Your SDL version is too old - please upgrade to have SDL support" @@ -6849,6 +6894,12 @@ if test "$libpmem" =3D "yes" ; then echo "CONFIG_LIBPMEM=3Dy" >> $config_host_mak fi =20 +if test "$plugins" =3D "yes" ; then + echo "CONFIG_PLUGINS=3Dy" >> $config_host_mak + LIBS=3D"-ldl $LIBS" + LDFLAGS=3D"-Wl,--dynamic-list=3D\$(SRC_PATH)/qemu-plugins.symbols $LDF= LAGS" +fi + if test "$tcg_interpreter" =3D "yes"; then QEMU_INCLUDES=3D"-iquote \$(SRC_PATH)/tcg/tci $QEMU_INCLUDES" elif test "$ARCH" =3D "sparc64" ; then --=20 2.17.1