[MIPS] Fix constraint modifier for syscall clone
__v0 has to be marked as read-write rather than early-clobbered.
This fixes an issue in which return value from the system call is
unexpectedly overridden.
When v0 is marked as early-clobbered,
(asm) "li %0,%2\n"
will be coded as:
(objdump) "58: 2410ffea li s0,-22"
and at label '1' the value is restored to v0:
(objdump) "b0: 02001021 move v0,s0"
However, this clobbers the return value from the syscall.
When v0 is marked as read-write, (-EINVAL) is correctly loaded in v0:
(objdump) "58: 2402ffea li v0,-22"
and the value is not overridden later.
BUG = described above
TEST= used by breakpad for MIPS
Review URL: https://codereview.chromium.org/13846002
git-svn-id: http://linux-syscall-support.googlecode.com/svn/trunk/lss@21 829466d3-f3f5-3ae4-62ad-de35cf9bba21
diff --git a/linux_syscall_support.h b/linux_syscall_support.h
index 0bd6c53..cbd199b 100644
--- a/linux_syscall_support.h
+++ b/linux_syscall_support.h
@@ -2525,7 +2525,7 @@
#else
"daddu $29,16\n"
#endif
- : "=&r" (__v0), "+r" (__r7)
+ : "+r" (__v0), "+r" (__r7)
: "i"(-EINVAL), "i"(__NR_clone), "i"(__NR_exit),
"r"(fn), "r"(__stack), "r"(__flags), "r"(arg),
"r"(__ptid), "r"(__r7), "r"(__ctid)