[compiler-rt] r319868 - Support pthread_key_create symbol alias in MSan/NetBSD

Kamil Rytarowski via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 5 17:16:50 PST 2017


Author: kamil
Date: Tue Dec  5 17:16:49 2017
New Revision: 319868

URL: http://llvm.org/viewvc/llvm-project?rev=319868&view=rev
Log:
Support pthread_key_create symbol alias in MSan/NetBSD

Summary:
NetBSD uses indirection symbol for a set of threading functions.

Add alias to handle __libc_thr_keycreate the same way as pthread_key_create.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, dvyukov, eugenis, vitalybuka

Reviewed By: vitalybuka

Subscribers: llvm-commits, #sanitizers

Tags: #sanitizers

Differential Revision: https://reviews.llvm.org/D40767

Modified:
    compiler-rt/trunk/lib/msan/msan_interceptors.cc

Modified: compiler-rt/trunk/lib/msan/msan_interceptors.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/msan_interceptors.cc?rev=319868&r1=319867&r2=319868&view=diff
==============================================================================
--- compiler-rt/trunk/lib/msan/msan_interceptors.cc (original)
+++ compiler-rt/trunk/lib/msan/msan_interceptors.cc Tue Dec  5 17:16:49 2017
@@ -1085,6 +1085,11 @@ INTERCEPTOR(int, pthread_key_create, __s
   return res;
 }
 
+#if SANITIZER_NETBSD
+INTERCEPTOR(void, __libc_thr_keycreate, void *m, void (*dtor)(void *value)) \
+  ALIAS(WRAPPER_NAME(pthread_key_create));
+#endif
+
 INTERCEPTOR(int, pthread_join, void *th, void **retval) {
   ENSURE_MSAN_INITED();
   int res = REAL(pthread_join)(th, retval);
@@ -1634,6 +1639,11 @@ void InitializeInterceptors() {
   INTERCEPT_FUNCTION(pthread_create);
 #endif
   INTERCEPT_FUNCTION(pthread_key_create);
+
+#if SANITIZER_NETBSD
+  INTERCEPT_FUNCTION(__libc_thr_keycreate);
+#endif
+
   INTERCEPT_FUNCTION(pthread_join);
   INTERCEPT_FUNCTION(tzset);
   INTERCEPT_FUNCTION(__cxa_atexit);




More information about the llvm-commits mailing list