about summary refs log tree commit diff
path: root/GNUmakefile
diff options
context:
space:
mode:
authorChristian Holler (:decoder) <choller@mozilla.com>2024-01-30 15:30:18 +0100
committerGitHub <noreply@github.com>2024-01-30 14:30:18 +0000
commit644e0694509d4019e6f5075c4b900d412f29df32 (patch)
treef50a160ec5ff6c9282bf7aaa52bf27f8c6edea94 /GNUmakefile
parent75af391408086ee0f1cd892dadb6df2fb16d05c3 (diff)
downloadafl++-644e0694509d4019e6f5075c4b900d412f29df32.tar.gz
Fixes to afl-cc and documentation (#1974)
* Always compile with -ldl when building for CODE_COVERAGE

When building with CODE_COVERAGE, the afl runtime contains code that
calls `dladdr` which requires -ldl. Under most circumstances, clang
already adds this (e.g. when building with pc-table), but there are some
circumstances where it isn't added automatically.

* Add visibility declaration to __afl_connected

When building with hidden visibility, the use of __AFL_LOOP inside such
code can cause linker errors due to __afl_connected being declared
"hidden".

* Update docs to clarify that CODE_COVERAGE=1 is required for dynamic_covfilter
Diffstat (limited to 'GNUmakefile')
-rw-r--r--GNUmakefile4
1 files changed, 4 insertions, 0 deletions
diff --git a/GNUmakefile b/GNUmakefile
index b67f9c15..be5b8146 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -66,6 +66,10 @@ ifdef MSAN_BUILD
   override LDFLAGS += -fsanitize=memory
 endif
 
+ifdef CODE_COVERAGE
+  override CFLAGS += -D__AFL_CODE_COVERAGE=1
+endif
+
 ifeq "$(findstring android, $(shell $(CC) --version 2>/dev/null))" ""
 ifeq "$(shell echo 'int main() {return 0; }' | $(CC) $(CFLAGS) -Werror -x c - -flto=full -o .test 2>/dev/null && echo 1 || echo 0 ; rm -f .test )" "1"
 	CFLAGS_FLTO ?= -flto=full