From 3ff41f043a3936462401c0ede6879b1a5ef7ee46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= Date: Mon, 10 Jul 2023 16:15:54 +0100 Subject: [PATCH 01/10] capstone: update to 5.0. --- common/shlibs | 2 +- srcpkgs/capstone/template | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/common/shlibs b/common/shlibs index 4b2122d1b199..3bc4258061ad 100644 --- a/common/shlibs +++ b/common/shlibs @@ -2129,7 +2129,7 @@ libopenjpeg.so.5 libopenjpeg-1.5.2_1 liboping.so.0 liboping-1.8.0_1 libloudmouth-1.so.0 loudmouth-1.5.3_12 libtorrent-rasterbar.so.10 libtorrent-rasterbar-1.2.18_1 -libcapstone.so.4 capstone-4.0_1 +libcapstone.so.5 capstone-5.0_1 libhavege.so.2 libhaveged-1.9.11_1 libnih.so.1 libnih-1.0.3_1 libnih-dbus.so.1 libnih-1.0.3_1 diff --git a/srcpkgs/capstone/template b/srcpkgs/capstone/template index 99c20894520b..e4c157effe2c 100644 --- a/srcpkgs/capstone/template +++ b/srcpkgs/capstone/template @@ -1,16 +1,17 @@ # Template file for 'capstone' pkgname=capstone -version=4.0.2 -revision=5 +version=5.0 +revision=1 build_style=gnu-makefile make_use_env=yes hostmakedepends="python3-setuptools" short_desc="Lightweight multi-platform, multi-architecture disassembly framework" -maintainer="Orphaned " +maintainer="André Cerqueira " license="BSD-2-Clause" homepage="https://www.capstone-engine.org/" -distfiles="https://github.com/aquynh/${pkgname}/archive/${version}.tar.gz" -checksum=7c81d798022f81e7507f1a60d6817f63aa76e489aa4e7055255f21a22f5e526a +changelog="https://raw.githubusercontent.com/capstone-engine/capstone/next/ChangeLog" +distfiles="https://github.com/aquynh/capstone/archive/${version}.tar.gz" +checksum=df24344407baa7415eeb006f742afc9b92cd33abf2c4c120a6e97cfb376882dc post_install() { make -C bindings/python PREFIX=/usr DESTDIR=${DESTDIR} install3 From 860ae5e0be7308c787bfd57d083d9c2ec4d3c213 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= Date: Mon, 10 Jul 2023 16:06:58 +0100 Subject: [PATCH 02/10] bloaty: rebuild for capstone-5.0. --- srcpkgs/bloaty/template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/srcpkgs/bloaty/template b/srcpkgs/bloaty/template index 226d2f30ffcd..2a79fb502f99 100644 --- a/srcpkgs/bloaty/template +++ b/srcpkgs/bloaty/template @@ -1,7 +1,7 @@ # Template file for 'bloaty' pkgname=bloaty version=1.1 -revision=11 +revision=12 build_style=cmake hostmakedepends="pkg-config protobuf" makedepends="capstone-devel protobuf-devel re2-devel zlib-devel" From ac66e6b1f1a6cfdd3c819a0bba56f2a87b1d7a15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= Date: Mon, 10 Jul 2023 16:06:58 +0100 Subject: [PATCH 03/10] boomerang: rebuild for capstone-5.0. --- srcpkgs/boomerang/template | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/srcpkgs/boomerang/template b/srcpkgs/boomerang/template index 4c64c6ba3d6a..92cd85b4076a 100644 --- a/srcpkgs/boomerang/template +++ b/srcpkgs/boomerang/template @@ -1,13 +1,12 @@ # Template file for 'boomerang' pkgname=boomerang version=0.5.2 -revision=1 +revision=2 build_style=cmake configure_args="-DBOOMERANG_BUILD_REGRESSION_TESTS=TRUE" make_check_target="check" -hostmakedepends="flex qt5-devel" +hostmakedepends="flex python3 qt5-devel" makedepends="qt5-devel capstone-devel" -checkdepends="python3" short_desc="General, open source machine code decompiler" maintainer="Piraty " license="BSD-3-Clause" From 486772dfca8a4c4408f464792f3b9e7a44806716 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= Date: Mon, 10 Jul 2023 16:06:59 +0100 Subject: [PATCH 04/10] edb-debugger: rebuild for capstone-5.0. --- srcpkgs/edb-debugger/patches/capstone5.patch | 38 ++++++++++++++++++++ srcpkgs/edb-debugger/template | 2 +- 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 srcpkgs/edb-debugger/patches/capstone5.patch diff --git a/srcpkgs/edb-debugger/patches/capstone5.patch b/srcpkgs/edb-debugger/patches/capstone5.patch new file mode 100644 index 000000000000..0dc949f57adf --- /dev/null +++ b/srcpkgs/edb-debugger/patches/capstone5.patch @@ -0,0 +1,38 @@ +From b1bc4d02bfc7ca9c871e7b518aeb795d83e7f88b Mon Sep 17 00:00:00 2001 +From: Sam James +Date: Tue, 13 Sep 2022 19:51:08 +0100 +Subject: [PATCH] Fix build with Capstone 5 (#824) + +Capstone 5 drops X86_INS_VCVTPD2DQX and X86_INS_VCVTPD2PSX from +x86.h (happened in https://github.com/capstone-engine/capstone/commit/dd91f03fef5102492352756e2adb5972dd79a70f +but no real explanation). + +Given: +1. these instructions had no wiring up; +2. other Capstone consumers have done the same +let's drop them entirely as we have no idea what they are. They don't +appear in any Intel documentation and there's very little reference +to them online at all. + +Bug: https://bugs.gentoo.org/843755 +Closes: https://github.com/eteran/edb-debugger/issues/823 +Signed-off-by: Sam James + +Signed-off-by: Sam James +--- + src/capstone-edb/Instruction.cpp | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/src/capstone-edb/Instruction.cpp b/src/capstone-edb/Instruction.cpp +index 7b2dfc8ae..e5fe0f1b0 100644 +--- a/src/capstone-edb/Instruction.cpp ++++ b/src/capstone-edb/Instruction.cpp +@@ -880,8 +880,6 @@ bool is_SIMD_PD(const Operand &operand) { + case X86_INS_CVTPD2PI: + case X86_INS_CVTPD2PS: + case X86_INS_VCVTPD2PS: +- case X86_INS_VCVTPD2DQX: // FIXME: what's this? +- case X86_INS_VCVTPD2PSX: // FIXME: what's this? + // case X86_INS_VCVTPD2QQ: // FIXME: Capstone seems to not support it + case X86_INS_VCVTPD2UDQ: + // case X86_INS_VCVTPD2UQQ: // FIXME: Capstone seems to not support it diff --git a/srcpkgs/edb-debugger/template b/srcpkgs/edb-debugger/template index 91e73f4574ee..0e47747c5cab 100644 --- a/srcpkgs/edb-debugger/template +++ b/srcpkgs/edb-debugger/template @@ -1,7 +1,7 @@ # Template file for 'edb-debugger' pkgname=edb-debugger version=1.3.0 -revision=1 +revision=2 archs="x86_64* i686*" build_style=cmake hostmakedepends='pkg-config' From 7534a785934d2c4d4be9761ee18100fa0baf2f24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= Date: Mon, 10 Jul 2023 16:06:59 +0100 Subject: [PATCH 05/10] openocd: rebuild for capstone-5.0. --- srcpkgs/openocd/template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/srcpkgs/openocd/template b/srcpkgs/openocd/template index 9309090c35de..f88e96193947 100644 --- a/srcpkgs/openocd/template +++ b/srcpkgs/openocd/template @@ -1,7 +1,7 @@ # Template file for 'openocd' pkgname=openocd version=0.11.0+1 -revision=2 +revision=3 # update to a commit that has a compatible jimtcl version _commit=830d70bfc66ada2a68c73283b9e4fa4770d408ee _jimtcl_version=0.81 From e73dffce807ae0310ed1c6b845052f122a54ec22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= Date: Mon, 10 Jul 2023 16:07:00 +0100 Subject: [PATCH 06/10] radare2: rebuild for capstone-5.0. --- srcpkgs/radare2/template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/srcpkgs/radare2/template b/srcpkgs/radare2/template index 7ccf26ae8918..f38c84efa1d2 100644 --- a/srcpkgs/radare2/template +++ b/srcpkgs/radare2/template @@ -1,7 +1,7 @@ # Template file for 'radare2' pkgname=radare2 version=5.7.8 -revision=1 +revision=2 build_style=meson configure_args="-Denable_tests=false -Duse_sys_capstone=true -Duse_sys_magic=true -Duse_sys_xxhash=true From 1c787d9c2342e6a17a1c419df255d64a25f88788 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= Date: Mon, 10 Jul 2023 16:07:01 +0100 Subject: [PATCH 07/10] rizin: rebuild for capstone-5.0. --- srcpkgs/rizin/template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/srcpkgs/rizin/template b/srcpkgs/rizin/template index 8fe7acb2ff45..4888fc014d3b 100644 --- a/srcpkgs/rizin/template +++ b/srcpkgs/rizin/template @@ -1,7 +1,7 @@ # Template file for 'rizin' pkgname=rizin version=0.5.2 -revision=1 +revision=2 build_style=meson configure_args="-D use_sys_capstone=enabled -D use_capstone_version=v4 -D use_sys_magic=enabled -D use_sys_libzip=enabled -D use_sys_zlib=enabled From 13e0e07264fc7420edb9f2733ef34faffe0491ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= Date: Mon, 10 Jul 2023 16:07:01 +0100 Subject: [PATCH 08/10] uftrace: rebuild for capstone-5.0. --- srcpkgs/uftrace/template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/srcpkgs/uftrace/template b/srcpkgs/uftrace/template index 8f703e0a812f..3e7690e4ea90 100644 --- a/srcpkgs/uftrace/template +++ b/srcpkgs/uftrace/template @@ -1,7 +1,7 @@ # Template file for 'uftrace' pkgname=uftrace version=0.14 -revision=1 +revision=2 archs="x86_64* i686* aarch64* arm*" build_style=configure configure_args="--prefix=/usr --libdir=/usr/lib${XBPS_TARGET_WORDSIZE}" From bd9278ac378493ff69f67a4f78db1ecc47ddeaff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Cerqueira?= Date: Mon, 10 Jul 2023 18:09:08 +0100 Subject: [PATCH 09/10] qemu: rebuild for capstone-5.0 --- srcpkgs/qemu/patches/tricore_feature.patch | 60 ++++++++++++++++++++++ srcpkgs/qemu/template | 7 +-- 2 files changed, 62 insertions(+), 5 deletions(-) create mode 100644 srcpkgs/qemu/patches/tricore_feature.patch diff --git a/srcpkgs/qemu/patches/tricore_feature.patch b/srcpkgs/qemu/patches/tricore_feature.patch new file mode 100644 index 000000000000..f7f621f81170 --- /dev/null +++ b/srcpkgs/qemu/patches/tricore_feature.patch @@ -0,0 +1,60 @@ +capstone 5 declares this struct, so we need a different name +-- +diff --git a/target/tricore/cpu.c b/target/tricore/cpu.c +index d0a9272..6297af9 100644 +--- a/target/tricore/cpu.c ++++ b/target/tricore/cpu.c +@@ -103,14 +103,14 @@ static void tricore_cpu_realizefn(DeviceState *dev, Error **errp) + } + + /* Some features automatically imply others */ +- if (tricore_feature(env, TRICORE_FEATURE_161)) { ++ if (tricore_feature_x(env, TRICORE_FEATURE_161)) { + set_feature(env, TRICORE_FEATURE_16); + } + +- if (tricore_feature(env, TRICORE_FEATURE_16)) { ++ if (tricore_feature_x(env, TRICORE_FEATURE_16)) { + set_feature(env, TRICORE_FEATURE_131); + } +- if (tricore_feature(env, TRICORE_FEATURE_131)) { ++ if (tricore_feature_x(env, TRICORE_FEATURE_131)) { + set_feature(env, TRICORE_FEATURE_13); + } + cpu_reset(cs); +diff --git a/target/tricore/cpu.h b/target/tricore/cpu.h +index 47d0ffb..6fd447c 100644 +--- a/target/tricore/cpu.h ++++ b/target/tricore/cpu.h +@@ -258,7 +258,7 @@ enum tricore_features { + TRICORE_FEATURE_161, + }; + +-static inline int tricore_feature(CPUTriCoreState *env, int feature) ++static inline int tricore_feature_x(CPUTriCoreState *env, int feature) + { + return (env->features & (1ULL << feature)) != 0; + } +diff --git a/target/tricore/op_helper.c b/target/tricore/op_helper.c +index 532ae6b..6a71b5b 100644 +--- a/target/tricore/op_helper.c ++++ b/target/tricore/op_helper.c +@@ -2528,7 +2528,7 @@ void helper_ret(CPUTriCoreState *env) + /* PCXI = new_PCXI; */ + env->PCXI = new_PCXI; + +- if (tricore_feature(env, TRICORE_FEATURE_13)) { ++ if (tricore_feature_x(env, TRICORE_FEATURE_13)) { + /* PSW = new_PSW */ + psw_write(env, new_PSW); + } else { +@@ -2639,7 +2639,7 @@ void helper_rfm(CPUTriCoreState *env) + env->gpr_a[10] = cpu_ldl_data(env, env->DCX+8); + env->gpr_a[11] = cpu_ldl_data(env, env->DCX+12); + +- if (tricore_feature(env, TRICORE_FEATURE_131)) { ++ if (tricore_feature_x(env, TRICORE_FEATURE_131)) { + env->DBGTCR = 0; + } + } + diff --git a/srcpkgs/qemu/template b/srcpkgs/qemu/template index 48ab199e5686..9793e2f6101a 100644 --- a/srcpkgs/qemu/template +++ b/srcpkgs/qemu/template @@ -2,7 +2,7 @@ # This package should be updated together with qemu-user-static pkgname=qemu version=7.1.0 -revision=2 +revision=3 build_style=configure configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec --localstatedir=/var --disable-glusterfs --disable-xen --enable-docs --enable-kvm --enable-libusb --enable-pie @@ -33,6 +33,7 @@ ignore_elf_dirs="/usr/share/qemu" nostrip_files="hppa-firmware.img openbios-ppc openbios-sparc32 openbios-sparc64 palcode-clipper s390-ccw.img s390-netboot.img u-boot.e500 opensbi-riscv32-generic-fw_dynamic.elf opensbi-riscv64-generic-fw_dynamic.elf" +make_check=no # capstone5.0: fails 90/95 qemu:unit / test-vmstate (when updating the qemu package this should go away) build_options="gtk3 opengl sdl2 spice virgl smartcard numa iscsi jack pulseaudio" build_options_default="opengl gtk3 virgl sdl2 numa iscsi jack pulseaudio" @@ -57,10 +58,6 @@ else build_options_default+=" smartcard" fi -if [ "$XBPS_CHECK_PKGS" != full ]; then - make_check_target=check-unit -fi - post_extract() { if [ "$XBPS_TARGET_LIBC" = "musl" ]; then grep -rl 'Input/output error' tests/qemu-iotests | From 37d79ea08e94fccc4618a4034dfa8dca74b477dc Mon Sep 17 00:00:00 2001 From: classabbyamp Date: Tue, 11 Jul 2023 20:19:36 -0400 Subject: [PATCH 10/10] imhex: use system capstone --- srcpkgs/imhex/template | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/srcpkgs/imhex/template b/srcpkgs/imhex/template index 3f7f4750389e..94a058c2b163 100644 --- a/srcpkgs/imhex/template +++ b/srcpkgs/imhex/template @@ -1,18 +1,17 @@ # Template file for 'imhex' pkgname=imhex version=1.30.1 -revision=1 +revision=2 build_wrksrc="ImHex" build_style=cmake build_helper=qemu -# XXX: when capstone v5 is out, -DUSE_SYSTEM_CAPSTONE=ON configure_args="-DIMHEX_OFFLINE_BUILD=ON -DIMHEX_STRIP_RELEASE=OFF - -DUSE_SYSTEM_CURL=ON -DUSE_SYSTEM_FMT=ON -DUSE_SYSTEM_LLVM=ON + -DUSE_SYSTEM_CURL=ON -DUSE_SYSTEM_FMT=ON -DUSE_SYSTEM_LLVM=ON -DUSE_SYSTEM_CAPSTONE=ON -DUSE_SYSTEM_YARA=ON -DUSE_SYSTEM_NLOHMANN_JSON=ON -DIMHEX_DISABLE_UPDATE_CHECK=ON" hostmakedepends="pkg-config clang-tools-extra" makedepends="libcurl-devel fmt-devel llvm jansson-devel yara-devel json-c++ freetype-devel glfw-devel gtk+3-devel python3-devel file-devel mbedtls-devel - clang-tools-extra" + clang-tools-extra capstone-devel" short_desc="Hex editor for reverse engineers and programmers" maintainer="classabbyamp " license="GPL-2.0-or-later"