about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDavid CARLIER <devnexen@gmail.com>2020-09-26 18:02:19 +0100
committerGitHub <noreply@github.com>2020-09-26 19:02:19 +0200
commite85fde201e988cf9e7cf608be394977f7c045a75 (patch)
treef246e56c69f8a09247a23ce797da408854fe4a99
parente301822c684b4948ca5e21b40f437940469238f5 (diff)
downloadafl++-e85fde201e988cf9e7cf608be394977f7c045a75.tar.gz
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
-rw-r--r--GNUmakefile5
-rw-r--r--GNUmakefile.gcc_plugin8
-rw-r--r--GNUmakefile.llvm2
-rw-r--r--README.md1
m---------unicorn_mode/unicornafl0
5 files changed, 15 insertions, 1 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 <sys/ipc.h>@$(HASH)include <sys/shm.h>@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
-Subproject 0bf26f6c2601e1c1c84998551ed7d50b4108fbd
+Subproject c6d6647161a32bae88785a618fcd828d1711d9e