diff options
author | Andrew Turner <andrew@FreeBSD.org> | 2012-07-30 10:58:13 +0000 |
---|---|---|
committer | Andrew Turner <andrew@FreeBSD.org> | 2012-07-30 10:58:13 +0000 |
commit | 37dfff057418e02f8e5322da12684dd927e3d881 (patch) | |
tree | 40cc44a3d02ed86de24f2117a55680e4f0eb01a0 /lib/tsan/go/buildgo.sh | |
parent | 864a7b98b54e1f984c248f3be83dfcc082a382ea (diff) | |
download | src-37dfff057418e02f8e5322da12684dd927e3d881.tar.gz src-37dfff057418e02f8e5322da12684dd927e3d881.zip |
Import compiler-rt r160957.vendor/compiler-rt/compiler-rt-r160957
Notes
Notes:
svn path=/vendor/compiler-rt/dist/; revision=238901
svn path=/vendor/compiler-rt/compiler-rt-r160957/; revision=238902; tag=vendor/compiler-rt/compiler-rt-r160957
Diffstat (limited to 'lib/tsan/go/buildgo.sh')
-rwxr-xr-x | lib/tsan/go/buildgo.sh | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/lib/tsan/go/buildgo.sh b/lib/tsan/go/buildgo.sh new file mode 100755 index 000000000000..a0d2f6761b41 --- /dev/null +++ b/lib/tsan/go/buildgo.sh @@ -0,0 +1,78 @@ +#!/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 + ../rtl/tsan_flags.cc + ../rtl/tsan_md5.cc + ../rtl/tsan_mutex.cc + ../rtl/tsan_printf.cc + ../rtl/tsan_report.cc + ../rtl/tsan_rtl.cc + ../rtl/tsan_rtl_mutex.cc + ../rtl/tsan_rtl_report.cc + ../rtl/tsan_rtl_thread.cc + ../rtl/tsan_stat.cc + ../rtl/tsan_suppressions.cc + ../rtl/tsan_sync.cc + ../../sanitizer_common/sanitizer_allocator.cc + ../../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 + ../../sanitizer_common/sanitizer_symbolizer.cc +" + +if [ "$LINUX" != "" ]; then + SRCS+=" + ../rtl/tsan_platform_linux.cc + ../../sanitizer_common/sanitizer_linux.cc + " +elif [ "$MAC" != "" ]; then + SRCS+=" + ../rtl/tsan_platform_mac.cc + ../../sanitizer_common/sanitizer_mac.cc + " +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 -fPIC -g -Wall -Werror -fno-exceptions -DTSAN_GO -DSANITIZER_GO -DTSAN_SHADOW_COUNT=4" +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 +TSAN_OPTIONS="exitcode=0" ./test + |