[compiler-rt] 63886c2 - [NFC][dfsan] Split Init and ThreadStart

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 8 19:17:08 PST 2021


Author: Vitaly Buka
Date: 2021-11-08T19:16:55-08:00
New Revision: 63886c21ec9c65c8e6278c729e75f761bde15a3a

URL: https://github.com/llvm/llvm-project/commit/63886c21ec9c65c8e6278c729e75f761bde15a3a
DIFF: https://github.com/llvm/llvm-project/commit/63886c21ec9c65c8e6278c729e75f761bde15a3a.diff

LOG: [NFC][dfsan] Split Init and ThreadStart

Added: 
    

Modified: 
    compiler-rt/lib/dfsan/dfsan.cpp
    compiler-rt/lib/dfsan/dfsan_custom.cpp
    compiler-rt/lib/dfsan/dfsan_thread.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/dfsan/dfsan.cpp b/compiler-rt/lib/dfsan/dfsan.cpp
index 67f303e02eeab..ce2c04df83a8b 100644
--- a/compiler-rt/lib/dfsan/dfsan.cpp
+++ b/compiler-rt/lib/dfsan/dfsan.cpp
@@ -991,7 +991,7 @@ static void DFsanInit(int argc, char **argv, char **envp) {
 
   DFsanThread *main_thread = DFsanThread::Create(nullptr, nullptr, nullptr);
   SetCurrentThread(main_thread);
-  main_thread->ThreadStart();
+  main_thread->Init();
 
   dfsan_init_is_running = false;
   dfsan_inited = true;

diff  --git a/compiler-rt/lib/dfsan/dfsan_custom.cpp b/compiler-rt/lib/dfsan/dfsan_custom.cpp
index 97aa13525b7a6..2ecbc07033668 100644
--- a/compiler-rt/lib/dfsan/dfsan_custom.cpp
+++ b/compiler-rt/lib/dfsan/dfsan_custom.cpp
@@ -755,6 +755,7 @@ SANITIZER_INTERFACE_ATTRIBUTE void *__dfso_dlopen(
 static void *DFsanThreadStartFunc(void *arg) {
   DFsanThread *t = (DFsanThread *)arg;
   SetCurrentThread(t);
+  t->Init();
   return t->ThreadStart();
 }
 

diff  --git a/compiler-rt/lib/dfsan/dfsan_thread.cpp b/compiler-rt/lib/dfsan/dfsan_thread.cpp
index 6869cf2315879..df7e4d9b74217 100644
--- a/compiler-rt/lib/dfsan/dfsan_thread.cpp
+++ b/compiler-rt/lib/dfsan/dfsan_thread.cpp
@@ -67,8 +67,6 @@ void DFsanThread::Destroy() {
 }
 
 thread_return_t DFsanThread::ThreadStart() {
-  Init();
-
   if (!start_routine_) {
     // start_routine_ == 0 if we're on the main thread or on one of the
     // OS X libdispatch worker threads. But nobody is supposed to call


        


More information about the llvm-commits mailing list