Skip to content

Commit aeb3fda

Browse files
committed
add details for usage in README
1 parent eaac2d6 commit aeb3fda

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,29 @@ And finally, run the fuzzer:
6161
$ ./target/debug/fuzzed
6262
```
6363

64+
### Linking to a local libfuzzer
65+
66+
When using `libfuzzer-sys`, you can provide your own `libfuzzer` runtime in two ways.
67+
68+
If you are developing a fuzzer, you can set the `CUSTOM_LIBFUZZER_PATH` environment variable to the path of your local
69+
libfuzzer runtime, which will then be linked instead of building libfuzzer as part of the build stage of `libfuzzer-sys`.
70+
For an example, to link to a prebuilt LLVM 16 libfuzzer, you could use:
71+
72+
```bash
73+
$ export CUSTOM_LIBFUZZER_PATH=/usr/lib64/clang/16/lib/libclang_rt.fuzzer-x86_64.a
74+
$ cargo fuzz run ...
75+
```
76+
77+
Alternatively, you may also disable the default `link_libfuzzer` feature:
78+
79+
In `Cargo.toml`:
80+
```toml
81+
[dependencies]
82+
libfuzzer-sys = { path = "../../libfuzzer", default-features = false }
83+
```
84+
85+
Then link to your own runtime in your `build.rs`.
86+
6487
## Updating libfuzzer from upstream
6588

6689
```

0 commit comments

Comments
 (0)