• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revisione219c499e9f5d4fa0e25dc07682f75531ee84d86 (tree)
Time2017-10-26 18:56:20
AuthorRichard Henderson <richard.henderson@lina...>
CommiterRichard Henderson

Log Message

disas: Add capstone as submodule

Do not require the submodule, but use it if present. Allow the
command-line to override system or git submodule either way.

Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

Change Summary

Incremental Difference

--- a/.gitmodules
+++ b/.gitmodules
@@ -37,3 +37,6 @@
3737 [submodule "ui/keycodemapdb"]
3838 path = ui/keycodemapdb
3939 url = git://git.qemu.org/keycodemapdb.git
40+[submodule "capstone"]
41+ path = capstone
42+ url = git://git.qemu.org/capstone.git
--- a/Makefile
+++ b/Makefile
@@ -383,6 +383,21 @@ subdir-dtc: .git-submodule-status dtc/libfdt dtc/tests
383383 dtc/%: .git-submodule-status
384384 mkdir -p $@
385385
386+# Overriding CFLAGS causes us to lose defines added in the sub-makefile.
387+# Not overriding CFLAGS leads to mis-matches between compilation modes.
388+# Therefore we replicate some of the logic in the sub-makefile.
389+# Remove all the extra -Warning flags that QEMU uses that Capstone doesn't;
390+# no need to annoy QEMU developers with such things.
391+CAP_CFLAGS = $(patsubst -W%,,$(CFLAGS) $(QEMU_CFLAGS))
392+CAP_CFLAGS += -DCAPSTONE_USE_SYS_DYN_MEM
393+CAP_CFLAGS += -DCAPSTONE_HAS_ARM
394+CAP_CFLAGS += -DCAPSTONE_HAS_ARM64
395+CAP_CFLAGS += -DCAPSTONE_HAS_POWERPC
396+CAP_CFLAGS += -DCAPSTONE_HAS_X86
397+
398+subdir-capstone: .git-submodule-status
399+ $(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))
400+
386401 $(SUBDIR_RULES): libqemuutil.a $(common-obj-y) $(chardev-obj-y) \
387402 $(qom-obj-y) $(crypto-aes-obj-$(CONFIG_USER_ONLY))
388403
--- /dev/null
+++ b/capstone
@@ -0,0 +1 @@
1+Subproject commit 22ead3e0bfdb87516656453336160e0a37b066bf
--- a/configure
+++ b/configure
@@ -1299,6 +1299,10 @@ for opt do
12991299 ;;
13001300 --enable-capstone) capstone="yes"
13011301 ;;
1302+ --enable-capstone=git) capstone="git"
1303+ ;;
1304+ --enable-capstone=system) capstone="system"
1305+ ;;
13021306 *)
13031307 echo "ERROR: unknown option $opt"
13041308 echo "Try '$0 --help' for more information"
@@ -4419,18 +4423,54 @@ fi
44194423 ##########################################
44204424 # capstone
44214425
4422-if test "$capstone" != no; then
4423- if $pkg_config capstone; then
4424- capstone=yes
4426+case "$capstone" in
4427+ "" | yes)
4428+ if $pkg_config capstone; then
4429+ capstone=system
4430+ elif test -e "${source_path}/.git" ; then
4431+ capstone=git
4432+ elif test -e "${source_path}/capstone/Makefile" ; then
4433+ capstone=internal
4434+ elif test -z "$capstone" ; then
4435+ capstone=no
4436+ else
4437+ feature_not_found "capstone" "Install capstone devel or git submodule"
4438+ fi
4439+ ;;
4440+
4441+ system)
4442+ if ! $pkg_config capstone; then
4443+ feature_not_found "capstone" "Install capstone devel"
4444+ fi
4445+ ;;
4446+esac
4447+
4448+case "$capstone" in
4449+ git | internal)
4450+ if test "$capstone" = git; then
4451+ git_submodules="${git_submodules} capstone"
4452+ fi
4453+ mkdir -p capstone
4454+ QEMU_CFLAGS="$QEMU_CFLAGS -I\$(SRC_PATH)/capstone/include"
4455+ if test "$mingw32" = "yes"; then
4456+ LIBCAPSTONE=capstone.lib
4457+ else
4458+ LIBCAPSTONE=libcapstone.a
4459+ fi
4460+ LIBS="-L\$(BUILD_DIR)/capstone -lcapstone $LIBS"
4461+ ;;
4462+
4463+ system)
44254464 QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags capstone)"
44264465 LIBS="$($pkg_config --libs capstone) $LIBS"
4427- else
4428- if test "$capstone" = yes; then
4429- feature_not_found capstone
4430- fi
4431- capstone=no
4432- fi
4433-fi
4466+ ;;
4467+
4468+ no)
4469+ ;;
4470+ *)
4471+ error_exit "Unknown state for capstone: $capstone"
4472+ ;;
4473+esac
44344474
44354475 ##########################################
44364476 # check if we have fdatasync
@@ -6165,7 +6205,7 @@ fi
61656205 if test "$ivshmem" = "yes" ; then
61666206 echo "CONFIG_IVSHMEM=y" >> $config_host_mak
61676207 fi
6168-if test "$capstone" = "yes" ; then
6208+if test "$capstone" != "no" ; then
61696209 echo "CONFIG_CAPSTONE=y" >> $config_host_mak
61706210 fi
61716211
@@ -6650,6 +6690,12 @@ done # for target in $targets
66506690 if [ "$dtc_internal" = "yes" ]; then
66516691 echo "config-host.h: subdir-dtc" >> $config_host_mak
66526692 fi
6693+if [ "$capstone" = "git" -o "$capstone" = "internal" ]; then
6694+ echo "config-host.h: subdir-capstone" >> $config_host_mak
6695+fi
6696+if test -n "$LIBCAPSTONE"; then
6697+ echo "LIBCAPSTONE=$LIBCAPSTONE" >> $config_host_mak
6698+fi
66536699
66546700 if test "$numa" = "yes"; then
66556701 echo "CONFIG_NUMA=y" >> $config_host_mak