aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhexcoder- <heiko@hexco.de>2020-03-28 09:31:30 +0100
committerhexcoder- <heiko@hexco.de>2020-03-28 09:31:30 +0100
commit4ad885001a0d05657562e2d89a6bbe60dae45fe0 (patch)
tree5ec002b1390c85d60e9c581cd5be8ca0cb4df7bd
parenta0dec909e76f492a7958050f101eebef1a998a44 (diff)
downloadafl++-4ad885001a0d05657562e2d89a6bbe60dae45fe0.tar.gz
making 'CFLAGS="-m32" make source-only tests' work
-rw-r--r--gcc_plugin/Makefile12
-rw-r--r--libdislocator/Makefile2
-rw-r--r--libtokencap/Makefile2
-rw-r--r--llvm_mode/LLVMInsTrim.so.cc2
-rw-r--r--llvm_mode/afl-llvm-pass.so.cc2
-rw-r--r--src/third_party/libradamsa/libradamsa.c2
-rwxr-xr-xtest/test.sh2
7 files changed, 17 insertions, 7 deletions
diff --git a/gcc_plugin/Makefile b/gcc_plugin/Makefile
index 506d690d..df8bd9cb 100644
--- a/gcc_plugin/Makefile
+++ b/gcc_plugin/Makefile
@@ -29,7 +29,7 @@ MAN_PATH ?= $(PREFIX)/man/man8
VERSION = $(shell grep '^$(HASH)define VERSION ' ../config.h | cut -d '"' -f2)
CFLAGS ?= -O3 -g -funroll-loops
-CFLAGS += -Wall -I../include -D_FORTIFY_SOURCE=2 -Wno-pointer-sign \
+override CFLAGS = -Wall -I../include -D_FORTIFY_SOURCE=2 -Wno-pointer-sign \
-DAFL_PATH=\"$(HELPER_PATH)\" -DBIN_PATH=\"$(BIN_PATH)\" \
-DGCC_VERSION=\"$(GCCVER)\" -DGCC_BINDIR=\"$(GCCBINDIR)\" \
-Wno-unused-function
@@ -40,6 +40,16 @@ CXXEFLAGS := $(CXXFLAGS) -Wall -D_FORTIFY_SOURCE=2
CC ?= gcc
CXX ?= g++
+ifeq "clang" "$(CC)"
+ CC = gcc
+ CXX = g++
+endif
+
+ifeq "clang++" "$(CXX)"
+ CC = gcc
+ CXX = g++
+endif
+
PLUGIN_FLAGS = -fPIC -fno-rtti -I"$(shell $(CC) -print-file-name=plugin)/include"
HASH=\#
diff --git a/libdislocator/Makefile b/libdislocator/Makefile
index 07d98a0d..3ee37088 100644
--- a/libdislocator/Makefile
+++ b/libdislocator/Makefile
@@ -19,7 +19,7 @@ HELPER_PATH = $(PREFIX)/lib/afl
VERSION = $(shell grep '^\#define VERSION ' ../config.h | cut -d '"' -f2)
CFLAGS ?= -O3 -funroll-loops
-CFLAGS += -I ../include/ -Wall -D_FORTIFY_SOURCE=2 -g -Wno-pointer-sign
+override CFLAGS += -I ../include/ -Wall -D_FORTIFY_SOURCE=2 -g -Wno-pointer-sign
ifdef USEHUGEPAGE
CFLAGS += -DUSEHUGEPAGE
diff --git a/libtokencap/Makefile b/libtokencap/Makefile
index 4889479b..5fcd7731 100644
--- a/libtokencap/Makefile
+++ b/libtokencap/Makefile
@@ -21,7 +21,7 @@ MAN_PATH ?= $(PREFIX)/man/man8
VERSION = $(shell grep '^\#define VERSION ' ../config.h | cut -d '"' -f2)
CFLAGS ?= -O3 -funroll-loops
-CFLAGS += -I ../include/ -Wall -D_FORTIFY_SOURCE=2 -g -Wno-pointer-sign
+override CFLAGS += -I ../include/ -Wall -D_FORTIFY_SOURCE=2 -g -Wno-pointer-sign
ifeq "$(shell uname)" "Linux"
TARGETS = libtokencap.so
diff --git a/llvm_mode/LLVMInsTrim.so.cc b/llvm_mode/LLVMInsTrim.so.cc
index c4033523..8b23942c 100644
--- a/llvm_mode/LLVMInsTrim.so.cc
+++ b/llvm_mode/LLVMInsTrim.so.cc
@@ -509,7 +509,7 @@ struct InsTrim : public ModulePass {
if (!be_quiet) {
char modeline[100];
- snprintf(modeline, sizeof(modeline), "%s%s%s%s",
+ snprintf(modeline, sizeof(modeline), "%s%s%s%s%s",
getenv("AFL_HARDEN") ? "hardened" : "non-hardened",
getenv("AFL_USE_ASAN") ? ", ASAN" : "",
getenv("AFL_USE_MSAN") ? ", MSAN" : "",
diff --git a/llvm_mode/afl-llvm-pass.so.cc b/llvm_mode/afl-llvm-pass.so.cc
index f6ead9ec..3b0e1fda 100644
--- a/llvm_mode/afl-llvm-pass.so.cc
+++ b/llvm_mode/afl-llvm-pass.so.cc
@@ -587,7 +587,7 @@ bool AFLCoverage::runOnModule(Module &M) {
else {
char modeline[100];
- snprintf(modeline, sizeof(modeline), "%s%s%s%s",
+ snprintf(modeline, sizeof(modeline), "%s%s%s%s%s",
getenv("AFL_HARDEN") ? "hardened" : "non-hardened",
getenv("AFL_USE_ASAN") ? ", ASAN" : "",
getenv("AFL_USE_MSAN") ? ", MSAN" : "",
diff --git a/src/third_party/libradamsa/libradamsa.c b/src/third_party/libradamsa/libradamsa.c
index f3677fa7..fe91594e 100644
--- a/src/third_party/libradamsa/libradamsa.c
+++ b/src/third_party/libradamsa/libradamsa.c
@@ -30815,7 +30815,7 @@ size_t copy_list(uint8_t *ptr, word lispval, size_t max) {
lispval = G(lispval, 2); // list = cdr(list)
}
if (lispval != INULL && max == 0) {
- printf("ERROR: lisp return value was not a proper list. Trailing %lu\n", lispval);
+ printf("ERROR: lisp return value was not a proper list. Trailing %lu\n", (unsigned long)lispval);
}
return n;
}
diff --git a/test/test.sh b/test/test.sh
index 8434aaf1..ec4e71d0 100755
--- a/test/test.sh
+++ b/test/test.sh
@@ -580,7 +580,7 @@ test -e ../afl-gcc-fast -a -e ../afl-gcc-rt.o && {
}
$ECHO "$BLUE[*] Testing: shared library extensions"
-cc -o test-compcov test-compcov.c > /dev/null 2>&1
+cc $CFLAGS -o test-compcov test-compcov.c > /dev/null 2>&1
test -e ../libtokencap.so && {
AFL_TOKEN_FILE=token.out LD_PRELOAD=../libtokencap.so DYLD_INSERT_LIBRARIES=../libtokencap.so DYLD_FORCE_FLAT_NAMESPACE=1 ./test-compcov foobar > /dev/null 2>&1
grep -q BUGMENOT token.out > /dev/null 2>&1 && {