From d92c122155c1935bfba91582486ef826491961b8 Mon Sep 17 00:00:00 2001 From: Sebastian Pipping Date: Fri, 17 Jul 2020 00:24:27 +0200 Subject: [PATCH] [expat] Fix AddressSanitizer link errors (fixes #4143) (#4148) --- projects/expat/build.sh | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/projects/expat/build.sh b/projects/expat/build.sh index 21c4f5110..333d2584c 100755 --- a/projects/expat/build.sh +++ b/projects/expat/build.sh @@ -15,9 +15,33 @@ # ################################################################################ +: ${LD:="${CXX}"} +: ${LDFLAGS:="${CXXFLAGS}"} # to make sure we link with sanitizer runtime + +cmake_args=( + # Specific to Expat + -DEXPAT_BUILD_FUZZERS=ON + -DEXPAT_OSSFUZZ_BUILD=ON + -DEXPAT_SHARED_LIBS=OFF + + # C compiler + -DCMAKE_C_COMPILER="${CC}" + -DCMAKE_C_FLAGS="${CFLAGS}" + + # C++ compiler + -DCMAKE_CXX_COMPILER="${CXX}" + -DCMAKE_CXX_FLAGS="${CXXFLAGS}" + + # Linker + -DCMAKE_LINKER="${LD}" + -DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" + -DCMAKE_MODULE_LINKER_FLAGS="${LDFLAGS}" + -DCMAKE_SHARED_LINKER_FLAGS="${LDFLAGS}" +) + mkdir -p build cd build -cmake ../expat -DEXPAT_BUILD_FUZZERS=ON -DEXPAT_OSSFUZZ_BUILD=ON -DEXPAT_SHARED_LIBS=OFF +cmake ../expat "${cmake_args[@]}" make -j$(nproc) for fuzzer in fuzz/*;