Skip to contentSkip to conversation

Capstone updates

GIT PULL Applied Richard Henderson 3 participants 5 messages Nov 9, 2017 – Nov 13, 2017 Kbuild

lore
Share & tools
lore
#0 lore raw

One build fix for mingw cross-compiling, one feature regression fix.

r~

The following changes since commit b0fbe46ad82982b289a44ee2495b59b0bad8a842:

Update version for v2.11.0-rc0 release (2017-11-07 16:05:28 +0000)

are available in the git repository at:

git://github.com/rth7680/qemu.git tags/pull-cap-20171109

for you to fetch changes up to 9f81aeb5dadab588920b157a4610e890995ef4b9:

Makefile: Capstone: Add support for cross compile ranlib (2017-11-09 08:47:14 +0100)

----------------------------------------------------------------
Capstone fixes for 2.11

----------------------------------------------------------------
Alistair Francis (1):
Makefile: Capstone: Add support for cross compile ranlib

Richard Henderson (1):
disas: Dump insn bytes along with capstone disassembly

 Makefile            |  2 +-
 include/disas/bfd.h |  2 ++
 disas.c             | 96 ++++++++++++++++++++++++++++++++++++++++++++++-------
 target/arm/cpu.c    |  6 ++++
 target/i386/cpu.c   |  2 ++
 configure           |  3 ++
 6 files changed, 98 insertions(+), 13 deletions(-)
#1 lore raw

[Qemu-devel] [PULL 1/2] disas: Dump insn bytes along with capstone disassembly

This feature is present for some targets in the bfd disassembler(s). Implement it generically for all capstone users.

---
 include/disas/bfd.h |  2 ++
 disas.c             | 96 ++++++++++++++++++++++++++++++++++++++++++++++-------
 target/arm/cpu.c    |  6 ++++
 target/i386/cpu.c   |  2 ++
 4 files changed, 94 insertions(+), 12 deletions(-)
include/disas/bfd.h +2 -0
index 1f88c9e9d5..46c7ec3376 100644
@@ -374,6 +374,8 @@ typedef struct disassemble_info {
   /* Options for Capstone disassembly.  */
   int cap_arch;
   int cap_mode;
+  int cap_insn_unit;
+  int cap_insn_split;
 
 } disassemble_info;
 
disas.c +84 -12

149 lines not on this page · raw message

target/arm/cpu.c +6 -0
index 47c8b2a85c..7f7a3d1e32 100644
@@ -489,13 +489,19 @@ static void arm_disas_set_info(CPUState *cpu, disassemble_info *info)
         info->print_insn = print_insn_arm_a64;
 #endif
         info->cap_arch = CS_ARCH_ARM64;
+        info->cap_insn_unit = 4;
+        info->cap_insn_split = 4;
     } else {
         int cap_mode;
         if (env->thumb) {
             info->print_insn = print_insn_thumb1;
+            info->cap_insn_unit = 2;
+            info->cap_insn_split = 4;
             cap_mode = CS_MODE_THUMB;
         } else {
             info->print_insn = print_insn_arm;
+            info->cap_insn_unit = 4;
+            info->cap_insn_split = 4;
             cap_mode = CS_MODE_ARM;
         }
         if (arm_feature(env, ARM_FEATURE_V8)) {
target/i386/cpu.c +2 -0
index 6f21a5e518..1edcf29e27 100644
@@ -4109,6 +4109,8 @@ static void x86_disas_set_info(CPUState *cs, disassemble_info *info)
     info->cap_mode = (env->hflags & HF_CS64_MASK ? CS_MODE_64
                       : env->hflags & HF_CS32_MASK ? CS_MODE_32
                       : CS_MODE_16);
+    info->cap_insn_unit = 1;
+    info->cap_insn_split = 8;
 }
 
 static Property x86_cpu_properties[] = {
Signature · 1 line
2.13.6
#2 lore raw

[Qemu-devel] [PULL 2/2] Makefile: Capstone: Add support for cross compile ranlib

In reply to Richard Henderson

From: Alistair Francis <[email protected]>

When cross compiling QEMU for Windows we need to specify the cross version of ranlib to avoid build errors when building capstone. This patch ensures we use the same cross prefix on ranlib as other toolchain components.

- Fedora23 mingw
- RHEL-7.2 with mingw packages from epel:

LINK qemu-img.exe
build-win64/capstone/capstone.lib: error adding symbols: Archive has no
index; run ranlib to add one
collect2: error: ld returned 1 exit status

$ x86_64-w64-mingw32-ar --version
GNU ar (GNU Binutils) 2.25

Message-Id: <e457d4e906dceea4de6c3431813a06b137c1ab9c.1510103351.git.alistair.francis@xilinx.com>

---
 Makefile  | 2 +-
 configure | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)
Makefile +1 -1
index 0496c5057a..814f6820d9 100644
@@ -405,7 +405,7 @@ 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))
+	$(call quiet-command,$(MAKE) -C $(SRC_PATH)/capstone CAPSTONE_SHARED=no BUILDDIR="$(BUILD_DIR)/capstone" CC="$(CC)" AR="$(AR)" LD="$(LD)" RANLIB="$(RANLIB)" CFLAGS="$(CAP_CFLAGS)" $(SUBDIR_MAKEFLAGS) $(BUILD_DIR)/capstone/$(LIBCAPSTONE))
 
 $(SUBDIR_RULES): libqemuutil.a $(common-obj-y) $(chardev-obj-y) \
 	$(qom-obj-y) $(crypto-aes-obj-$(CONFIG_USER_ONLY))
