summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2012-11-06 13:32:53 +0000
committerDmitry Vyukov <dvyukov@google.com>2012-11-06 13:32:53 +0000
commit65c445c462f3f9f79c28ee2f3a8cf297176a55af (patch)
tree3a28a70be74b297d73f6543a9dbb2af7b8a51351
parent6da4354df86f535b479d45a4adbba31af4634f46 (diff)
downloadcompiler-rt-65c445c462f3f9f79c28ee2f3a8cf297176a55af.tar.gz
tsan: update script to support windows
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@167456 91177308-0d34-0410-b5e6-96231b3b80d8
-rwxr-xr-xlib/tsan/go/buildgo.sh45
1 files changed, 23 insertions, 22 deletions
diff --git a/lib/tsan/go/buildgo.sh b/lib/tsan/go/buildgo.sh
index 9d290d14e..e7e27c8a6 100755
--- a/lib/tsan/go/buildgo.sh
+++ b/lib/tsan/go/buildgo.sh
@@ -1,17 +1,6 @@
#!/bin/bash
set -e
-if [ "`uname -a | grep Linux`" != "" ]; then
- LINUX=1
- SUFFIX="linux_amd64"
-elif [ "`uname -a | grep Darwin`" != "" ]; then
- MAC=1
- SUFFIX="darwin_amd64"
-else
- echo Unknown platform
- exit 1
-fi
-
SRCS="
tsan_go.cc
../rtl/tsan_clock.cc
@@ -30,47 +19,59 @@ SRCS="
../../sanitizer_common/sanitizer_common.cc
../../sanitizer_common/sanitizer_flags.cc
../../sanitizer_common/sanitizer_libc.cc
- ../../sanitizer_common/sanitizer_posix.cc
../../sanitizer_common/sanitizer_printf.cc
"
-if [ "$LINUX" != "" ]; then
+if [ "`uname -a | grep Linux`" != "" ]; then
+ SUFFIX="linux_amd64"
+ OSCFLAGS="-fPIC -ffreestanding"
+ OSLDFLAGS="-lpthread"
SRCS+="
../rtl/tsan_platform_linux.cc
+ ../../sanitizer_common/sanitizer_posix.cc
../../sanitizer_common/sanitizer_linux.cc
"
-elif [ "$MAC" != "" ]; then
+elif [ "`uname -a | grep Darwin`" != "" ]; then
+ SUFFIX="darwin_amd64"
+ OSCFLAGS="-fPIC"
+ OSLDFLAGS="-lpthread"
SRCS+="
../rtl/tsan_platform_mac.cc
+ ../../sanitizer_common/sanitizer_posix.cc
../../sanitizer_common/sanitizer_mac.cc
"
+elif [ "`uname -a | grep MINGW`" != "" ]; then
+ SUFFIX="windows_amd64"
+ OSCFLAGS="-Wno-error=attributes -Wno-attributes"
+ OSLDFLAGS=""
+ SRCS+="
+ ../rtl/tsan_platform_windows.cc
+ ../../sanitizer_common/sanitizer_win.cc
+ "
+else
+ echo Unknown platform
+ exit 1
fi
SRCS+=$ADD_SRCS
-#ASMS="../rtl/tsan_rtl_amd64.S"
rm -f gotsan.cc
for F in $SRCS; do
cat $F >> gotsan.cc
done
-FLAGS=" -I../rtl -I../.. -I../../sanitizer_common -I../../../include -fPIC -Wall -Werror -fno-exceptions -DTSAN_GO -DSANITIZER_GO -DTSAN_SHADOW_COUNT=4"
+FLAGS=" -I../rtl -I../.. -I../../sanitizer_common -I../../../include -m64 -Wall -Werror -fno-exceptions -DTSAN_GO -DSANITIZER_GO -DTSAN_SHADOW_COUNT=4 $OSCFLAGS"
if [ "$DEBUG" == "" ]; then
FLAGS+=" -DTSAN_DEBUG=0 -O3 -fomit-frame-pointer"
else
FLAGS+=" -DTSAN_DEBUG=1 -g"
fi
-if [ "$LINUX" != "" ]; then
- FLAGS+=" -ffreestanding"
-fi
-
echo gcc gotsan.cc -S -o tmp.s $FLAGS $CFLAGS
gcc gotsan.cc -S -o tmp.s $FLAGS $CFLAGS
cat tmp.s $ASMS > gotsan.s
echo as gotsan.s -o race_$SUFFIX.syso
as gotsan.s -o race_$SUFFIX.syso
-gcc test.c race_$SUFFIX.syso -lpthread -o test
+gcc test.c race_$SUFFIX.syso -m64 -o test $OSLDFLAGS
TSAN_OPTIONS="exitcode=0" ./test
-