unicorn py-unicorn: updated to 2.0.1.post1

Version 2.0.1

Features:

- Support building & running on BE hosts.
- Fix and support `clang-cl` on Windows.
- Fix python `sdist` and add aarch64 Linux wheels. Note `pip` can build Unicorn2 on M1 now!
- C# binding is refined and upgraded to .Net 6.

Fix/Improvements:

- Various bindings improvements.
- Improvements for tests.
- Fail explicitly when VEX.L is set.
- Fix endianness when writing PPC32 CR register.
- Fix a bug in `uc_ctl_set_cpu_model` check.
- Fix Tricore PC not updating.
- Fix the mapping not updated if users modify the mappings in the hooks.
- Handle pathological cases consistently.
- Fix memory leaks in PPC target.
- Fix memory leaks in Tricore target.
- Fix MSVC handling in cmake.
- Fix PC sync-ing problems for `UC_HOOK_BLOCK` hooks.
- Fix PC sync-ed twice when users request a soft restart.
- Prevent overflow with pre-allocated RAM blocks.
- Add FPCR and FPSR registers
- Fix ARM CPU state not deep copied.
- Fix PC not sync-ed for memory operation on aarch64.
- Exit invalid store operations early to avoid the target registers being overwritten.
- Improve the support for ARM BE32.


Version 2.0.0

Features:

- TriCore Support

Fixes/Improvements:

- Build both shared library and static archive as unicorn1 does.
- Misc bindings improvements.
- Make sure setjmp-setjmp-wrapper-win32 participates in the build.
- Improve Rust bindings build logic.
- Fix wrong python binding for UC_CTL_TB_REMOVE_CACHE
- Flush translation blocks when the count hook is removed.
- Fix unicorn crash when nested `uc_emu_start` deletes a hook
- Fix CPU not fully resumed when writing PC.
- Don't quit TB if `uc_mem_protect` doesn't change the protection of current TB memory.
- Add type annotations for python bindings.
- Add CPUID hook for python bindings.
- Don't repeat memory hooks if there is already an unhandled error.
- Support reads and writes over all Arm SIMD registers
- Fix wrong registers range in python bindings.
- Fix uc_mem_protect on mmio regions
- Fix a UAF caused by hook cache.
- Fix the value collision between UC_MODE_ARMBE8 and UC_MODE_ARM926
This commit is contained in:
adam 2023-05-11 06:47:11 +00:00
parent bd0baf490b
commit 27cfd7540d
10 changed files with 63 additions and 88 deletions

View file

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.4 2023/05/10 19:14:51 adam Exp $
# $NetBSD: Makefile,v 1.5 2023/05/11 06:47:11 adam Exp $
.include "../../emulators/unicorn/Makefile.common"
@ -11,6 +11,7 @@ LICENSE= gnu-gpl-v2
USE_LANGUAGES= # none
PYSETUPSUBDIR= bindings/python
MAKE_ENV+= LIBUNICORN_PATH=${BUILDLINK_PREFIX.unicorn}/lib
.include "../../emulators/unicorn/buildlink3.mk"
.include "../../lang/python/egg.mk"

View file

