diff options
author | Christian Holler (:decoder) <choller@mozilla.com> | 2024-01-30 15:30:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-30 14:30:18 +0000 |
commit | 644e0694509d4019e6f5075c4b900d412f29df32 (patch) | |
tree | f50a160ec5ff6c9282bf7aaa52bf27f8c6edea94 /src | |
parent | 75af391408086ee0f1cd892dadb6df2fb16d05c3 (diff) | |
download | afl++-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 'src')
-rw-r--r-- | src/afl-cc.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/afl-cc.c b/src/afl-cc.c index 73487188..d11419b0 100644 --- a/src/afl-cc.c +++ b/src/afl-cc.c @@ -1521,7 +1521,7 @@ void add_defs_persistent_mode(aflcc_state_t *aflcc) { "({ static volatile const char *_B __attribute__((used,unused)); " " _B = (const char*)\"" PERSIST_SIG "\"; " - "extern int __afl_connected;" + "extern __attribute__((visibility(\"default\"))) int __afl_connected;" #ifdef __APPLE__ "__attribute__((visibility(\"default\"))) " "int _L(unsigned int) __asm__(\"___afl_persistent_loop\"); " @@ -2311,6 +2311,11 @@ void add_runtime(aflcc_state_t *aflcc) { } + #if __AFL_CODE_COVERAGE + // Required for dladdr used in afl-compiler-rt.o + insert_param(aflcc, "-ldl"); + #endif + #if !defined(__APPLE__) && !defined(__sun) if (!aflcc->shared_linking && !aflcc->partial_linking) insert_object(aflcc, "dynamic_list.txt", "-Wl,--dynamic-list=%s", 0); |