]> git.ipfire.org Git - thirdparty/git.git/commit
meson: support building fuzzers with libFuzzer
authorPatrick Steinhardt <ps@pks.im>
Wed, 24 Jun 2026 08:23:04 +0000 (10:23 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 24 Jun 2026 16:30:24 +0000 (09:30 -0700)
commitfa753e3fe8d1a7010c384babc0af0ec7064c1868
treea7d3580c8896df613eaf94f1541206033f674855
parent94f057755b7941b321fd11fec1b2e3ca5313a4e0
meson: support building fuzzers with libFuzzer

To support fuzzing via libFuzzer one has to pass a couple of compiler
options:

  - It is mandatory to enable the "fuzzer-no-link" sanitizer for
    coverage feedback.

  - It is recommended to enable at least one more sanitizer to catch
    issues, like the "address" sanitizer.

  - The fuzzing executables need to be linked with "-fsanitize=fuzzer"
    to wire up libFuzzer itself.

The first two items can already be achieved via the "-Db_sanitize="
option. But the last item cannot easily be achieved, as we can only
configure global link arguments.

Introduce a new "-Dfuzzers_link_args=" build option to plug this gap.
Add documentation so that users know how to set up libFuzzer.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
meson.build
meson_options.txt
oss-fuzz/meson.build