@ -1,9 +1,9 @@
@comment $NetBSD: PLIST,v 1.3 2021/02/25 19:47:50 leot Exp $
@comment $NetBSD: PLIST,v 1.4 2023/05/11 06:47:11 adam Exp $
${PYSITELIB}/${EGG_INFODIR}/PKG-INFO
${PYSITELIB}/${EGG_INFODIR}/SOURCES.txt
${PYSITELIB}/${EGG_INFODIR}/dependency_links.txt
${PYSITELIB}/${EGG_INFODIR}/top_level.txt
${PYSITELIB}/${EGG_INFODIR}/not-zip-safe
${PYSITELIB}/${EGG_INFODIR}/top_level.txt
${PYSITELIB}/unicorn/__init__.py
${PYSITELIB}/unicorn/__init__.pyc
${PYSITELIB}/unicorn/__init__.pyo
@ -19,9 +19,21 @@ ${PYSITELIB}/unicorn/m68k_const.pyo
${PYSITELIB}/unicorn/mips_const.py
${PYSITELIB}/unicorn/mips_const.pyc
${PYSITELIB}/unicorn/mips_const.pyo
${PYSITELIB}/unicorn/ppc_const.py
${PYSITELIB}/unicorn/ppc_const.pyc
${PYSITELIB}/unicorn/ppc_const.pyo
${PYSITELIB}/unicorn/riscv_const.py
${PYSITELIB}/unicorn/riscv_const.pyc
${PYSITELIB}/unicorn/riscv_const.pyo
${PYSITELIB}/unicorn/s390x_const.py
${PYSITELIB}/unicorn/s390x_const.pyc
${PYSITELIB}/unicorn/s390x_const.pyo
${PYSITELIB}/unicorn/sparc_const.py
${PYSITELIB}/unicorn/sparc_const.pyc
${PYSITELIB}/unicorn/sparc_const.pyo
${PYSITELIB}/unicorn/tricore_const.py
${PYSITELIB}/unicorn/tricore_const.pyc
${PYSITELIB}/unicorn/tricore_const.pyo
${PYSITELIB}/unicorn/unicorn.py
${PYSITELIB}/unicorn/unicorn.pyc
${PYSITELIB}/unicorn/unicorn.pyo

View file

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.20 2023/05/10 19:14:50 adam Exp $
# $NetBSD: Makefile,v 1.21 2023/05/11 06:47:11 adam Exp $
.include "Makefile.common"
@ -6,22 +6,8 @@ MAINTAINER= pkgsrc-users@NetBSD.org
COMMENT= CPU emulator engine framework based on QEMU
LICENSE= gnu-gpl-v2
USE_TOOLS+= gmake pkg-config
.include "../../lang/python/application.mk"
MAKE_ENV+= UNICORN_QEMU_FLAGS=--python=${PYTHONBIN:Q}
MAKE_ENV+= UNICORN_QEMU_FLAGS=--extra-ldflags=\"${LDFLAGS:Q}\"
MAKE_ENV+= CONFIG_SHELL=${CONFIG_SHELL:Q}
ALL_ENV+= USE_GENERIC_LIBDATADIR=yes
.include "../../mk/bsd.prefs.mk"
.if ${OPSYS} == "Darwin"
post-install:
install_name_tool -id ${PREFIX}/lib/libunicorn.1.dylib \
${DESTDIR}${PREFIX}/lib/libunicorn.1.dylib
.endif
USE_LANGUAGES= c c++
.include "../../devel/cmake/build.mk"
.include "../../devel/glib2/buildlink3.mk"
.include "../../mk/bsd.pkg.mk"

View file

@ -1,9 +1,9 @@
# $NetBSD: Makefile.common,v 1.7 2023/05/10 19:14:50 adam Exp $
# $NetBSD: Makefile.common,v 1.8 2023/05/11 06:47:11 adam Exp $
#
# used by emulators/unicorn/Makefile
# used by emulators/py-unicorn/Makefile
DISTNAME= unicorn-1.0.3
DISTNAME= unicorn-2.0.1.post1
CATEGORIES= emulators
MASTER_SITES= ${MASTER_SITE_GITHUB:=unicorn-engine/}
GITHUB_PROJECT= unicorn

View file

