Skip to content

Commit

Permalink
Merge pull request #969 from pjbgf/postbuild
Browse files Browse the repository at this point in the history
build: Link libgit2 via LIB_FUZZING_ENGINE
  • Loading branch information
Paulo Gomes authored Nov 25, 2022
2 parents 7bfbb15 + aff16b9 commit 04d87b6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
6 changes: 5 additions & 1 deletion tests/fuzz/oss_fuzz_postbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,14 @@ set -euxo pipefail
# Use it for unsetting any environment variables that may impact other building
# processes.

if [[ -n "${PRE_LIB_FUZZING_ENGINE}" ]]; then
export LIB_FUZZING_ENGINE="${PRE_LIB_FUZZING_ENGINE}"
fi

unset TARGET_DIR
unset CGO_ENABLED
unset LIBRARY_PATH
unset PKG_CONFIG_PATH
unset CGO_CFLAGS
unset CGO_LDFLAGS
unset ADDITIONAL_LIBS
unset PRE_LIB_FUZZING_ENGINE
13 changes: 12 additions & 1 deletion tests/fuzz/oss_fuzz_prebuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,15 @@ export PKG_CONFIG_PATH="${TARGET_DIR}/lib/pkgconfig"
export CGO_CFLAGS="-I${TARGET_DIR}/include"
export CGO_LDFLAGS="$(pkg-config --libs --static --cflags libgit2)"

export ADDITIONAL_LIBS="${TARGET_DIR}/lib/libgit2.a"
# Temporary hack whilst libgit2 is still in use.
# Enables the fuzzing compilation to link libgit2.
#
# After building the fuzzers, the value of
# LIB_FUZZING_ENGINE is reset to what it was before
# it to avoid side effects onto other repositories.
#
# For context refer to:
# https://github.com/google/oss-fuzz/pull/9063
export PRE_LIB_FUZZING_ENGINE="${LIB_FUZZING_ENGINE}"

export LIB_FUZZING_ENGINE="${LIB_FUZZING_ENGINE} -Wl,--start-group ${TARGET_DIR}/lib/libgit2.a"

0 comments on commit 04d87b6

Please sign in to comment.