configure +3 -0
index a6055c0710..0e856bbc04 100755
@@ -482,6 +482,7 @@ ccas="${CCAS-$cc}"
 cpp="${CPP-$cc -E}"
 objcopy="${OBJCOPY-${cross_prefix}objcopy}"
 ld="${LD-${cross_prefix}ld}"
+ranlib="${RANLIB-${cross_prefix}ranlib}"
 nm="${NM-${cross_prefix}nm}"
 strip="${STRIP-${cross_prefix}strip}"
 windres="${WINDRES-${cross_prefix}windres}"
@@ -6288,6 +6289,7 @@ echo "CCAS=$ccas" >> $config_host_mak
 echo "CPP=$cpp" >> $config_host_mak
 echo "OBJCOPY=$objcopy" >> $config_host_mak
 echo "LD=$ld" >> $config_host_mak
+echo "RANLIB=$ranlib" >> $config_host_mak
 echo "NM=$nm" >> $config_host_mak
 echo "WINDRES=$windres" >> $config_host_mak
 echo "CFLAGS=$CFLAGS" >> $config_host_mak
@@ -6782,6 +6784,7 @@ for rom in seabios vgabios ; do
     echo "OBJCOPY=objcopy" >> $config_mak
     echo "IASL=$iasl" >> $config_mak
     echo "LD=$ld" >> $config_mak
+    echo "RANLIB=$ranlib" >> $config_mak
 done
 
 # set up tests data directory
Signature · 1 line
2.13.6
#3 lore raw
In reply to Richard Henderson
This series seems to have some coding style problems. See output below for more information:

Hi,

This series seems to have some coding style problems. See output below for more information:

Subject: [Qemu-devel] [PULL for-2.11 0/2] Capstone updates
Type: series
Message-id: [email protected]

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

git config --local diff.renamelimit 0
git config --local diff.renames True

commits="$(git log --format=%H --reverse $BASE..)" for c in $commits; do

    echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))

done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
* [new tag] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'
7202d02907 Makefile: Capstone: Add support for cross compile ranlib c6dc01dedb disas: Dump insn bytes along with capstone disassembly

=== OUTPUT BEGIN ===
Checking PATCH 1/2: disas: Dump insn bytes along with capstone disassembly...
ERROR: suspect code indent for conditional statements (8, 11) #98: FILE: disas.c:315:

         while (cs_disasm_iter(handle, &cbuf, &csize, &pc, insn)) {

+ cap_dump_insn(info, insn);

ERROR: suspect code indent for conditional statements (4, 7) #110: FILE: disas.c:360:

     while (cs_disasm_iter(handle, &cbuf, &size, &pc, insn)) {

+ cap_dump_insn(info, insn);

total: 2 errors, 0 warnings, 184 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.

Checking PATCH 2/2: Makefile: Capstone: Add support for cross compile ranlib... === OUTPUT END ===

Test command exited with code: 1

---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]

#4 lore raw
In reply to Richard Henderson
Quoted 21 lines · Richard Henderson

One build fix for mingw cross-compiling, one feature regression fix.

r~

The following changes since commit b0fbe46ad82982b289a44ee2495b59b0bad8a842:

Update version for v2.11.0-rc0 release (2017-11-07 16:05:28 +0000)

are available in the git repository at:

git://github.com/rth7680/qemu.git tags/pull-cap-20171109

for you to fetch changes up to 9f81aeb5dadab588920b157a4610e890995ef4b9:

Makefile: Capstone: Add support for cross compile ranlib (2017-11-09 08:47:14 +0100)

----------------------------------------------------------------
Capstone fixes for 2.11

Quoted 7 lines

----------------------------------------------------------------
Alistair Francis (1):
Makefile: Capstone: Add support for cross compile ranlib

Richard Henderson (1):
disas: Dump insn bytes along with capstone disassembly

Applied, thanks.

-- PMM