diff --git a/.gitignore b/.gitignore index 0c5f8e89..10d73b35 100644 --- a/.gitignore +++ b/.gitignore @@ -45,6 +45,8 @@ unicorn.pc unicorn.lib unicorn.dll +unicorn.exp +unicorn.def unicorn_*.lib unicorn_*.exp unicorn_*.dll diff --git a/ChangeLog b/ChangeLog index fe2d6325..b8b54c5a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,17 @@ This file details the changelog of Unicorn Engine. +---------------------------------- +[Version 1.0-rc1]: December 22nd, 2016 + +- Lots of bugfixes in all architectures. +- Better support for ARM Thumb. +- Fix many memory leaking issues. +- New bindings: Haskell, MSVC. +- Better support for Python3. +- New APIs: uc_query, uc_reg_write_batch, uc_reg_read_batch, uc_mem_map_ptr, uc_mem_regions, uc_context_alloc, uc_context_save & uc_context_restore. +- New memory hook type: UC_HOOK_MEM_READ_AFTER. +- Add new version macros UC_VERSION_{MAJOR, MINOR, EXTRA} + ---------------------------------- [Version 0.9]: October 15th, 2015 diff --git a/Makefile b/Makefile index 15342d8d..c728d255 100644 --- a/Makefile +++ b/Makefile @@ -119,10 +119,12 @@ UNICORN_CFLAGS := $(UNICORN_CFLAGS:-fPIC=) # mingw? else ifneq ($(filter MINGW%,$(UNAME_S)),) EXT = dll -AR_EXT = lib +AR_EXT = a BIN_EXT = .exe UNICORN_QEMU_FLAGS += --disable-stack-protector UNICORN_CFLAGS := $(UNICORN_CFLAGS:-fPIC=) +$(LIBNAME)_LDFLAGS += -Wl,--output-def,unicorn.def +DO_WINDOWS_EXPORT = 1 # Linux, Darwin else @@ -217,6 +219,13 @@ else $(CC) $(CFLAGS) -shared $(UC_TARGET_OBJ) uc.o list.o -o $(LIBRARY) $($(LIBNAME)_LDFLAGS) -ln -sf $(LIBRARY) $(LIBRARY_SYMLINK) endif +ifeq ($(DO_WINDOWS_EXPORT),1) +ifneq ($(filter MINGW32%,$(UNAME_S)),) + cmd /c "windows_export.bat x86" +else + cmd /c "windows_export.bat x64" +endif +endif endif $(ARCHIVE): qemu/config-host.h-timestamp @@ -298,7 +307,7 @@ uninstall: clean: $(MAKE) -C qemu clean rm -rf *.d *.o - rm -rf lib$(LIBNAME)* $(LIBNAME)*.lib $(LIBNAME)*.dll cyg$(LIBNAME)*.dll + rm -rf lib$(LIBNAME)* $(LIBNAME)*.lib $(LIBNAME)*.dll $(LIBNAME)*.exp cyg$(LIBNAME)*.dll $(MAKE) -C samples clean $(MAKE) -C tests/unit clean diff --git a/bindings/python/setup.py b/bindings/python/setup.py index 02cd5285..ef4b2327 100755 --- a/bindings/python/setup.py +++ b/bindings/python/setup.py @@ -42,7 +42,7 @@ if SYSTEM == 'darwin': STATIC_LIBRARY_FILE = 'libunicorn.a' elif SYSTEM in ('win32', 'cygwin'): LIBRARY_FILE = "unicorn.dll" - STATIC_LIBRARY_FILE = None + STATIC_LIBRARY_FILE = "unicorn.lib" else: LIBRARY_FILE = "libunicorn.so" STATIC_LIBRARY_FILE = 'libunicorn.a' @@ -146,7 +146,11 @@ def build_libraries(): subprocess.call(cmd, env=new_env) shutil.copy(LIBRARY_FILE, LIBS_DIR) - if STATIC_LIBRARY_FILE: shutil.copy(STATIC_LIBRARY_FILE, LIBS_DIR) + try: + # static library may fail to build on windows if user doesn't have visual studio 12 installed. this is fine. + shutil.copy(STATIC_LIBRARY_FILE, LIBS_DIR) + except: + pass os.chdir(cwd) diff --git a/samples/Makefile b/samples/Makefile index 8fbd7ac9..2f347361 100644 --- a/samples/Makefile +++ b/samples/Makefile @@ -43,7 +43,7 @@ AR_EXT = a else ifneq ($(filter MINGW%,$(UNAME_S)),) CFLAGS := $(CFLAGS:-fPIC=) BIN_EXT = .exe -AR_EXT = lib +AR_EXT = a endif ifeq ($(UNICORN_STATIC),yes) diff --git a/windows_export.bat b/windows_export.bat new file mode 100644 index 00000000..4ff67fba --- /dev/null +++ b/windows_export.bat @@ -0,0 +1,16 @@ +@echo on + +:: This script invokes the visual studio linker to construct a static library file that can be used outside of mingw. +:: The unicorn.def file that it references below is produced by the mingw compiler via a linker flag. +:: The arch (x86 or x64) we are working on should be passed via the first argument to this script. + +:: Look up the Visual Studio install path via the registry +:: http://stackoverflow.com/questions/445167/how-can-i-get-the-value-of-a-registry-key-from-within-a-batch-script +:: If anyone ever tells you that windows is a reasonable operating system, they are wrong +FOR /F "usebackq tokens=3*" %%A IN (`REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\12.0" /v InstallDir`) DO ( + set appdir=%%A %%B +) + +:: Add the visual studio binaries to our path and run the linker +call "%appdir%..\..\VC\vcvarsall.bat" %1 +call lib /machine:%1 /def:unicorn.def