[compiler-rt] f7999e7 - [NFC][compiler-rt][hwasan] Move hwasanThreadList().CreateCurrentThread() into InitThreads

Leonard Chan via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 18 13:41:39 PDT 2021


Author: Leonard Chan
Date: 2021-06-18T13:40:55-07:00
New Revision: f7999e73caeff482a324ab0f9ac2fbeb99f8e3ec

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

LOG: [NFC][compiler-rt][hwasan] Move hwasanThreadList().CreateCurrentThread() into InitThreads

Once D104553 lands, CreateCurrentThread will be able to accept optional
parameters for initializing the hwasan thread object. On fuchsia, we can get
stack info in the platform-specific InitThreads and pass it through
CreateCurrentThread. On linux, this is a no-op.

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

Added: 
    

Modified: 
    compiler-rt/lib/hwasan/hwasan.cpp
    compiler-rt/lib/hwasan/hwasan_linux.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/hwasan/hwasan.cpp b/compiler-rt/lib/hwasan/hwasan.cpp
index 6b4aefcffce5..040178328101 100644
--- a/compiler-rt/lib/hwasan/hwasan.cpp
+++ b/compiler-rt/lib/hwasan/hwasan.cpp
@@ -276,7 +276,6 @@ static void InitInstrumentation() {
   }
 
   InitThreads();
-  hwasanThreadList().CreateCurrentThread();
 
   hwasan_instrumentation_inited = 1;
 }

diff  --git a/compiler-rt/lib/hwasan/hwasan_linux.cpp b/compiler-rt/lib/hwasan/hwasan_linux.cpp
index 8fbb8ee48bca..bc5ac3b7bae5 100644
--- a/compiler-rt/lib/hwasan/hwasan_linux.cpp
+++ b/compiler-rt/lib/hwasan/hwasan_linux.cpp
@@ -250,6 +250,7 @@ void InitThreads() {
   ProtectGap(thread_space_end,
              __hwasan_shadow_memory_dynamic_address - thread_space_end);
   InitThreadList(thread_space_start, thread_space_end - thread_space_start);
+  hwasanThreadList().CreateCurrentThread();
 }
 
 bool MemIsApp(uptr p) {


        


More information about the llvm-commits mailing list