From patchwork Thu Sep 28 16:54:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 114461 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp970543qgf; Thu, 28 Sep 2017 10:01:32 -0700 (PDT) X-Received: by 10.200.3.224 with SMTP id z32mr2007036qtg.72.1506618092799; Thu, 28 Sep 2017 10:01:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506618092; cv=none; d=google.com; s=arc-20160816; b=g9tm4swN4Vav7X5nfdEaTTy5sPRcPYA0DtRXJObeOgbqYI7gyWPO6sX4wbdRm9za0p HYW79TBhbqEqYpIF0HQDfuaY7S92FcJbj1Tf4NuQ/K/fNoiThUudOOiXYnNKi3BuBNyr oAksGJEacX5uvTlK7WzpWn3+I6BrqlwFFl8TuKbK1c3TIt3nM0EcTCvU3C3KQv10nDi0 vpcddy29WxMVsbeJqXzCxWcZmqSgO8OlrRKYbJx7E6n9JjovGe1CMWEynvK3Bv7hnEut nug6+GHIyZ5HEDsYw6EiQvsiSDelzGEMKKQtyLkXAld2+nDT6g+N5ORl9fjq48cPGaRq XYMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=rtO+7PUY+56gNCtBBrSx0thDFP88peTeC2ycBgtfk18=; b=zcaSte8xORib2d7QDOj55ek4lR1NnKn1x2MBOyolqKRHne/moIZanFWgFv3uw17WHv 2eLszjynuPdl7LukgcJZ7NfDmMwCjCmZ8E7b5n/sc4oU5PtHP4TguiEJgEftyFNjDxTw pHZRalQhpYm/G0EISYy5a7AxwJ7FA0tW8LOY78Ppgqc11+u3xF5TNQodxJztChlWfYgf ++SfoBjmYcuzFQfjsI4opWrrgygYSwCv0GZ12KtD24TJTewWu2bVUGQctAvMNOFH9V4n QRpS96fRrqhnlm97s+m+3VY6N7anXli3+5TS09nYlgBSDIqFWznzjeH3ScSgXXKbv9eu 95zQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=gtpxm22n; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id u79si231366qkl.475.2017.09.28.10.01.32 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 28 Sep 2017 10:01:32 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=gtpxm22n; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:60087 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dxcBm-0001qA-AZ for patch@linaro.org; Thu, 28 Sep 2017 13:01:30 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55413) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dxc56-0004vQ-C4 for qemu-devel@nongnu.org; Thu, 28 Sep 2017 12:54:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dxc52-0004Ot-CP for qemu-devel@nongnu.org; Thu, 28 Sep 2017 12:54:36 -0400 Received: from mail-pg0-x236.google.com ([2607:f8b0:400e:c05::236]:46058) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dxc52-0004OZ-5s for qemu-devel@nongnu.org; Thu, 28 Sep 2017 12:54:32 -0400 Received: by mail-pg0-x236.google.com with SMTP id 188so1258341pgb.2 for ; Thu, 28 Sep 2017 09:54:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=rtO+7PUY+56gNCtBBrSx0thDFP88peTeC2ycBgtfk18=; b=gtpxm22n/gMMqXu7t+CxWyl1nWHpnymYTHFA4JjBfhrcLN7Gr3iCGfUKFa7zIRMqiI JqJoajGtQdVtYokAZmxcti4xCQYBQjUfb3WAvlhnD17kUDCbmkL+MwwtphgE7CCKRkmh wlIz+RGgKIPXew7uj6Uk/dAWiAWqlePOS5iHM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=rtO+7PUY+56gNCtBBrSx0thDFP88peTeC2ycBgtfk18=; b=YIqFlaN4aqth6HQ5tLbTSTRSOJXC/PGHKM0/aTOOmwOQ7irY+kPhYMoaSVirZ1nwsd U+5PoAqvJGMC6ro/+SoXb1AnlH8T6x28DSIVsA6NrtkpZPJ/HZv3N+As68Rh9Zc+V1Ov cdkHT/KsU5tQ9zXI6fVpwgVvmhw9yWy5r2NYjCUnoOZfXAth9t52HoGPzam2GFUVSRHk kNh24KG+eBoH6udo8GK2nsLevbgLcGd93D/s9x3Xc/r7ldhuJMWzjdk4pUxOUnFN2JI5 79mSKk99Cwl+EBNqeTMCLTnq/x+mUtUjQtKTNqcBtjw6oW8gEx6PaED5nt6sJQ3KKP0O nBDQ== X-Gm-Message-State: AHPjjUjOHX6+ebZVywjBWqRHmaoo2RBd1r6LtBxeu4Vjk5zdI/nuOV8/ PSCuc05hIRZO0Bbm1HCmiLI1Xd8kdis= X-Google-Smtp-Source: AOwi7QAlRUyGOUdP6OgPG5fxL5RJkS1ML7W4YMFfyCL3Sl5IC7uYvulJap7oNuElPnbiqPtpKY7ELw== X-Received: by 10.101.81.10 with SMTP id f10mr4699354pgq.82.1506617670585; Thu, 28 Sep 2017 09:54:30 -0700 (PDT) Received: from bigtime.twiddle.net ([70.35.39.2]) by smtp.gmail.com with ESMTPSA id e133sm3062332pfh.177.2017.09.28.09.54.29 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 28 Sep 2017 09:54:29 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 28 Sep 2017 09:54:14 -0700 Message-Id: <20170928165414.7339-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170928165414.7339-1-richard.henderson@linaro.org> References: <20170928165414.7339-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c05::236 Subject: [Qemu-devel] [PATCH v4 9/9] disas: Add capstone as submodule 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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Do not require the submodule, but use it if present (in preference even to a system copy). This will allow us to easily use capstone in older systems for which a package is not available, and also easily track bug fixes from upstream. Signed-off-by: Richard Henderson --- Makefile | 13 +++++++++++++ .gitmodules | 3 +++ capstone | 1 + configure | 12 +++++++++++- 4 files changed, 28 insertions(+), 1 deletion(-) create mode 160000 capstone -- 2.13.5 Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Reviewed-by: Alex Bennée diff --git a/Makefile b/Makefile index cee6e28659..7ff366f6ca 100644 --- a/Makefile +++ b/Makefile @@ -336,6 +336,19 @@ subdir-dtc:dtc/libfdt dtc/tests dtc/%: mkdir -p $@ +# Overriding CFLAGS causes us to lose defines added in the sub-makefile. +# Not overriding CFLAGS leads to mis-matches between compilation modes. +# Therefore we replicate some of the logic in the sub-makefile. +CAP_CFLAGS = $(subst -Werror,,$(CFLAGS) $(QEMU_CFLAGS)) +CAP_CFLAGS += -DCAPSTONE_USE_SYS_DYN_MEM +CAP_CFLAGS += -DCAPSTONE_HAS_ARM +CAP_CFLAGS += -DCAPSTONE_HAS_ARM64 +CAP_CFLAGS += -DCAPSTONE_HAS_POWERPC +CAP_CFLAGS += -DCAPSTONE_HAS_X86 + +subdir-capstone: + $(call quiet-command,$(MAKE) -C $(SRC_PATH)/capstone CAPSTONE_SHARED=no BUILDDIR="$(BUILD_DIR)/capstone" CC="$(CC)" AR="$(AR)" LD="$(LD)" CFLAGS="$(CAP_CFLAGS)" $(SUBDIR_MAKEFLAGS) $(BUILD_DIR)/capstone/libcapstone.a) + $(SUBDIR_RULES): libqemuutil.a $(common-obj-y) $(chardev-obj-y) \ $(qom-obj-y) $(crypto-aes-obj-$(CONFIG_USER_ONLY)) diff --git a/.gitmodules b/.gitmodules index 84c54cdc49..bcb80d701a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -34,3 +34,6 @@ [submodule "roms/QemuMacDrivers"] path = roms/QemuMacDrivers url = git://git.qemu.org/QemuMacDrivers.git +[submodule "capstone"] + path = capstone + url = https://github.com/aquynh/capstone.git diff --git a/capstone b/capstone new file mode 160000 index 0000000000..a279481dbf --- /dev/null +++ b/capstone @@ -0,0 +1 @@ +Subproject commit a279481dbfd54bb1e2336d771e89978cc6d43176 diff --git a/configure b/configure index 3777db91b6..a6cf0a5a15 100755 --- a/configure +++ b/configure @@ -4380,7 +4380,14 @@ fi # capstone if test "$capstone" != no; then - if $pkg_config capstone; then + if test -f ${source_path}/capstone/Makefile ; then + # have submodule capstone - use it + capstone=yes + capstone_internal=yes + mkdir -p capstone + QEMU_CFLAGS="$QEMU_CFLAGS -I\$(SRC_PATH)/capstone/include" + LIBS="\$(BUILD_DIR)/capstone/libcapstone.a $LIBS" + elif $pkg_config capstone; then capstone=yes QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags capstone)" LIBS="$($pkg_config --libs capstone) $LIBS" @@ -6596,6 +6603,9 @@ done # for target in $targets if [ "$dtc_internal" = "yes" ]; then echo "config-host.h: subdir-dtc" >> $config_host_mak fi +if [ "$capstone_internal" = "yes" ]; then + echo "config-host.h: subdir-capstone" >> $config_host_mak +fi if test "$numa" = "yes"; then echo "CONFIG_NUMA=y" >> $config_host_mak