mips: Fix argument passing for inlined syscalls on Linux [BZ #25523]
authorWANG Xuerui <git@xen0n.name>
Wed, 12 Feb 2020 16:57:03 +0000 (00:57 +0800)
committerJoseph Myers <joseph@codesourcery.com>
Wed, 12 Feb 2020 22:13:59 +0000 (22:13 +0000)
commit4fbba6fe904d0094ddc4284066b3860d119cbd4a
tree4cd2fb0717f0aa12d49eec12f448f3950230b12e
parentd3fbb18aa3164ca1d11e8acba81e1fc2ca70f43e
mips: Fix argument passing for inlined syscalls on Linux [BZ #25523]

According to [gcc documentation][1], temporary variables must be used for
the desired content to not be call-clobbered.

Fix the Linux inline syscall templates by adding temporary variables,
much like what x86 did before
(commit 381a0c26d73e0f074c962e0ab53b99a6c327066d).

Tested with gcc 9.2.0, both cross-compiled and natively on Loongson
3A4000.

[1]: https://gcc.gnu.org/onlinedocs/gcc/Local-Register-Variables.html
sysdeps/unix/sysv/linux/mips/mips32/sysdep.h
sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h
sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h