summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexey Samsonov <vonosmas@gmail.com>2015-12-07 20:18:50 +0000
committerAlexey Samsonov <vonosmas@gmail.com>2015-12-07 20:18:50 +0000
commita8bf5099d60c00cbe038200a77f3cee1c56ffa78 (patch)
treef7d4f14ba8d9d55ffc42256f53c9a7db885a08d2
parentcbc12262e3219cdcfdedd11b2321280cb520a3bf (diff)
downloadbcm5719-llvm-a8bf5099d60c00cbe038200a77f3cee1c56ffa78.tar.gz
bcm5719-llvm-a8bf5099d60c00cbe038200a77f3cee1c56ffa78.zip
[TSan] Slightly improve check_analyze script.
De-hardcode path to TSan-ified executable: pass it as an input to the scripts. Fix them so that they don't write to the current directory. Remove their invocation from Makefile.old: they are broken there anyway, as check_analyze.sh now matches trunk Clang. llvm-svn: 254936
-rw-r--r--compiler-rt/lib/tsan/Makefile.old1
-rwxr-xr-xcompiler-rt/lib/tsan/analyze_libtsan.sh23
-rwxr-xr-xcompiler-rt/lib/tsan/check_analyze.sh12
3 files changed, 28 insertions, 8 deletions
diff --git a/compiler-rt/lib/tsan/Makefile.old b/compiler-rt/lib/tsan/Makefile.old
index 72b472d4939..79f5d8a5310 100644
--- a/compiler-rt/lib/tsan/Makefile.old
+++ b/compiler-rt/lib/tsan/Makefile.old
@@ -79,7 +79,6 @@ presubmit:
$(MAKE) -f Makefile.old clean
$(MAKE) -f Makefile.old run DEBUG=0 -j 16 CC=gcc CXX=g++
./check_memcpy.sh
- ./check_analyze.sh
# Sanity check for Go runtime
(cd go && ./buildgo.sh)
# Check cmake build
diff --git a/compiler-rt/lib/tsan/analyze_libtsan.sh b/compiler-rt/lib/tsan/analyze_libtsan.sh
index 705e4c5460f..ae29f1b5b05 100755
--- a/compiler-rt/lib/tsan/analyze_libtsan.sh
+++ b/compiler-rt/lib/tsan/analyze_libtsan.sh
@@ -1,10 +1,17 @@
#!/bin/bash
+#
+# Script that prints information about generated code in TSan runtime.
set -e
set -u
+if [[ "$#" != 1 ]]; then
+ echo "Usage: $0 /path/to/binary/built/with/tsan"
+ exit 1
+fi
+
get_asm() {
- grep __tsan_$1.: -A 10000 libtsan.objdump | \
+ grep __tsan_$1.: -A 10000 ${OBJDUMP_CONTENTS} | \
awk "/[^:]$/ {print;} />:/ {c++; if (c == 2) {exit}}"
}
@@ -19,15 +26,19 @@ list="write1 \
func_entry \
func_exit"
-BIN=`dirname $0`/tsan_test
-objdump -d $BIN > libtsan.objdump
-nm -S $BIN | grep "__tsan_" > libtsan.nm
+BIN=$1
+OUTPUT_DIR=$(mktemp -t -d analyze_libtsan_out.XXXXXXXX)
+OBJDUMP_CONTENTS=${OUTPUT_DIR}/libtsan_objdump
+NM_CONTENTS=${OUTPUT_DIR}/libtsan_nm
+
+objdump -d $BIN > ${OBJDUMP_CONTENTS}
+nm -S $BIN | grep "__tsan_" > ${NM_CONTENTS}
for f in $list; do
- file=asm_$f.s
+ file=${OUTPUT_DIR}/asm_$f.s
get_asm $f > $file
tot=$(wc -l < $file)
- size=$(grep __tsan_$f$ libtsan.nm | awk --non-decimal-data '{print ("0x"$2)+0}')
+ size=$(grep __tsan_$f$ ${NM_CONTENTS} | awk --non-decimal-data '{print ("0x"$2)+0}')
rsp=$(grep '(%rsp)' $file | wc -l)
push=$(grep 'push' $file | wc -l)
pop=$(grep 'pop' $file | wc -l)
diff --git a/compiler-rt/lib/tsan/check_analyze.sh b/compiler-rt/lib/tsan/check_analyze.sh
index 9d45cc00c97..0f6cc069847 100755
--- a/compiler-rt/lib/tsan/check_analyze.sh
+++ b/compiler-rt/lib/tsan/check_analyze.sh
@@ -1,7 +1,17 @@
#!/bin/bash
+#
+# Script that checks that critical functions in TSan runtime have correct number
+# of push/pop/rsp instructions to verify that runtime is efficient enough.
+
set -u
-RES=$(./analyze_libtsan.sh)
+if [[ "$#" != 1 ]]; then
+ echo "Usage: $0 /path/to/binary/built/with/tsan"
+ exit 1
+fi
+
+SCRIPTDIR=$(dirname $0)
+RES=$(${SCRIPTDIR}/analyze_libtsan.sh $1)
PrintRes() {
printf "%s\n" "$RES"
}
OpenPOWER on IntegriCloud