[PATCH] [LSan] [MIPS] adding support of LSan for mips64/mips64el arch

Sergey Matveev earthdok at google.com
Fri Jan 16 13:12:56 PST 2015


REPOSITORY
  rL LLVM

================
Comment at: lib/lsan/lsan_allocator.cc:41
@@ +40,3 @@
+typedef CompactSizeClassMap SizeClassMap;
+typedef SizeClassAllocator32<0, SANITIZER_MMAP_RANGE_SIZE,
+sizeof(ChunkMetadata), SizeClassMap, kRegionSizeLog,
----------------
indent

================
Comment at: lib/lsan/lsan_common.h:25
@@ -25,1 +24,3 @@
+#if SANITIZER_LINUX && (defined(__x86_64__) || defined(__mips64)) \
+  && (SANITIZER_WORDSIZE == 64)
 #define CAN_SANITIZE_LEAKS 1
----------------
indent to match previous line

================
Comment at: lib/sanitizer_common/sanitizer_linux_libcdep.cc:170
@@ +169,3 @@
+  return ((ThreadDescriptorSize() + kTcbHead + kTlsTcbAlign - 1) &
+           ~(kTlsTcbAlign -1));
+}
----------------
indent

I suggest to use clang-format (in Google mode) when working on sanitizer code

================
Comment at: lib/sanitizer_common/sanitizer_linux_libcdep.cc:189
@@ +188,3 @@
+  g_tls_size = ((tls_size + TlsPreTcbSize() + kDlTlsStaticAlign -1)
+                 & ~(kDlTlsStaticAlign - 1));
+#else
----------------
indent

================
Comment at: lib/sanitizer_common/sanitizer_linux_libcdep.cc:231
@@ +230,3 @@
+#elif defined(__mips__)
+  // TODO(sagarthakur): add more values as per different glibc versions
+  val = FIRST_32_SECOND_64(1152, 1776);
----------------
indent

================
Comment at: lib/sanitizer_common/tests/sanitizer_linux_test.cc:272
@@ +271,3 @@
+
+TEST(SanitizerLinux, TlsPreTcbSize) {
+  pthread_t tid;
----------------
This entire test is equivalent to the following:

```
ASSERT_EQ(pthread_self(), ThreadSelf())
```

You don't even need to spawn a new thread, as this should hold in the main thread as well.

This relies on the assumption that pthread_self() will return exactly the value of THREAD_SELF. This is currently true for all platforms, and will likely remain so. As long as we rely on that fact, we can probably just use pthread_self() in the code and move the THREAD_SELF computation into the test. I can do that in a separate change.

http://reviews.llvm.org/D7013

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list