[PATCH] D87420: scudo: Introduce a new mechanism to let Scudo access a platform-specific TLS slot

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 10 12:32:24 PDT 2020


pcc marked an inline comment as done.
pcc added inline comments.


================
Comment at: compiler-rt/lib/scudo/standalone/tsd_shared.h:91
 #else
-    CHECK_EQ(
-        pthread_setspecific(PThreadKey, reinterpret_cast<void *>(CurrentTSD)),
-        0);
+    return &ThreadTSD;
 #endif
----------------
mcgrathr wrote:
> You could just make it `static thread_local` in this function and not need any other conditionalization declarations below.
Good idea, done.


================
Comment at: compiler-rt/lib/scudo/standalone/tsd_shared.h:196
   TSD<Allocator> TSDs[TSDsArraySize];
 #if SCUDO_LINUX && !_BIONIC
+  static THREADLOCAL uptr ThreadTSD;
----------------
mcgrathr wrote:
> Should these conditionals be `#if !SCUDO_HAS_PLATFORM_TLS_SLOT` now since the code above won't compile if that's not defined and this isn't declared?
Now moot


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87420/new/

https://reviews.llvm.org/D87420



More information about the llvm-commits mailing list