[PATCH] D107524: Fix COMPILER_RT_DEBUG build for targets that don't support thread local storage.
Dan Liew via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 5 10:08:06 PDT 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa756239e7278: Fix COMPILER_RT_DEBUG build for targets that don't support thread local storage. (authored by delcypher).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D107524/new/
https://reviews.llvm.org/D107524
Files:
compiler-rt/lib/sanitizer_common/sanitizer_mutex.h
compiler-rt/lib/sanitizer_common/sanitizer_platform.h
Index: compiler-rt/lib/sanitizer_common/sanitizer_platform.h
===================================================================
--- compiler-rt/lib/sanitizer_common/sanitizer_platform.h
+++ compiler-rt/lib/sanitizer_common/sanitizer_platform.h
@@ -377,4 +377,18 @@
#define SANITIZER_SUPPORTS_INIT_FOR_DLOPEN 0
#endif
+// SANITIZER_SUPPORTS_THREADLOCAL
+// 1 - THREADLOCAL macro is supported by target
+// 0 - THREADLOCAL macro is not supported by target
+#ifndef __has_feature
+// TODO: Support other compilers here
+# define SANITIZER_SUPPORTS_THREADLOCAL 1
+#else
+# if __has_feature(tls)
+# define SANITIZER_SUPPORTS_THREADLOCAL 1
+# else
+# define SANITIZER_SUPPORTS_THREADLOCAL 0
+# endif
+#endif
+
#endif // SANITIZER_PLATFORM_H
Index: compiler-rt/lib/sanitizer_common/sanitizer_mutex.h
===================================================================
--- compiler-rt/lib/sanitizer_common/sanitizer_mutex.h
+++ compiler-rt/lib/sanitizer_common/sanitizer_mutex.h
@@ -95,7 +95,8 @@
// Go linker does not support THREADLOCAL variables,
// so we can't use per-thread state.
-#define SANITIZER_CHECK_DEADLOCKS (SANITIZER_DEBUG && !SANITIZER_GO)
+#define SANITIZER_CHECK_DEADLOCKS \
+ (SANITIZER_DEBUG && !SANITIZER_GO && SANITIZER_SUPPORTS_THREADLOCAL)
#if SANITIZER_CHECK_DEADLOCKS
struct MutexMeta {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107524.364529.patch
Type: text/x-patch
Size: 1331 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210805/1e37fd88/attachment.bin>
More information about the llvm-commits
mailing list