[PATCH] D70472: scudo: Only use the Android reserved TLS slot when building libc's copy of the allocator.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 20 11:34:28 PST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rGf751a7917395: scudo: Only use the Android reserved TLS slot when building libc's copy of theā€¦ (authored by pcc).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70472

Files:
  compiler-rt/lib/scudo/standalone/CMakeLists.txt
  compiler-rt/lib/scudo/standalone/tests/CMakeLists.txt
  compiler-rt/lib/scudo/standalone/tsd_shared.h


Index: compiler-rt/lib/scudo/standalone/tsd_shared.h
===================================================================
--- compiler-rt/lib/scudo/standalone/tsd_shared.h
+++ compiler-rt/lib/scudo/standalone/tsd_shared.h
@@ -72,7 +72,7 @@
 
 private:
   ALWAYS_INLINE void setCurrentTSD(TSD<Allocator> *CurrentTSD) {
-#if SCUDO_ANDROID
+#if _BIONIC
     *getAndroidTlsPtr() = reinterpret_cast<uptr>(CurrentTSD);
 #elif SCUDO_LINUX
     ThreadTSD = CurrentTSD;
@@ -84,7 +84,7 @@
   }
 
   ALWAYS_INLINE TSD<Allocator> *getCurrentTSD() {
-#if SCUDO_ANDROID
+#if _BIONIC
     return reinterpret_cast<TSD<Allocator> *>(*getAndroidTlsPtr());
 #elif SCUDO_LINUX
     return ThreadTSD;
@@ -152,12 +152,12 @@
   u32 CoPrimes[MaxTSDCount];
   bool Initialized;
   HybridMutex Mutex;
-#if SCUDO_LINUX && !SCUDO_ANDROID
+#if SCUDO_LINUX && !_BIONIC
   static THREADLOCAL TSD<Allocator> *ThreadTSD;
 #endif
 };
 
-#if SCUDO_LINUX && !SCUDO_ANDROID
+#if SCUDO_LINUX && !_BIONIC
 template <class Allocator, u32 MaxTSDCount>
 THREADLOCAL TSD<Allocator>
     *TSDRegistrySharedT<Allocator, MaxTSDCount>::ThreadTSD;
Index: compiler-rt/lib/scudo/standalone/tests/CMakeLists.txt
===================================================================
--- compiler-rt/lib/scudo/standalone/tests/CMakeLists.txt
+++ compiler-rt/lib/scudo/standalone/tests/CMakeLists.txt
@@ -16,6 +16,10 @@
   # TODO(kostyak): find a way to make -fsized-deallocation work
   -Wno-mismatched-new-delete)
 
+if(ANDROID)
+  list(APPEND SCUDO_UNITTEST_CFLAGS -fno-emulated-tls)
+endif()
+
 set(SCUDO_TEST_ARCH ${SCUDO_STANDALONE_SUPPORTED_ARCH})
 
 # gtests requires c++
Index: compiler-rt/lib/scudo/standalone/CMakeLists.txt
===================================================================
--- compiler-rt/lib/scudo/standalone/CMakeLists.txt
+++ compiler-rt/lib/scudo/standalone/CMakeLists.txt
@@ -29,6 +29,8 @@
 append_list_if(COMPILER_RT_HAS_NODEFAULTLIBS_FLAG -nodefaultlibs SCUDO_LINK_FLAGS)
 
 if(ANDROID)
+  list(APPEND SCUDO_CFLAGS -fno-emulated-tls)
+
 # Put the shared library in the global group. For more details, see
 # android-changes-for-ndk-developers.md#changes-to-library-search-order
   append_list_if(COMPILER_RT_HAS_Z_GLOBAL -Wl,-z,global SCUDO_LINK_FLAGS)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70472.230300.patch
Type: text/x-patch
Size: 2233 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191120/7b412148/attachment-0001.bin>


More information about the llvm-commits mailing list