]> git.ipfire.org Git - thirdparty/git.git/commit - Makefile
fuzz: fix fuzz test build rules
authorJosh Steadmon <steadmon@google.com>
Fri, 19 Jan 2024 21:38:12 +0000 (13:38 -0800)
committerJunio C Hamano <gitster@pobox.com>
Fri, 19 Jan 2024 22:29:18 +0000 (14:29 -0800)
commit8b9a42bf48abcead132b87834d19199a1b08373c
tree24daba7dd3675522c70825d05a91daf51cc516ac
parent564d0252ca632e0264ed670534a51d18a689ef5d
fuzz: fix fuzz test build rules

When we originally added the fuzz tests in 5e47215080 (fuzz: add basic
fuzz testing target., 2018-10-12), we went to some trouble to create a
Makefile rule that allowed linking the fuzz executables without pulling
in common-main.o. This was necessary to prevent the
fuzzing-engine-provided main() from clashing with Git's main().

However, since 19d75948ef (common-main.c: move non-trace2 exit()
behavior out of trace2.c, 2022-06-02), it has been necessary to link
common-main.o due to moving the common_exit() function to that file.
Ævar suggested a set of compiler flags to allow this in [1], but this
was never reflected in the Makefile.

Since we now must include common-main.o, there's no reason to pick and
choose a subset of object files to link, so simplify the Makefile rule
for the fuzzer executables to just use libgit.a. While we're at it,
include the necessary linker flag to allow multiple definitions
directly in the Makefile rule, rather than requiring it to be passed on
the command-line each time. This means the Makefile rule as written is
now more compiler-specific, but this was already the case for the
fuzzers themselves anyway.

[1] https://lore.kernel.org/git/220607.8635ggupws.gmgdl@evledraar.gmail.com/

Signed-off-by: Josh Steadmon <steadmon@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Makefile
oss-fuzz/dummy-cmd-main.c [new file with mode: 0644]