From nobody Tue Feb 10 08:03:29 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1560534797; cv=none; d=zoho.com; s=zohoarc; b=eWWxZ6Ddms9/IyfhouGqUx2HTSo4tkVUQxvBVSLEelPgMWs7v+AW2ZvV1ZneoA1txHW1Z+PpgntbXm4/2pJIuv5G2lmKR7hfbqRNhrTv1LycRJUzveYcHX0lp1bZIBfysU+gfE8/NbFRpuah8cBWS6DeT8n3mP3dV58ST6OZG3s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560534797; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=gsafAaKWWEo4Uo36EmX0kTE77G4d03quI77xyI/6ztg=; b=ddFHGWLSmhtowORP4aiMywgW1SnOV/vYbfKWGKV8denDCixCxyy8hgFrVavw4SvOY+HQXAjMUdF8+CRn9FOEz/4cQmymBIm1I6WjIhJ+DgKez6sKi4dTpoztIZ1hs+w0qajp32nth96c+0Tv7wii7/QYun4rVmhCYNMDD67HlFE= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1560534797731408.93762898031775; Fri, 14 Jun 2019 10:53:17 -0700 (PDT) Received: from localhost ([::1]:53904 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbqO4-00072G-MC for importer@patchew.org; Fri, 14 Jun 2019 13:53:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34005) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbq0F-00075Y-Ba for qemu-devel@nongnu.org; Fri, 14 Jun 2019 13:28:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hbq0B-0003td-TX for qemu-devel@nongnu.org; Fri, 14 Jun 2019 13:28:37 -0400 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:33062) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hbq0A-0003kk-Ib for qemu-devel@nongnu.org; Fri, 14 Jun 2019 13:28:35 -0400 Received: by mail-wr1-x443.google.com with SMTP id n9so3385863wru.0 for ; Fri, 14 Jun 2019 10:28:30 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id b5sm3951472wru.69.2019.06.14.10.28.27 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 14 Jun 2019 10:28:27 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id D5B0E1FFBD; Fri, 14 Jun 2019 18:12:03 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gsafAaKWWEo4Uo36EmX0kTE77G4d03quI77xyI/6ztg=; b=zaCNsjX1Sklh9vJ7E9Ciq6mN5AED+FXPDKin3o4rpH9/iYlUeuUcdmMDAwAfkBPcCD vXTH3tB9meeGKyTLyf36QMweGwyE8CP8wypVMv5b/sgIVy6H6LII1DAniff5POyWPhIf VXyk3E8PQFAgt/85+vfDJHuT36bWIizc+SWn3ZxPdeSPgCnY5nPST/thWVKrZAaWs99b /jsyNFT/qXeeTQa9ZX8//sRsY8VWmjR3PHFn7R0/d2o/bJwbVyXZ4yeEitrqZeij3B1T YPrjft0KgWGk6A0rw6LU5rJJoHnPaz2ZH7KjjRbGe7aDKG7m1YnhGUwBqtlzLX2HE/Vz xcQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gsafAaKWWEo4Uo36EmX0kTE77G4d03quI77xyI/6ztg=; b=DQ0tSY5JsWuxXhX7nyBKz6pItMIUa6K4lS1HUxic/X8kbNmunnSOpOyQGGgUs2pcGS ZRymssa5o9rUYJk8sDRIBt/O+KLh6mWpHAKDkW3fvyQeHl8iwg01V3Akx5OXgi+aI6dQ LDEcce8NE5o5Lei6rGkhthlZuT2JXuQ+y1uAOSvXNVQ2JTb5DMmwHw+gFaL6Is0Glgfa jNU/mpR8QKS4JpBPCs70VMxdVd206WEPZLftsUKECWbojsg6OcD5qfCqE3/qsDpkTgA3 qCd/5s9cNDrYFzw0VSjy+w6nL1t+r5gJwHB3ELrxYb4eBNoR5IsLMzMAChhwvvsL7TjE Fxng== X-Gm-Message-State: APjAAAX9vQ6zdx2W/bTUcFAxaPKJs/CN7Tg+bVye5e2uyNi/JXRq+wxV QUnwm/fV80ETdhW0sMa6xnz0w2sMvig= X-Google-Smtp-Source: APXvYqzShaMTBTlWtca3XdE385bmHNBYE1HD2AUHWAB14uht18erwzmYwVRIHvACmmk+HHUVFTtD7A== X-Received: by 2002:a5d:4b4f:: with SMTP id w15mr8689164wrs.199.1560533309569; Fri, 14 Jun 2019 10:28:29 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Fri, 14 Jun 2019 18:11:48 +0100 Message-Id: <20190614171200.21078-39-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190614171200.21078-1-alex.bennee@linaro.org> References: <20190614171200.21078-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::443 Subject: [Qemu-devel] [PATCH v3 38/50] plugin: add API symbols to qemu-plugins.symbols X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Emilio G. Cota" , =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: "Emilio G. Cota" Signed-off-by: Emilio G. Cota [AJB: moved into plugins] Signed-off-by: Alex Benn=C3=A9e --- v3 - moved to plugins/ - include qemu_plugin_reset --- Makefile | 1 + configure | 69 ++++++++++++++++++++++++++++++++++++ plugins/.gitignore | 2 ++ plugins/Makefile.objs | 14 ++++++++ plugins/qemu-plugins.symbols | 35 ++++++++++++++++++ 5 files changed, 121 insertions(+) create mode 100644 plugins/.gitignore create mode 100644 plugins/qemu-plugins.symbols diff --git a/Makefile b/Makefile index 37d396ab88..f3f0c68e85 100644 --- a/Makefile +++ b/Makefile @@ -718,6 +718,7 @@ distclean: clean rm -f qemu-doc.fn qemu-doc.fns qemu-doc.info qemu-doc.ky qemu-doc.kys rm -f qemu-doc.log qemu-doc.pdf qemu-doc.pg qemu-doc.toc qemu-doc.tp rm -f qemu-doc.vr qemu-doc.txt + rm -f qemu-plugins-ld.symbols qemu-plugins-ld64.symbols rm -f config.log rm -f linux-headers/asm rm -f docs/version.texi diff --git a/configure b/configure index 48f3263e55..d3bf254191 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 @@ -5496,6 +5497,58 @@ 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 + +ld_dynamic_list=3D"no" +if compile_prog "" "-Wl,--dynamic-list=3D$TMPTXT" ; then + ld_dynamic_list=3D"yes" +fi + +######################################### +# See if -exported_symbols_list is supported by the linker + +cat > $TMPTXT <> $config_host_mak LIBS=3D"-ldl $LIBS" + # Copy the export object list to the build dir + if test "$ld_dynamic_list" =3D "yes" ; then + echo "CONFIG_HAS_LD_DYNAMIC_LIST=3Dyes" >> $config_host_mak + ld_symbols=3Dqemu-plugins-ld.symbols + cp "$source_path/plugins/qemu-plugins.symbols" $ld_symbols + elif test "$ld_exported_symbols_list" =3D "yes" ; then + echo "CONFIG_HAS_LD_EXPORTED_SYMBOLS_LIST=3Dyes" >> $config_host_mak + ld64_symbols=3Dqemu-plugins-ld64.symbols + echo "# Automatically generated by configure - do not modify" > $ld64_sym= bols + grep 'qemu_' "$source_path/plugins/qemu-plugins.symbols" | sed 's/;//g' |= \ + sed -E 's/^[[:space:]]*(.*)/_\1/' >> $ld64_symbols + else + error_exit \ + "If \$plugins=3Dyes, either \$ld_dynamic_list or " \ + "\$ld_exported_symbols_list should have been set to 'yes'." + fi fi =20 if test "$tcg_interpreter" =3D "yes"; then diff --git a/plugins/.gitignore b/plugins/.gitignore new file mode 100644 index 0000000000..7b8aaa1f10 --- /dev/null +++ b/plugins/.gitignore @@ -0,0 +1,2 @@ +qemu-plugins-ld.symbols +qemu-plugins-ld64.symbols diff --git a/plugins/Makefile.objs b/plugins/Makefile.objs index 95baabf3d2..6f14d91ccb 100644 --- a/plugins/Makefile.objs +++ b/plugins/Makefile.objs @@ -5,3 +5,17 @@ obj-y +=3D loader.o obj-y +=3D core.o obj-y +=3D api.o + +# Abuse -libs suffix to only link with --dynamic-list/-exported_symbols_li= st +# when the final binary includes the plugin object. +# +# Note that simply setting LDFLAGS is not enough: we build binaries that +# never link plugin.o, and the linker might fail (at least ld64 does) +# if the symbols in the list are not in the output binary. +ifdef CONFIG_HAS_LD_DYNAMIC_LIST +api.o-libs :=3D -Wl,--dynamic-list=3D$(BUILD_DIR)/qemu-plugins-ld.symbols +else +ifdef CONFIG_HAS_LD_EXPORTED_SYMBOLS_LIST +api.o-libs :=3D -Wl,-exported_symbols_list,$(BUILD_DIR)/qemu-plugins-ld64.= symbols +endif +endif diff --git a/plugins/qemu-plugins.symbols b/plugins/qemu-plugins.symbols new file mode 100644 index 0000000000..38d47b7922 --- /dev/null +++ b/plugins/qemu-plugins.symbols @@ -0,0 +1,35 @@ +{ + qemu_plugin_uninstall; + qemu_plugin_reset; + qemu_plugin_register_vcpu_init_cb; + qemu_plugin_register_vcpu_exit_cb; + qemu_plugin_register_vcpu_idle_cb; + qemu_plugin_register_vcpu_resume_cb; + qemu_plugin_register_vcpu_insn_exec_cb; + qemu_plugin_register_vcpu_insn_exec_inline; + qemu_plugin_register_vcpu_mem_cb; + qemu_plugin_register_vcpu_mem_haddr_cb; + qemu_plugin_register_vcpu_mem_inline; + qemu_plugin_ram_addr_from_host; + qemu_plugin_register_vcpu_tb_trans_cb; + qemu_plugin_register_vcpu_tb_exec_cb; + qemu_plugin_register_vcpu_tb_exec_inline; + qemu_plugin_register_flush_cb; + qemu_plugin_register_vcpu_syscall_cb; + qemu_plugin_register_vcpu_syscall_ret_cb; + qemu_plugin_register_atexit_cb; + qemu_plugin_tb_n_insns; + qemu_plugin_tb_get_insn; + qemu_plugin_tb_vaddr; + qemu_plugin_insn_data; + qemu_plugin_insn_size; + qemu_plugin_insn_vaddr; + qemu_plugin_insn_haddr; + qemu_plugin_mem_size_shift; + qemu_plugin_mem_is_sign_extended; + qemu_plugin_mem_is_big_endian; + qemu_plugin_mem_is_store; + qemu_plugin_vcpu_for_each; + qemu_plugin_n_vcpus; + qemu_plugin_n_max_vcpus; +}; --=20 2.20.1