[PATCH] [Compiler-rt][Sanitizer][MSan][MIPS] Adding support for MIPS32

Evgeniy Stepanov eugenis at google.com
Thu Oct 9 02:21:36 PDT 2014


================
Comment at: lib/msan/CMakeLists.txt:26
@@ +25,3 @@
+foreach(arch ${MSAN_SUPPORTED_ARCH})
+  if(CAN_TARGET_${arch})
+    add_compiler_rt_runtime(clang_rt.msan-${arch} ${arch} STATIC
----------------
Cool. You don't need this if() now.


================
Comment at: lib/msan/msan.cc:514
@@ -509,3 +513,3 @@
 
 static void* get_tls_base() {
   u64 p;
----------------
This is only used in MSanDR (DynamoRio helper tool) which does not support MIPS. Better not change it, or disable it with #ifdef.

================
Comment at: lib/msan/msan.h:29
@@ +28,3 @@
+#if defined(__mips__) && (SANITIZER_WORDSIZE == 32)
+#define MEM_TO_SHADOW(mem)       (((uptr)mem) & ~0x40000000UL)
+#define SHADOW_TO_ORIGIN(shadow) (((uptr)shadow) + 0x20000000UL)
----------------
This gives you only 512Mb usable application memory in [0x60000000, 0x80000000),
and requires that all application code is mapped in that region. The latter depends on the kernel. Just FYI.


================
Comment at: lib/msan/msan_allocator.cc:44
@@ +43,3 @@
+#if defined (__mips__) && (SANITIZER_WORDSIZE == 32)
+static const uptr kMaxAllowedMallocSize = 3UL << 30;
+static const uptr kRegionSizeLog = 20;
----------------
No point in 3Tb allocation limit, you have only 512Mb application memory.

http://reviews.llvm.org/D5672






More information about the llvm-commits mailing list