[PATCH] D18753: [mips][sanitizer_common] Don't use `ld` in internal_clone() on 32-bit MIPS.

Daniel Sanders via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 4 05:49:26 PDT 2016


dsanders created this revision.
dsanders added a reviewer: kcc.
dsanders added subscribers: llvm-commits, sagar, jaydeep, mohit.bhakkad.

On a 32-bit MIPS, the `ld` instruction does not exist. However, GAS has an `ld`
macro that expands to a pair of `lw` instructions which load to a pair of
registers (reg, and reg+1). This macro is not available in the Integrated
Assembler and its use causes -fintegrated-as builds to fail. Even if it were
available, the behaviour on 32-bit MIPS would be incorrect since the current
usage of `ld` causes the code to clobber $5 (which is supposed to hold
child_stack). It also clobbers $k0 which is reserved for kernel use.

Aside from enabling builds with the integrated assembler, there is no functional
change since internal_clone() is only used by StopTheWorld() which is only used
by 64-bit sanitizers.

http://reviews.llvm.org/D18753

Files:
  lib/sanitizer_common/sanitizer_linux.cc

Index: lib/sanitizer_common/sanitizer_linux.cc
===================================================================
--- lib/sanitizer_common/sanitizer_linux.cc
+++ lib/sanitizer_common/sanitizer_linux.cc
@@ -957,8 +957,18 @@
                        "bnez $2,1f;\n"
 
                        /* Call "fn(arg)". */
+#if SANITIZER_WORDSIZE == 32
+#ifdef __BIG_ENDIAN__
+                       "lw $25,4($29);\n"
+                       "lw $4,12($29);\n"
+#else
+                       "lw $25,0($29);\n"
+                       "lw $4,8($29);\n"
+#endif
+#else
                        "ld $25,0($29);\n"
                        "ld $4,8($29);\n"
+#endif
                        "jal $25;\n"
 
                        /* Call _exit($v0). */


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18753.52544.patch
Type: text/x-patch
Size: 737 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160404/1065acc4/attachment.bin>


More information about the llvm-commits mailing list