From 255a2c63b4b2eb9019bd9cbce90b2dbf565720c2 Mon Sep 17 00:00:00 2001 From: Mike Aizatsky Date: Fri, 5 Aug 2016 16:29:38 -0700 Subject: [PATCH] [infra] using LDFLAGS with static library linkage --- boringssl/build.sh | 4 ++-- expat/build.sh | 4 ++-- freetype2/build.sh | 7 ++----- infra/base-images/base-clang/env | 2 +- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/boringssl/build.sh b/boringssl/build.sh index 0b24acabd..8f8371bd7 100755 --- a/boringssl/build.sh +++ b/boringssl/build.sh @@ -36,7 +36,7 @@ find . -name "*.a" for F in $fuzzerFiles; do fuzzerName=$(basename $F .cc) echo "Building fuzzer $fuzzerName" - $CXX $CXXFLAGS $LDFLAGS -std=c++11 -o /out/openssl_${fuzzerName} /work/libfuzzer/*.o $F \ - -I /src/boringssl/include ./ssl/libssl.a ./crypto/libcrypto.a + $CXX $CXXFLAGS-std=c++11 -o /out/openssl_${fuzzerName} /work/libfuzzer/*.o $F \ + -I /src/boringssl/include ./ssl/libssl.a ./crypto/libcrypto.a $LDFLAGS done diff --git a/expat/build.sh b/expat/build.sh index 98ec6ac3e..ea3dc3b02 100755 --- a/expat/build.sh +++ b/expat/build.sh @@ -7,6 +7,6 @@ cd /src/expat/expat ./configure make clean all -$CXX $CXXFLAGS $LDFLAGS -std=c++11 -Ilib/ \ +$CXX $CXXFLAGS -std=c++11 -Ilib/ \ /src/oss-fuzz/expat/parse_fuzzer.cc -o /out/expat_parse_fuzzer \ - /work/libfuzzer/*.o .libs/libexpat.a + /work/libfuzzer/*.o .libs/libexpat.a $LDFLAGS diff --git a/freetype2/build.sh b/freetype2/build.sh index c441fe0c1..578c7c76b 100755 --- a/freetype2/build.sh +++ b/freetype2/build.sh @@ -23,9 +23,6 @@ cd /src/freetype2/ ./configure make -$CXX $CXXFLAGS $LDFLAGS -std=c++11 ./src/tools/ftfuzzer/ftfuzzer.cc \ +$CXX $CXXFLAGS -std=c++11 ./src/tools/ftfuzzer/ftfuzzer.cc -o /out/freetype2_fuzzer \ ./objs/*.o /work/libfuzzer/*.o \ - -nodefaultlibs -Wl,-Bdynamic -lpthread -lrt -lm -ldl -lgcc_s -lgcc -lc \ - -Wl,-Bstatic -lc++ -lc++abi \ - -larchive -I./include -I. ./objs/.libs/libfreetype.a \ - -o /out/freetype2_fuzzer + -larchive -I./include -I. ./objs/.libs/libfreetype.a $LDFLAGS diff --git a/infra/base-images/base-clang/env b/infra/base-images/base-clang/env index 56bcc09dd..2c8f6289e 100644 --- a/infra/base-images/base-clang/env +++ b/infra/base-images/base-clang/env @@ -28,7 +28,7 @@ popd > /dev/null export CFLAGS="-g $sanitizer_flags $cov_flags" export LIBCXX_FLAGS="-stdlib=libc++" export CXXFLAGS="$CFLAGS $LIBCXX_FLAGS " -export LDFLAGS="-lc++abi" +export LDFLAGS="-nodefaultlibs -Wl,-Bdynamic -lpthread -lrt -lm -ldl -lgcc_s -lgcc -lc -Wl,-Bstatic -lc++ -lc++abi" echo "CC=$CC" echo "CXX=$CXX"