From 06541894ea6dc2f187ffb7c63e40bb687e6e56e7 Mon Sep 17 00:00:00 2001 From: danghvu Date: Sun, 25 Dec 2016 21:46:52 -0600 Subject: [PATCH 1/6] Makefile: uc.o and list.o is compiled with qemu, fix for issue #696 --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 8c9d60e6..70d0e866 100644 --- a/Makefile +++ b/Makefile @@ -210,7 +210,7 @@ qemu/config-host.h-timestamp: unicorn: $(LIBRARY) $(ARCHIVE) -$(LIBRARY): qemu/config-host.h-timestamp uc.o list.o +$(LIBRARY): qemu/config-host.h-timestamp ifeq ($(UNICORN_SHARED),yes) ifeq ($(V),0) $(call log,GEN,$(LIBRARY)) @@ -222,7 +222,7 @@ else endif endif -$(ARCHIVE): qemu/config-host.h-timestamp uc.o list.o +$(ARCHIVE): qemu/config-host.h-timestamp ifeq ($(UNICORN_STATIC),yes) ifeq ($(V),0) $(call log,GEN,$(ARCHIVE)) From e9b8968a23b3ab8b6e380d681b024b5ebb24c2de Mon Sep 17 00:00:00 2001 From: Nguyen Anh Quynh Date: Mon, 26 Dec 2016 13:12:15 +0800 Subject: [PATCH 2/6] Update install-cmocka-linux.sh temporarily fix the cmocka download issue by avoid using https --- install-cmocka-linux.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install-cmocka-linux.sh b/install-cmocka-linux.sh index 46b405a4..0c6eda79 100755 --- a/install-cmocka-linux.sh +++ b/install-cmocka-linux.sh @@ -1,7 +1,7 @@ #!/bin/sh set -ex mkdir cmocka -wget https://cmocka.org/files/1.1/cmocka-1.1.0.tar.xz -O /tmp/cmocka-1.1.0.tar.xz +wget --no-check-certificate http://cmocka.org/files/1.1/cmocka-1.1.0.tar.xz -O /tmp/cmocka-1.1.0.tar.xz tar -xf /tmp/cmocka-1.1.0.tar.xz -C /tmp cd cmocka && cmake -DUNIT_TESTING=On /tmp/cmocka-1.1.0 && make && make test # cmake builds an so instead of a dll in mingw/msys From 8a9a5432c37d8a65777262d832ea14116c488904 Mon Sep 17 00:00:00 2001 From: Nguyen Anh Quynh Date: Mon, 26 Dec 2016 13:45:40 +0800 Subject: [PATCH 3/6] add back as a comment the https download for cmocka to install-cmocka-linux.sh --- install-cmocka-linux.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/install-cmocka-linux.sh b/install-cmocka-linux.sh index 0c6eda79..a9530ac2 100755 --- a/install-cmocka-linux.sh +++ b/install-cmocka-linux.sh @@ -1,6 +1,7 @@ #!/bin/sh set -ex mkdir cmocka +#wget https://cmocka.org/files/1.1/cmocka-1.1.0.tar.xz -O /tmp/cmocka-1.1.0.tar.xz wget --no-check-certificate http://cmocka.org/files/1.1/cmocka-1.1.0.tar.xz -O /tmp/cmocka-1.1.0.tar.xz tar -xf /tmp/cmocka-1.1.0.tar.xz -C /tmp cd cmocka && cmake -DUNIT_TESTING=On /tmp/cmocka-1.1.0 && make && make test From 87e8532e676528384d79a6d43f97b6003d04e7ec Mon Sep 17 00:00:00 2001 From: me Date: Mon, 26 Dec 2016 14:16:56 +0800 Subject: [PATCH 4/6] regress: link on Linux with -lrt --- install-cmocka-linux.sh | 2 +- tests/regress/Makefile | 5 +++++ tests/unit/Makefile | 6 ++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/install-cmocka-linux.sh b/install-cmocka-linux.sh index a9530ac2..d3eb6959 100755 --- a/install-cmocka-linux.sh +++ b/install-cmocka-linux.sh @@ -1,6 +1,6 @@ #!/bin/sh set -ex -mkdir cmocka +mkdir -p cmocka #wget https://cmocka.org/files/1.1/cmocka-1.1.0.tar.xz -O /tmp/cmocka-1.1.0.tar.xz wget --no-check-certificate http://cmocka.org/files/1.1/cmocka-1.1.0.tar.xz -O /tmp/cmocka-1.1.0.tar.xz tar -xf /tmp/cmocka-1.1.0.tar.xz -C /tmp diff --git a/tests/regress/Makefile b/tests/regress/Makefile index 431cdf32..c7da4ec4 100644 --- a/tests/regress/Makefile +++ b/tests/regress/Makefile @@ -1,6 +1,11 @@ CFLAGS += -Wall -Werror -I../../include LDLIBS += -L../../ -lpthread -lm -lunicorn +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S), Linux) +LDLIBS += -lrt +endif + EXECUTE_VARS = LD_LIBRARY_PATH=../../cmocka/src:../../ DYLD_LIBRARY_PATH=../../ TESTS_SOURCE = $(wildcard *.c) diff --git a/tests/unit/Makefile b/tests/unit/Makefile index 0768210a..57b8c038 100644 --- a/tests/unit/Makefile +++ b/tests/unit/Makefile @@ -3,6 +3,12 @@ CFLAGS += -L ../../ -I ../../include CFLAGS += -L ../../cmocka/src -I ../../cmocka/include LDLIBS += -lcmocka -lunicorn +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S), Linux) +LDLIBS += -lrt +endif + + EXECUTE_VARS = LD_LIBRARY_PATH=../../cmocka/src:../../ DYLD_LIBRARY_PATH=../../ ifeq ($(UNICORN_ASAN),yes) From 4805407fb6255b13061a39faad6f8643c97c872d Mon Sep 17 00:00:00 2001 From: Nguyen Anh Quynh Date: Mon, 26 Dec 2016 15:12:48 +0800 Subject: [PATCH 5/6] fix python test on Ubuntu 12.04 by preloading librt.so --- bindings/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/Makefile b/bindings/Makefile index ed958f75..fa488af3 100644 --- a/bindings/Makefile +++ b/bindings/Makefile @@ -9,7 +9,7 @@ SAMPLE := $(SAMPLE:sample_batch_reg=) SAMPLE := $(SAMPLE:sample_x86_32_gdt_and_seg_regs=) SAMPLE := $(SAMPLE:shellcode=) -ENV_VARS = LD_LIBRARY_PATH=../ DYLD_LIBRARY_PATH=../ +ENV_VARS = LD_PRELOAD=librt.so LD_LIBRARY_PATH=../ DYLD_LIBRARY_PATH=../ .PHONY: build install python c clean check test From 55e61f65e498ed3188b490f0635d0b5ecd924705 Mon Sep 17 00:00:00 2001 From: Nguyen Anh Quynh Date: Mon, 26 Dec 2016 15:54:46 +0800 Subject: [PATCH 6/6] python: only preload librt.so on Linux --- bindings/Makefile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bindings/Makefile b/bindings/Makefile index fa488af3..14e88df8 100644 --- a/bindings/Makefile +++ b/bindings/Makefile @@ -9,7 +9,13 @@ SAMPLE := $(SAMPLE:sample_batch_reg=) SAMPLE := $(SAMPLE:sample_x86_32_gdt_and_seg_regs=) SAMPLE := $(SAMPLE:shellcode=) +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S), Linux) ENV_VARS = LD_PRELOAD=librt.so LD_LIBRARY_PATH=../ DYLD_LIBRARY_PATH=../ +else +ENV_VARS = LD_LIBRARY_PATH=../ DYLD_LIBRARY_PATH=../ +endif + .PHONY: build install python c clean check test