Skip to content

Commit 04d87b6

Browse files
author
Paulo Gomes
authored
Merge pull request #969 from pjbgf/postbuild
build: Link libgit2 via LIB_FUZZING_ENGINE
2 parents 7bfbb15 + aff16b9 commit 04d87b6

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

tests/fuzz/oss_fuzz_postbuild.sh

+5-1
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,14 @@ set -euxo pipefail
2020
# Use it for unsetting any environment variables that may impact other building
2121
# processes.
2222

23+
if [[ -n "${PRE_LIB_FUZZING_ENGINE}" ]]; then
24+
export LIB_FUZZING_ENGINE="${PRE_LIB_FUZZING_ENGINE}"
25+
fi
26+
2327
unset TARGET_DIR
2428
unset CGO_ENABLED
2529
unset LIBRARY_PATH
2630
unset PKG_CONFIG_PATH
2731
unset CGO_CFLAGS
2832
unset CGO_LDFLAGS
29-
unset ADDITIONAL_LIBS
33+
unset PRE_LIB_FUZZING_ENGINE

tests/fuzz/oss_fuzz_prebuild.sh

+12-1
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,15 @@ export PKG_CONFIG_PATH="${TARGET_DIR}/lib/pkgconfig"
6262
export CGO_CFLAGS="-I${TARGET_DIR}/include"
6363
export CGO_LDFLAGS="$(pkg-config --libs --static --cflags libgit2)"
6464

65-
export ADDITIONAL_LIBS="${TARGET_DIR}/lib/libgit2.a"
65+
# Temporary hack whilst libgit2 is still in use.
66+
# Enables the fuzzing compilation to link libgit2.
67+
#
68+
# After building the fuzzers, the value of
69+
# LIB_FUZZING_ENGINE is reset to what it was before
70+
# it to avoid side effects onto other repositories.
71+
#
72+
# For context refer to:
73+
# https://github.com/google/oss-fuzz/pull/9063
74+
export PRE_LIB_FUZZING_ENGINE="${LIB_FUZZING_ENGINE}"
75+
76+
export LIB_FUZZING_ENGINE="${LIB_FUZZING_ENGINE} -Wl,--start-group ${TARGET_DIR}/lib/libgit2.a"

0 commit comments

Comments
 (0)