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

Summary:
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.

Reviewers: kcc, sagar

Subscribers: mohit.bhakkad, jaydeep, sagar, llvm-commits

Differential Revision: http://reviews.llvm.org/D18753

llvm-svn: 269297
This commit is contained in:
Daniel Sanders 2016-05-12 14:21:33 +00:00
parent 00dde7563e
commit 9ede03d4f2
1 changed files with 10 additions and 0 deletions

View File

@ -969,8 +969,18 @@ uptr internal_clone(int (*fn)(void *), void *child_stack, int flags, void *arg,
"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). */