@ -1,13 +1,17 @@
@comment $NetBSD: PLIST,v 1.4 2021/02/25 19:47:50 leot Exp $
@comment $NetBSD: PLIST,v 1.5 2023/05/11 06:47:11 adam Exp $
include/unicorn/arm.h
include/unicorn/arm64.h
include/unicorn/m68k.h
include/unicorn/mips.h
include/unicorn/platform.h
include/unicorn/ppc.h
include/unicorn/riscv.h
include/unicorn/s390x.h
include/unicorn/sparc.h
include/unicorn/tricore.h
include/unicorn/unicorn.h
include/unicorn/x86.h
lib/libunicorn.a
lib/libunicorn.so
lib/libunicorn.so.1
lib/libunicorn.so.2
lib/pkgconfig/unicorn.pc

View file

@ -1,11 +1,11 @@
# $NetBSD: buildlink3.mk,v 1.2 2019/11/03 19:24:34 rillig Exp $
# $NetBSD: buildlink3.mk,v 1.3 2023/05/11 06:47:11 adam Exp $
BUILDLINK_TREE+= unicorn
.if !defined(UNICORN_BUILDLINK3_MK)
UNICORN_BUILDLINK3_MK:=
BUILDLINK_API_DEPENDS.unicorn+= unicorn>=1.0.1
BUILDLINK_API_DEPENDS.unicorn+= unicorn>=2.0.0
BUILDLINK_PKGSRCDIR.unicorn?= ../../emulators/unicorn
.endif # UNICORN_BUILDLINK3_MK

View file

@ -1,8 +1,7 @@
$NetBSD: distinfo,v 1.11 2023/05/10 19:14:50 adam Exp $
$NetBSD: distinfo,v 1.12 2023/05/11 06:47:11 adam Exp $
BLAKE2s (unicorn-1.0.3.tar.gz) = 53a6a919c8e46d14add3be520531eb3d6b8d1686855a6980dfc57ebe8edbd852
SHA512 (unicorn-1.0.3.tar.gz) = 10f1b5194358c65bc94723eaafd7b4167fee18f96a4810f46f8c78ed1ef5584546e66e8c910fa4eeadd791fcd73edea68f898e337081409fd188b4090b78a7ca
Size (unicorn-1.0.3.tar.gz) = 3759365 bytes
SHA1 (patch-Makefile) = a4cee3d8f880515e10dd053a6d2e93ea019f34d7
SHA1 (patch-bindings_python_setup.py) = 035888ce0599abb8ef4670fffb051cb1510d9a29
BLAKE2s (unicorn-2.0.1.post1.tar.gz) = d2a3e24b963448e11d1b46d7fa3edbd6d1dbef1d2f996b6c66aee2e6f7297c4b
SHA512 (unicorn-2.0.1.post1.tar.gz) = 8694d6bc92e3424a8ad050316413d53e56e0f55e7cad7517fb3e98e670a0f1768b060ead8f195da13607cec89a964364f05a8b9d0dc074f4ac5e51026f8343ad
Size (unicorn-2.0.1.post1.tar.gz) = 4071380 bytes
SHA1 (patch-bindings_python_unicorn_unicorn.py) = d7653d205bc999b8c53941c161771b8f72fcfa6e
SHA1 (patch-bundle__static.cmake) = f6ebe735b2b7e8ef151f15b95a7ee0bb9b9d9ef6

View file

