From e85fde201e988cf9e7cf608be394977f7c045a75 Mon Sep 17 00:00:00 2001 From: David CARLIER Date: Sat, 26 Sep 2020 18:02:19 +0100 Subject: OpenBSD build fix (#566) * OpenBSD build fix proposal. Mainly the gcc plugin, using one of the egcc/eg++ version available. Needs pthread flag to r/w lock api. * README update --- GNUmakefile | 5 +++++ GNUmakefile.gcc_plugin | 8 ++++++++ GNUmakefile.llvm | 2 +- README.md | 1 + unicorn_mode/unicornafl | 2 +- 5 files changed, 16 insertions(+), 2 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 9e8b1a47..889c0e7d 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -218,6 +218,11 @@ ifneq "$(findstring NetBSD, $(shell uname))" "" LDFLAGS += -lpthread endif +ifneq "$(findstring OpenBSD, $(shell uname))" "" + override CFLAGS += -pthread + LDFLAGS += -lpthread +endif + TEST_CC = afl-gcc COMM_HDR = include/alloc-inl.h include/config.h include/debug.h include/types.h diff --git a/GNUmakefile.gcc_plugin b/GNUmakefile.gcc_plugin index 55b79182..e3108511 100644 --- a/GNUmakefile.gcc_plugin +++ b/GNUmakefile.gcc_plugin @@ -75,11 +75,19 @@ ifeq "$(TEST_MMAP)" "1" endif ifneq "$(shell uname -s)" "Haiku" +ifneq "$(shell uname -s)" "OpenBSD" LDFLAGS += -lrt +endif else CFLAGS_SAFE += -DUSEMMAP=1 endif +ifeq "$(shell uname -s)" "OpenBSD" + CC = egcc + CXX = eg++ + PLUGIN_FLAGS += -I/usr/local/include +endif + ifeq "$(shell uname -s)" "SunOS" PLUGIN_FLAGS += -I/usr/include/gmp endif diff --git a/GNUmakefile.llvm b/GNUmakefile.llvm index ef2a1f68..da0a6298 100644 --- a/GNUmakefile.llvm +++ b/GNUmakefile.llvm @@ -279,7 +279,7 @@ ifeq "$(shell uname)" "OpenBSD" CLANG_CPPFL += -mno-retpoline CFLAGS += -mno-retpoline # Needed for unwind symbols - LDFLAGS += -lc++abi + LDFLAGS += -lc++abi -lpthread endif ifeq "$(shell echo '$(HASH)include @$(HASH)include @int main() { int _id = shmget(IPC_PRIVATE, 65536, IPC_CREAT | IPC_EXCL | 0600); shmctl(_id, IPC_RMID, 0); return 0;}' | tr @ '\n' | $(CC) -x c - -o .test2 2>/dev/null && echo 1 || echo 0 ; rm -f .test2 )" "1" diff --git a/README.md b/README.md index d3066e9b..f63b0c1e 100644 --- a/README.md +++ b/README.md @@ -1081,6 +1081,7 @@ without feedback, bug reports, or patches from: Andrea Biondo Vincent Le Garrec Khaled Yakdan Kuang-che Wu Josephine Calliotte Konrad Welc + David Carlier ``` Thank you! diff --git a/unicorn_mode/unicornafl b/unicorn_mode/unicornafl index 0bf26f6c..c6d66471 160000 --- a/unicorn_mode/unicornafl +++ b/unicorn_mode/unicornafl @@ -1 +1 @@ -Subproject commit 0bf26f6c2601e1c1c84998551ed7d50b4108fbdf +Subproject commit c6d6647161a32bae88785a618fcd828d1711d9e6 -- cgit 1.4.1