Skip to content

Commit

Permalink
doc: update fuzz instructions when on macOS
Browse files Browse the repository at this point in the history
Default linker on macOS does not work with recent versions of LLVM. Updated the instructions for fuzzing to use lld instead.
  • Loading branch information
m3dwards committed Feb 25, 2025
1 parent 0bb8a01 commit c5ef75c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion doc/fuzzing.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,18 @@ You may also need to take care of giving the correct path for `clang` and
`clang++`, like `CC=/path/to/clang CXX=/path/to/clang++` if the non-systems
`clang` does not come first in your path.
Currently the default linker on macOS `ld` does not work with recent versions of `llvm` so you will need to install llvm's linker `lld` and use it with `-fuse-ld=lld`.
Full configuration step that was tested on macOS with `brew` installed `llvm`:
```sh
$ brew install llvm
$ brew install lld
$ cmake --preset=libfuzzer \
-DCMAKE_C_COMPILER="$(brew --prefix llvm)/bin/clang" \
-DCMAKE_CXX_COMPILER="$(brew --prefix llvm)/bin/clang++" \
-DAPPEND_LDFLAGS=-Wl,-no_warn_duplicate_libraries
-DAPPEND_LDFLAGS=-Wl,-no_warn_duplicate_libraries \
-DCMAKE_CXX_FLAGS="-fuse-ld=lld"
```
Read the [libFuzzer documentation](https://llvm.org/docs/LibFuzzer.html) for more information. This [libFuzzer tutorial](https://github.com/google/fuzzing/blob/master/tutorial/libFuzzerTutorial.md) might also be of interest.
Expand Down

0 comments on commit c5ef75c

Please sign in to comment.