1#!/bin/bash 2set -e 3 4# Collect interceptor names from a source file. 5function collect() { 6 while read line ; do 7 if [[ $line =~ ^(.*)((TSAN_INTERCEPT|INTERCEPT_FUNCTION)\()([a-z,A-Z,0-9,_]+)(.*)$ ]] ; then 8 results+=" ${BASH_REMATCH[4]}" 9 results+=" __interceptor_${BASH_REMATCH[4]}" 10 fi 11 done < "$1" 12} 13 14# Interface functions. 15results+=" __tsan_init" 16results+=" __tsan_read*" 17results+=" __tsan_write*" 18results+=" __tsan_vptr*" 19results+=" __tsan_func*" 20results+=" __tsan_atomic*" 21results+=" __tsan_java*" 22results+=" __tsan_unaligned*" 23results+=" __tsan_release" 24results+=" __tsan_acquire" 25results+=" __sanitizer_unaligned*" 26results+=" __sanitizer_syscall*" 27results+=" _Znwm" 28results+=" _Znam" 29results+=" _ZnwmRKSt9nothrow_t" 30results+=" _ZnamRKSt9nothrow_t" 31results+=" _ZdlPv" 32results+=" _ZdlPvRKSt9nothrow_t" 33results+=" _ZdaPv" 34results+=" _ZdaPvRKSt9nothrow_t" 35results+=" Annotate*" 36results+=" WTFAnnotate*" 37results+=" RunningOnValgrind" 38 39collect rtl/tsan_interceptors.cc 40collect ../sanitizer_common/sanitizer_common_interceptors.inc 41 42results=`for i in $results; do echo $i; done | sort -f` 43echo "# AUTO GENERATED by compiler-rt/lib/tsan/gen_dynamic_list.sh; EDITING IS FUTILE." 44echo "{" 45NM=`nm rtl/libtsan.a` 46for i in $results; do 47 # Remove symbols that are not present in the library. 48 if [[ $NM =~ " $i" ]]; then 49 echo " $i;" 50 else if [[ $i == *"*" ]]; then 51 echo " $i;" 52 fi 53 fi 54done 55echo "};" 56 57