Skip to content

Commit

Permalink
Build weak.o with $CC and omit -lc++
Browse files Browse the repository at this point in the history
  • Loading branch information
DonggeLiu committed Feb 5, 2023
1 parent 9c536a4 commit 334aff6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion infra/base-images/base-builder/compile_centipede
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions infra/base-images/base-builder/precompile_centipede
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 334aff6

Please sign in to comment.