9 ../rtl/tsan_interface_atomic.cc
14 ../rtl/tsan_rtl_mutex.cc
15 ../rtl/tsan_rtl_report.cc
16 ../rtl/tsan_rtl_thread.cc
17 ../rtl/tsan_stack_trace.cc
19 ../rtl/tsan_suppressions.cc
21 ../../sanitizer_common/sanitizer_allocator.cc
22 ../../sanitizer_common/sanitizer_common.cc
23 ../../sanitizer_common/sanitizer_deadlock_detector2.cc
24 ../../sanitizer_common/sanitizer_flag_parser.cc
25 ../../sanitizer_common/sanitizer_flags.cc
26 ../../sanitizer_common/sanitizer_libc.cc
27 ../../sanitizer_common/sanitizer_persistent_allocator.cc
28 ../../sanitizer_common/sanitizer_printf.cc
29 ../../sanitizer_common/sanitizer_suppressions.cc
30 ../../sanitizer_common/sanitizer_thread_registry.cc
31 ../../sanitizer_common/sanitizer_stackdepot.cc
32 ../../sanitizer_common/sanitizer_stacktrace.cc
33 ../../sanitizer_common/sanitizer_symbolizer.cc
36 if [ "`uname -a | grep Linux`" != "" ]; then
38 OSCFLAGS="-fPIC -ffreestanding -Wno-maybe-uninitialized -Wno-unused-const-variable -Werror -Wno-unknown-warning-option"
39 OSLDFLAGS="-lpthread -lrt -fPIC -fpie"
42 ../rtl/tsan_platform_linux.cc
43 ../../sanitizer_common/sanitizer_posix.cc
44 ../../sanitizer_common/sanitizer_posix_libcdep.cc
45 ../../sanitizer_common/sanitizer_procmaps_common.cc
46 ../../sanitizer_common/sanitizer_procmaps_linux.cc
47 ../../sanitizer_common/sanitizer_linux.cc
48 ../../sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
50 elif [ "`uname -a | grep FreeBSD`" != "" ]; then
51 SUFFIX="freebsd_amd64"
52 OSCFLAGS="-fno-strict-aliasing -fPIC -Werror"
53 OSLDFLAGS="-lpthread -fPIC -fpie"
56 ../rtl/tsan_platform_linux.cc
57 ../../sanitizer_common/sanitizer_posix.cc
58 ../../sanitizer_common/sanitizer_posix_libcdep.cc
59 ../../sanitizer_common/sanitizer_procmaps_common.cc
60 ../../sanitizer_common/sanitizer_procmaps_freebsd.cc
61 ../../sanitizer_common/sanitizer_linux.cc
62 ../../sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
64 elif [ "`uname -a | grep Darwin`" != "" ]; then
66 OSCFLAGS="-fPIC -Wno-unused-const-variable -Wno-unknown-warning-option"
67 OSLDFLAGS="-lpthread -fPIC -fpie"
70 ../rtl/tsan_platform_mac.cc
71 ../../sanitizer_common/sanitizer_mac.cc
72 ../../sanitizer_common/sanitizer_posix.cc
73 ../../sanitizer_common/sanitizer_posix_libcdep.cc
74 ../../sanitizer_common/sanitizer_procmaps_mac.cc
76 elif [ "`uname -a | grep MINGW`" != "" ]; then
77 SUFFIX="windows_amd64"
78 OSCFLAGS="-Wno-error=attributes -Wno-attributes -Wno-unused-const-variable -Wno-unknown-warning-option"
82 ../rtl/tsan_platform_windows.cc
83 ../../sanitizer_common/sanitizer_win.cc
91 IN_TMPDIR=${IN_TMPDIR:-0}
94 if [ $IN_TMPDIR != "0" ]; then
95 DIR=$(mktemp -qd /tmp/gotsan.XXXXXXXXXX)
104 SRCS="$SRCS $ADD_SRCS"
108 cat $F >> $DIR/gotsan.cc
111 FLAGS=" -I../rtl -I../.. -I../../sanitizer_common -I../../../include -std=c++11 -m64 -Wall -fno-exceptions -fno-rtti -DSANITIZER_GO -DSANITIZER_DEADLOCK_DETECTOR_VERSION=2 $OSCFLAGS"
112 if [ "$DEBUG" = "" ]; then
113 FLAGS="$FLAGS -DSANITIZER_DEBUG=0 -O3 -msse3 -fomit-frame-pointer"
115 FLAGS="$FLAGS -DSANITIZER_DEBUG=1 -g"
118 if [ "$SILENT" != "1" ]; then
119 echo $CC gotsan.cc -c -o $DIR/race_$SUFFIX.syso $FLAGS $CFLAGS
121 $CC $DIR/gotsan.cc -c -o $DIR/race_$SUFFIX.syso $FLAGS $CFLAGS
123 $CC test.c $DIR/race_$SUFFIX.syso -m64 -o $DIR/test $OSLDFLAGS
125 export GORACE="exitcode=0 atexit_sleep_ms=0"
126 if [ "$SILENT" != "1" ]; then
129 $DIR/test 2>/dev/null