From patchwork Tue Oct 17 15:37:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 116141 Delivered-To: patch@linaro.org Received: by 10.80.163.170 with SMTP id s39csp1376975edb; Tue, 17 Oct 2017 08:45:49 -0700 (PDT) X-Received: by 10.55.76.85 with SMTP id z82mr10664429qka.183.1508255149283; Tue, 17 Oct 2017 08:45:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508255149; cv=none; d=google.com; s=arc-20160816; b=arG2oANySHUV+lDnKYrRZyftnPKNeePzdO8LP/1c46LkgC6vdLZjIld4aNEtL1h8c9 /7znrBZV11iOSyq39eU6AZCF2dmBY37K6bZV4dsuY6YrkYi7ymVujJX0XGWdv6V6E+pj j+X8mwHUvrhc1Hl3F0Bh0TkrjfdYe+cTTkx1+GzSTvj6y/g9aULPDNqg68RG3Cn6CpJr JLtgI6m5VEHAl1pSjjVBGIp3IP1niRxZELqMi3na/thbl4z0xCIS66b28HC6FH/c55Ve kIKvnJCDgWL5Gfke1E9eEvy2jul9ar7GQedHQUqvM3fuK+3i3AHQJ0kSEqlxrg32RLg4 H4gA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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=IhrehGFXNdn1g4MNkKTsmaTJS+p2x52QVd3uxxOAr/A=; b=sXUqTluS/gBwPL5pQdsUd8RqN4I00jjd6fNVwEBnN4ZhqyE7IvI07p1ESzr4xr7aqw nJBs+aTEaNBkpoMtg9TiWctCJPJaqMVEwssDT6m2Ku/6qMC0GlYKmuC+6LaYtpwQhYwD QJ6K8ePpRwBamqOt0YMHZ5vBU+kMWGSxCUZxJIdTHKabJ4CqxkPPHEaJjWUy3shO/iJp GV9v/+CSvyNCdjFRk9LYIO8+ZJf6fGuPdv0nnFYlvjHlgNvasfiRSkIQr+umbOev7DGX jCQMH0Kx60iTSmXjzVh+VJkGVAbaWka/RakuLhAJ0xU6srOggHo5EEBaUsc3a6cy1d0I SOvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Geryctda; 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 z21si747923qkg.294.2017.10.17.08.45.48 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 17 Oct 2017 08:45:49 -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=Geryctda; 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]:40121 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4U3v-0001lD-0o for patch@linaro.org; Tue, 17 Oct 2017 11:45:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55200) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4TwN-0004L4-Vl for qemu-devel@nongnu.org; Tue, 17 Oct 2017 11:38:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e4TwM-0005wx-Tx for qemu-devel@nongnu.org; Tue, 17 Oct 2017 11:37:59 -0400 Received: from mail-pf0-x232.google.com ([2607:f8b0:400e:c00::232]:46979) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e4TwM-0005vK-O3 for qemu-devel@nongnu.org; Tue, 17 Oct 2017 11:37:58 -0400 Received: by mail-pf0-x232.google.com with SMTP id p87so1615909pfj.3 for ; Tue, 17 Oct 2017 08:37:58 -0700 (PDT) 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; bh=IhrehGFXNdn1g4MNkKTsmaTJS+p2x52QVd3uxxOAr/A=; b=GeryctdaIeQjtYrnoEAGYAetUoCe2D4gdtTneWQP2RxIwJa5LU0pOeqrkzr4nYEsH2 QW7DG1s5mY5CX9cU2xYoe0/JHkPHFAvovHqT86qrmRWJQVoa1C79GJW1XtP3LgRQR6hC G2PX3qmXvq0e1a9Tti6+vulK/5dziOAYxM1gA= 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; bh=IhrehGFXNdn1g4MNkKTsmaTJS+p2x52QVd3uxxOAr/A=; b=tIBEbWKTGqWIlH4yk/zkNs5Fe0Z3aJAajIBkOQuQc6ZWN9R3RvNxnkPHd31W/awQPF TBG1JgncDJsQcVQLRAlVuTcwAqEWV2FehDpbzwn6hLZqDHJ9HUtzAEkNxIqxU7iAUEue jsiAu5eLW1rCV4ONrvRL+fjYACzEEvptw/b7eKa4JTdZnLVHaOgz6fEJmaiB5rB4V+Nd bUlf0JPtM4Wxpf4I9Aw+gQnUYCqMx2rHtiO9H5zt6UgK4FzMvpoksrdoieHUwqkie38j IluJtykJbSFx5BEXkwHkYpHQqMk1q7pty/SVLxFSEUbT+xGxuhwxCYUawZCz/K5j/UvX QO8A== X-Gm-Message-State: AMCzsaWmyA2RKOq6kH30V4IivNJwRVxZIj/XpCwMjxZrdVP0wSyeLXfv k3iIzYn1lxK3nFxT3D6nIdAqfN2dswY= X-Google-Smtp-Source: AOwi7QDEcyvkA3RhdVqLze5qC5NXmCGbPzyNlYv/yDg/mEIMkRCasmCLEUbPyLgy9I8LLN3t4X6ExA== X-Received: by 10.99.95.203 with SMTP id t194mr9406426pgb.318.1508254677247; Tue, 17 Oct 2017 08:37:57 -0700 (PDT) Received: from cloudburst.twiddle.net (97-126-104-76.tukw.qwest.net. [97.126.104.76]) by smtp.gmail.com with ESMTPSA id y84sm20094415pff.158.2017.10.17.08.37.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 17 Oct 2017 08:37:56 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 17 Oct 2017 08:37:42 -0700 Message-Id: <20171017153742.10026-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171017153742.10026-1-richard.henderson@linaro.org> References: <20171017153742.10026-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:c00::232 Subject: [Qemu-devel] [PATCH v5 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: , Cc: Gerd Hoffmann 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. Cc: Gerd Hoffmann Signed-off-by: Richard Henderson --- Makefile | 13 +++++++++++++ .gitmodules | 3 +++ capstone | 1 + configure | 13 ++++++++++++- 4 files changed, 29 insertions(+), 1 deletion(-) create mode 160000 capstone -- 2.13.6 diff --git a/Makefile b/Makefile index 90f91e54eb..ca5eb489b0 100644 --- a/Makefile +++ b/Makefile @@ -383,6 +383,19 @@ subdir-dtc: .git-submodule-status 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: .git-submodule-status + $(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 7c981a42b6..1500579638 100644 --- a/.gitmodules +++ b/.gitmodules @@ -37,3 +37,6 @@ [submodule "ui/keycodemapdb"] path = ui/keycodemapdb url = git://git.qemu.org/keycodemapdb.git +[submodule "capstone"] + path = capstone + url = git://git.qemu.org/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 11e3078936..5a305c0a69 100755 --- a/configure +++ b/configure @@ -4412,7 +4412,15 @@ fi # capstone if test "$capstone" != no; then - if $pkg_config capstone; then + # have GIT checkout, so activate capstone submodule + if test -e "${source_path}/.git" ; then + git_submodules="${git_submodules} capstone" + 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" @@ -6642,6 +6650,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