@ -1,38 +0,0 @@
$NetBSD: patch-Makefile,v 1.3 2021/10/21 19:09:10 jperkin Exp $
--- Makefile.orig 2020-10-21 11:34:41.000000000 +0000
+++ Makefile
@@ -218,7 +218,11 @@ else
EXT = so
VERSION_EXT = $(EXT).$(API_MAJOR)
AR_EXT = a
+ifneq ($(filter SunOS%,$(UNAME_S)),)
+$(LIBNAME)_LDFLAGS += -Wl,-soname,lib$(LIBNAME).$(VERSION_EXT)
+else
$(LIBNAME)_LDFLAGS += -Wl,-Bsymbolic-functions,-soname,lib$(LIBNAME).$(VERSION_EXT)
+endif
UNICORN_CFLAGS += -fvisibility=hidden
endif
@@ -290,7 +294,7 @@ all: unicorn
qemu/config-host.mak: qemu/configure
cd qemu && \
- ./configure --cc="${CC}" --extra-cflags="$(UNICORN_CFLAGS)" --target-list="$(UNICORN_TARGETS)" ${UNICORN_QEMU_FLAGS}
+ $(CONFIG_SHELL) ./configure --cc="${CC}" --extra-cflags="$(UNICORN_CFLAGS)" --target-list="$(UNICORN_TARGETS)" ${UNICORN_QEMU_FLAGS}
@printf "$(UNICORN_ARCHS)" > config.log
uc.o: qemu/config-host.mak FORCE
@@ -305,10 +309,10 @@ $(LIBRARY): $(UC_OBJ_ALL)
ifeq ($(UNICORN_SHARED),yes)
ifeq ($(V),0)
$(call log,GEN,$(LIBRARY))
- @$(CC) $(CFLAGS) -shared $(UC_OBJ_ALL) -o $(LIBRARY) $($(LIBNAME)_LDFLAGS)
+ @$(CC) $(CFLAGS) -shared $(UC_OBJ_ALL) -o $(LIBRARY) $($(LIBNAME)_LDFLAGS) $(LDFLAGS)
@-ln -sf $(LIBRARY) $(LIBRARY_SYMLINK)
else
- $(CC) $(CFLAGS) -shared $(UC_OBJ_ALL) -o $(LIBRARY) $($(LIBNAME)_LDFLAGS)
+ $(CC) $(CFLAGS) -shared $(UC_OBJ_ALL) -o $(LIBRARY) $($(LIBNAME)_LDFLAGS) $(LDFLAGS)
-ln -sf $(LIBRARY) $(LIBRARY_SYMLINK)
endif
ifeq ($(DO_WINDOWS_EXPORT),1)

View file

@ -1,18 +0,0 @@
$NetBSD: patch-bindings_python_setup.py,v 1.2 2021/02/25 19:47:51 leot Exp $
--- bindings/python/setup.py.orig 2020-10-21 11:34:41.000000000 +0000
+++ bindings/python/setup.py
@@ -208,13 +208,11 @@ class custom_build(build):
log.info("Skipping building C extensions since LIBUNICORN_PATH is set")
else:
log.info("Building C extensions")
- build_libraries()
return build.run(self)
class custom_develop(develop):
def run(self):
log.info("Building C extensions")
- build_libraries()
return develop.run(self)
class custom_bdist_egg(bdist_egg):

View file

@ -0,0 +1,29 @@
$NetBSD: patch-bundle__static.cmake,v 1.1 2023/05/11 06:47:11 adam Exp $
Use proper libtool on Darwin.
--- bundle_static.cmake.orig 2023-05-10 19:31:11.000000000 +0000
+++ bundle_static.cmake
@@ -44,14 +44,12 @@ function(bundle_static_library tgt_name
${CMAKE_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${library_name}${CMAKE_STATIC_LIBRARY_SUFFIX})
if (APPLE)
- find_program(lib_tool libtool REQUIRED)
-
foreach(tgt IN LISTS static_libs)
list(APPEND static_libs_full_names $<TARGET_FILE:${tgt}>)
endforeach()
add_custom_command(
- COMMAND ${lib_tool} -static -o ${bundled_tgt_full_name} ${static_libs_full_names}
+ COMMAND /usr/bin/libtool -static -o ${bundled_tgt_full_name} ${static_libs_full_names}
OUTPUT ${bundled_tgt_full_name}
COMMENT "Bundling ${bundled_tgt_name}"
VERBATIM)
@@ -112,4 +110,4 @@ function(bundle_static_library tgt_name
#IMPORTED_LINK_INTERFACE_LIBRARIES "${dep_libs}") # Deprecated
add_dependencies(${bundled_tgt_name} bundling_target)
-endfunction()
\ No newline at end of file
+endfunction()