[compiler-rt] r181697 - [sanitizer] Fix StopTheWorld build on non-Android ARM.

Sergey Matveev earthdok at google.com
Mon May 13 03:35:20 PDT 2013


Author: smatveev
Date: Mon May 13 05:35:20 2013
New Revision: 181697

URL: http://llvm.org/viewvc/llvm-project?rev=181697&view=rev
Log:
[sanitizer] Fix StopTheWorld build on non-Android ARM.

Original patch by Abdoulaye Walsimou Gaye.

Modified:
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_stoptheworld_linux.cc

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_stoptheworld_linux.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_stoptheworld_linux.cc?rev=181697&r1=181696&r2=181697&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_stoptheworld_linux.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_stoptheworld_linux.cc Mon May 13 05:35:20 2013
@@ -24,7 +24,7 @@
 #include <sys/prctl.h> // for PR_* definitions
 #include <sys/ptrace.h> // for PTRACE_* definitions
 #include <sys/types.h> // for pid_t
-#if defined(SANITIZER_ANDROID) && defined(__arm__)
+#if SANITIZER_ANDROID && defined(__arm__)
 # include <linux/user.h>  // for pt_regs
 #else
 # include <sys/user.h>  // for user_regs_struct
@@ -353,12 +353,26 @@ void StopTheWorld(StopTheWorldCallback c
 }
 
 // Platform-specific methods from SuspendedThreadsList.
-#if defined(__arm__)
+#if SANITIZER_ANDROID && defined(__arm__)
 typedef pt_regs regs_struct;
-#else
+#define REG_SP ARM_sp
+
+#elif SANITIZER_LINUX && defined(__arm__)
+typedef user_regs regs_struct;
+#define REG_SP uregs[13]
+
+#elif defined(__i386__) || defined(__x86_64__)
 typedef user_regs_struct regs_struct;
+#if defined(__i386__)
+#define REG_SP esp
+#else
+#define REG_SP rsp
 #endif
 
+#else
+#error "Unsupported architecture"
+#endif // SANITIZER_ANDROID && defined(__arm__)
+
 int SuspendedThreadsList::GetRegistersAndSP(uptr index,
                                             uptr *buffer,
                                             uptr *sp) const {
@@ -371,15 +385,8 @@ int SuspendedThreadsList::GetRegistersAn
            tid, pterrno);
     return -1;
   }
-#if defined(__arm__)
-  *sp = regs.ARM_sp;
-#elif defined(__i386__)
-  *sp = regs.esp;
-#elif defined(__x86_64__)
-  *sp = regs.rsp;
-#else
-  UNIMPLEMENTED("Unknown architecture");
-#endif
+
+  *sp = regs.REG_SP;
   internal_memcpy(buffer, &regs, sizeof(regs));
   return 0;
 }





More information about the llvm-commits mailing list