1 #!/bin/bash 2 set -e 3 4 # Collect interceptor names from a source file. 5 function 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. 15 results+=" __tsan_init" 16 results+=" __tsan_read*" 17 results+=" __tsan_write*" 18 results+=" __tsan_vptr*" 19 results+=" __tsan_func*" 20 results+=" __tsan_atomic*" 21 results+=" __tsan_java*" 22 results+=" __tsan_unaligned*" 23 results+=" __tsan_release" 24 results+=" __tsan_acquire" 25 results+=" __sanitizer_unaligned*" 26 results+=" __sanitizer_syscall*" 27 results+=" _Znwm" 28 results+=" _Znam" 29 results+=" _ZnwmRKSt9nothrow_t" 30 results+=" _ZnamRKSt9nothrow_t" 31 results+=" _ZdlPv" 32 results+=" _ZdlPvRKSt9nothrow_t" 33 results+=" _ZdaPv" 34 results+=" _ZdaPvRKSt9nothrow_t" 35 results+=" Annotate*" 36 results+=" WTFAnnotate*" 37 results+=" RunningOnValgrind" 38 39 collect rtl/tsan_interceptors.cc 40 collect ../sanitizer_common/sanitizer_common_interceptors.inc 41 42 results=`for i in $results; do echo $i; done | sort -f` 43 echo "# AUTO GENERATED by compiler-rt/lib/tsan/gen_dynamic_list.sh; EDITING IS FUTILE." 44 echo "{" 45 NM=`nm rtl/libtsan.a` 46 for 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 54 done 55 echo "};" 56 57