From 334aff6761ea7924bdf035d028fd70d3a8f6bf53 Mon Sep 17 00:00:00 2001 From: Dongge Liu Date: Sun, 5 Feb 2023 23:06:43 +1100 Subject: [PATCH] Build weak.o with $CC and omit -lc++ --- infra/base-images/base-builder/compile_centipede | 2 +- infra/base-images/base-builder/precompile_centipede | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/infra/base-images/base-builder/compile_centipede b/infra/base-images/base-builder/compile_centipede index 7e60b2b2017c..e111ec347771 100755 --- a/infra/base-images/base-builder/compile_centipede +++ b/infra/base-images/base-builder/compile_centipede @@ -27,7 +27,7 @@ cp "$BIN_DIR/libcentipede_runner.pic.a" "$LIB_FUZZING_ENGINE" export DFTRACING_FLAGS='-fsanitize-coverage=trace-loads' export CENTIPEDE_FLAGS=`cat "$SRC/centipede/clang-flags.txt" | tr '\n' ' '` -export LIBRARIES_FLAGS="-lc++ -Wno-unused-command-line-argument" +export LIBRARIES_FLAGS="-Wno-unused-command-line-argument" export CFLAGS="$CFLAGS $DFTRACING_FLAGS $CENTIPEDE_FLAGS $LIBRARIES_FLAGS" export CXXFLAGS="$CXXFLAGS $DFTRACING_FLAGS $CENTIPEDE_FLAGS $LIBRARIES_FLAGS" diff --git a/infra/base-images/base-builder/precompile_centipede b/infra/base-images/base-builder/precompile_centipede index 3cc92bd76b7e..8b72079d3c70 100755 --- a/infra/base-images/base-builder/precompile_centipede +++ b/infra/base-images/base-builder/precompile_centipede @@ -30,14 +30,14 @@ bazel --bazelrc=/tmp/centipede.bazelrc build -c opt :all # data-flow tracing flags, but will still throw errors when they cannot find # the corresponding functions. # The weak symbols provides fake implementations for intermediate binaries. -$CXX "$SRC/centipede/weak_sancov_stubs.cc" -c -o "$SRC/centipede/weak.o" +$CC "$SRC/centipede/weak_sancov_stubs.cc" -c -o "$SRC/centipede/weak.o" # Centipede's ld, which always appends weak.o as a parameter. export CENTIPEDE_BIN="$SRC/centipede/bin" mkdir -p $CENTIPEDE_BIN cat << EOF > ${CENTIPEDE_BIN}/ld #!/bin/bash -/usr/bin/ld \$@ -ldl -lrt -lpthread -lc++ /src/centipede/weak.o +/usr/bin/ld \$@ -ldl -lrt -lpthread /src/centipede/weak.o EOF chmod 777 ${CENTIPEDE_BIN}/ld