[compiler-rt] 0da15ff - [compiler-rt] [netbsd] Switch to syscall for ThreadSelfTlsTcb()
Kamil Rytarowski via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 2 17:41:21 PST 2020
Author: Kamil Rytarowski
Date: 2020-01-03T02:40:52+01:00
New Revision: 0da15ff318480f30bbc90b9e8ecb9bb9431c7fd3
URL: https://github.com/llvm/llvm-project/commit/0da15ff318480f30bbc90b9e8ecb9bb9431c7fd3
DIFF: https://github.com/llvm/llvm-project/commit/0da15ff318480f30bbc90b9e8ecb9bb9431c7fd3.diff
LOG: [compiler-rt] [netbsd] Switch to syscall for ThreadSelfTlsTcb()
This change avoids using internal, namespaced per-CPU calls that
are not a stable interface to read the TSL base value.
Added:
Modified:
compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp
index 56d4b71849cf..edbe8402808a 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp
@@ -28,10 +28,6 @@
#include "sanitizer_placement_new.h"
#include "sanitizer_procmaps.h"
-#if SANITIZER_NETBSD
-#define _RTLD_SOURCE // Fast LWP private pointer getters in ThreadSelfTlsTcb().
-#endif
-
#include <dlfcn.h> // for dlsym()
#include <link.h>
#include <pthread.h>
@@ -54,6 +50,7 @@
#if SANITIZER_NETBSD
#include <sys/sysctl.h>
#include <sys/tls.h>
+#include <lwp.h>
#endif
#if SANITIZER_SOLARIS
@@ -403,13 +400,7 @@ uptr ThreadSelf() {
#if SANITIZER_NETBSD
static struct tls_tcb * ThreadSelfTlsTcb() {
- struct tls_tcb * tcb;
-# ifdef __HAVE___LWP_GETTCB_FAST
- tcb = (struct tls_tcb *)__lwp_gettcb_fast();
-# elif defined(__HAVE___LWP_GETPRIVATE_FAST)
- tcb = (struct tls_tcb *)__lwp_getprivate_fast();
-# endif
- return tcb;
+ return (struct tls_tcb *)_lwp_getprivate();
}
uptr ThreadSelf() {
More information about the llvm-commits
mailing list