tsan: remove non-existent functions from syms file


git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@185077 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/tsan/gen_dynamic_list.sh b/lib/tsan/gen_dynamic_list.sh
index 50e36e7..4868b42 100755
--- a/lib/tsan/gen_dynamic_list.sh
+++ b/lib/tsan/gen_dynamic_list.sh
@@ -1,6 +1,7 @@
 #!/bin/bash
 set -e
 
+# Collect interceptor names from a source file.
 function collect() {
   while read line ; do
     if [[ $line =~ ^(.*)((TSAN_INTERCEPT|INTERCEPT_FUNCTION)\()([a-z,A-Z,0-9,_]+)(.*)$ ]] ; then
@@ -10,6 +11,7 @@
   done < "$1"
 }
 
+# Interface functions.
 results+=" __tsan_init"
 results+=" __tsan_read*"
 results+=" __tsan_write*"
@@ -40,8 +42,15 @@
 results=`for i in $results; do echo $i; done | sort -f`
 echo "# AUTO GENERATED by compiler-rt/lib/tsan/gen_dynamic_list.sh; EDITING IS FUTILE."
 echo "{"
+NM=`nm rtl/libtsan.a`
 for i in $results; do
-  echo "  $i;"
+  # Remove symbols that are not present in the library.
+  if [[ $NM =~ " $i" ]]; then
+    echo "  $i;"
+  else if [[ $i == *"*" ]]; then
+    echo "  $i;"
+  fi
+  fi
 done
 echo "};"
 
diff --git a/lib/tsan/rtl/tsan.syms b/lib/tsan/rtl/tsan.syms
index 1b65330..111c934 100644
--- a/lib/tsan/rtl/tsan.syms
+++ b/lib/tsan/rtl/tsan.syms
@@ -32,18 +32,13 @@
   frexpl;
   fstat;
   fstat64;
-  func;
   fwrite;
-  getaddrinfo;
-  getgrgid;
-  getgrgid_r;
   gethostbyname2;
   gethostbyname2_r;
   getpeername;
   getsockname;
   getsockopt;
   gettimeofday;
-  glob64;
   inet_aton;
   inet_pton;
   inotify_init;
@@ -89,7 +84,6 @@
   pthread_barrier_wait;
   pthread_cond_broadcast;
   pthread_cond_destroy;
-  pthread_cond_init;
   pthread_cond_signal;
   pthread_cond_timedwait;
   pthread_cond_wait;
@@ -218,18 +212,13 @@
   __interceptor_frexpl;
   __interceptor_fstat;
   __interceptor_fstat64;
-  __interceptor_func;
   __interceptor_fwrite;
-  __interceptor_getaddrinfo;
-  __interceptor_getgrgid;
-  __interceptor_getgrgid_r;
   __interceptor_gethostbyname2;
   __interceptor_gethostbyname2_r;
   __interceptor_getpeername;
   __interceptor_getsockname;
   __interceptor_getsockopt;
   __interceptor_gettimeofday;
-  __interceptor_glob64;
   __interceptor_inet_aton;
   __interceptor_inet_pton;
   __interceptor_inotify_init;
@@ -275,7 +264,6 @@
   __interceptor_pthread_barrier_wait;
   __interceptor_pthread_cond_broadcast;
   __interceptor_pthread_cond_destroy;
-  __interceptor_pthread_cond_init;
   __interceptor_pthread_cond_signal;
   __interceptor_pthread_cond_timedwait;
   __interceptor_pthread_cond_wait;