[PATCH] D61291: [compiler-rt] Fix compile error in hwasan_linux.cpp

Wink Saville via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 29 18:59:44 PDT 2019


winksaville created this revision.
winksaville added reviewers: eugenis, pcc.
Herald added subscribers: Sanitizers, dberris, kubamracek, srhines.
Herald added projects: Sanitizers, LLVM.

If HWASWAN_WITH_INTERCEPTORS was false __hwasan_tls was undefined with
this change __hwasan_tls is always defined and use of
HWASAN_WITH_INTERCEPTORS is replaced by SANITIZER_ANDROID logic.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D61291

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


Index: compiler-rt/lib/hwasan/hwasan_linux.cpp
===================================================================
--- compiler-rt/lib/hwasan/hwasan_linux.cpp
+++ compiler-rt/lib/hwasan/hwasan_linux.cpp
@@ -38,7 +38,7 @@
 #include "sanitizer_common/sanitizer_common.h"
 #include "sanitizer_common/sanitizer_procmaps.h"
 
-#if HWASAN_WITH_INTERCEPTORS && !SANITIZER_ANDROID
+#if !SANITIZER_ANDROID
 SANITIZER_INTERFACE_ATTRIBUTE
 THREADLOCAL uptr __hwasan_tls;
 #endif
@@ -247,7 +247,10 @@
     hwasanThreadList().ReleaseThread(t);
 }
 
-#if HWASAN_WITH_INTERCEPTORS
+#if SANITIZER_ANDROID
+void HwasanTSDInit() {}
+void HwasanTSDThreadInit() {}
+#else
 static pthread_key_t tsd_key;
 static bool tsd_key_inited = false;
 
@@ -271,9 +274,6 @@
   tsd_key_inited = true;
   CHECK_EQ(0, pthread_key_create(&tsd_key, HwasanTSDDtor));
 }
-#else
-void HwasanTSDInit() {}
-void HwasanTSDThreadInit() {}
 #endif
 
 #if SANITIZER_ANDROID
@@ -307,7 +307,7 @@
 
 Thread *GetCurrentThread() {
   uptr *ThreadLong = GetCurrentThreadLongPtr();
-#if HWASAN_WITH_INTERCEPTORS
+#if !SANITIZER_ANDROID
   if (!*ThreadLong)
     __hwasan_thread_enter();
 #endif


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61291.197243.patch
Type: text/x-patch
Size: 1142 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190430/72aa6874/attachment.bin>


More information about the llvm-commits mailing list