diff options
author | van Hauser <vh@thc.org> | 2023-06-12 10:03:15 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-12 10:03:15 +0300 |
commit | af8c68a774d0271ae6a2145ac566e1c7024e95d5 (patch) | |
tree | d307651ffd5ad2b03d3e97a2b2ccd4d410e16c93 /docs/FAQ.md | |
parent | 26cbc1e99337da4dc82c7c827dc2dac0a3733dc2 (diff) | |
parent | bf2727b76366ce4c9cdc723c3f3ccffae3cc3619 (diff) | |
download | afl++-af8c68a774d0271ae6a2145ac566e1c7024e95d5.tar.gz |
Merge pull request #1766 from AFLplusplus/dev 4.07c
v4.07c release
Diffstat (limited to 'docs/FAQ.md')
-rw-r--r-- | docs/FAQ.md | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/docs/FAQ.md b/docs/FAQ.md index 8178db46..9275eb94 100644 --- a/docs/FAQ.md +++ b/docs/FAQ.md @@ -279,3 +279,54 @@ If you find an interesting or important question missing, submit it via Solution: just do an `export AFL_MAP_SIZE=(the value in the warning)`. </p></details> + +<details> + <summary id="linker-errors">Linker errors.</summary><p> + + If you compile C++ harnesses and see `undefined reference` errors for + variables named `__afl_...`, e.g.: + + ``` + /usr/bin/ld: /tmp/test-d3085f.o: in function `foo::test()': + test.cpp:(.text._ZN3fooL4testEv[_ZN3fooL4testEv]+0x35): undefined reference to `foo::__afl_connected' + clang: error: linker command failed with exit code 1 (use -v to see invocation) + ``` + + Then you use AFL++ macros like `__AFL_LOOP` within a namespace and this + will not work. + + Solution: Move that harness portion to the global namespace, e.g. before: + ``` + #include <cstdio> + namespace foo { + static void test() { + while(__AFL_LOOP(1000)) { + foo::function(); + } + } + } + + int main(int argc, char** argv) { + foo::test(); + return 0; + } + ``` + after: + ``` + #include <cstdio> + static void mytest() { + while(__AFL_LOOP(1000)) { + foo::function(); + } + } + namespace foo { + static void test() { + mytest(); + } + } + int main(int argc, char** argv) { + foo::test(); + return 0; + } + ``` +</p></details> |