[compiler-rt] 65b4695 - tsan: fix build bugs

Dmitry Vyukov via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 28 01:09:56 PDT 2020


Author: Dmitry Vyukov
Date: 2020-03-28T09:09:39+01:00
New Revision: 65b4695375c6518c0b51a2a4c8392ab9d461e317

URL: https://github.com/llvm/llvm-project/commit/65b4695375c6518c0b51a2a4c8392ab9d461e317
DIFF: https://github.com/llvm/llvm-project/commit/65b4695375c6518c0b51a2a4c8392ab9d461e317.diff

LOG: tsan: fix build bugs

1. Fix expression inside of DCHECK_LE.
2. Add a debug build test to buildgo.sh.
3. Fix race binary path in buildgo.sh.

Added: 
    

Modified: 
    compiler-rt/lib/tsan/go/buildgo.sh
    compiler-rt/lib/tsan/rtl/tsan_clock.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/tsan/go/buildgo.sh b/compiler-rt/lib/tsan/go/buildgo.sh
index 5156bd6f67d3..bd7e06730e51 100755
--- a/compiler-rt/lib/tsan/go/buildgo.sh
+++ b/compiler-rt/lib/tsan/go/buildgo.sh
@@ -150,15 +150,19 @@ for F in $SRCS; do
 done
 
 FLAGS=" -I../rtl -I../.. -I../../sanitizer_common -I../../../include -std=c++11 -Wall -fno-exceptions -fno-rtti -DSANITIZER_GO=1 -DSANITIZER_DEADLOCK_DETECTOR_VERSION=2 $OSCFLAGS $ARCHCFLAGS"
+DEBUG_FLAGS="$FLAGS -DSANITIZER_DEBUG=1 -g"
+FLAGS="$FLAGS -DSANITIZER_DEBUG=0 -O3 -fomit-frame-pointer"
+if [ "$SUFFIX" = "linux_ppc64le" ]; then
+	FLAGS="$FLAGS -mcpu=power8 -fno-function-sections"
+elif [ "$SUFFIX" = "linux_amd64" ]; then
+	FLAGS="$FLAGS -msse3"
+fi
+
 if [ "$DEBUG" = "" ]; then
-	FLAGS="$FLAGS -DSANITIZER_DEBUG=0 -O3 -fomit-frame-pointer"
-	if [ "$SUFFIX" = "linux_ppc64le" ]; then
-		FLAGS="$FLAGS -mcpu=power8 -fno-function-sections"
-	elif [ "$SUFFIX" = "linux_amd64" ]; then
-		FLAGS="$FLAGS -msse3"
-	fi
+	# Do a build test with debug flags.
+	$CC $DIR/gotsan.cpp -c -o $DIR/race_debug_$SUFFIX.syso $DEBUG_FLAGS $CFLAGS
 else
-	FLAGS="$FLAGS -DSANITIZER_DEBUG=1 -g"
+	FLAGS="$DEBUG_FLAGS"
 fi
 
 if [ "$SILENT" != "1" ]; then
@@ -169,7 +173,7 @@ $CC $DIR/gotsan.cpp -c -o $DIR/race_$SUFFIX.syso $FLAGS $CFLAGS
 $CC $OSCFLAGS $ARCHCFLAGS test.c $DIR/race_$SUFFIX.syso -g -o $DIR/test $OSLDFLAGS $LDFLAGS
 
 # Verify that no glibc specific code is present
-if nm race_$SUFFIX.syso | grep -q __libc_; then
+if nm $DIR/race_$SUFFIX.syso | grep -q __libc_; then
 	printf -- '%s seems to link to libc\n' "race_$SUFFIX.syso"
 	exit 1
 fi

diff  --git a/compiler-rt/lib/tsan/rtl/tsan_clock.cpp b/compiler-rt/lib/tsan/rtl/tsan_clock.cpp
index 7989a90837cd..96bbfa1d4cc2 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_clock.cpp
+++ b/compiler-rt/lib/tsan/rtl/tsan_clock.cpp
@@ -187,7 +187,7 @@ void ThreadClock::acquire(ClockCache *c, SyncClock *src) {
 
 void ThreadClock::releaseStoreAcquire(ClockCache *c, SyncClock *sc) {
   DCHECK_LE(nclk_, kMaxTid);
-  DCHECK_LE(dst->size_, kMaxTid);
+  DCHECK_LE(sc->size_, kMaxTid);
 
   if (sc->size_ == 0) {
     // ReleaseStore will correctly set release_store_tid_,


        


More information about the llvm-commits mailing list