]> git.ipfire.org Git - thirdparty/glibc.git/commit
riscv: Avoid clobbering register parameters in syscall
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Mon, 10 Feb 2020 13:32:14 +0000 (10:32 -0300)
committerAurelien Jarno <aurelien@aurel32.net>
Sun, 16 Feb 2020 14:16:50 +0000 (15:16 +0100)
commit74d9b0811eb4176ba314436a56f6f5fea96ba910
treed35d5a4f54e0d33f89ca450b434f47abb7d703df
parente1766196b67b830b8dbced1d96fd9c538f00489c
riscv: Avoid clobbering register parameters in syscall

The riscv INTERNAL_SYSCALL macro might clobber the register
parameter if the argument itself might clobber any register (a function
call for instance).

This patch fixes it by using temporary variables for the expressions
between the register assignments (as indicated by GCC documentation,
6.47.5.2 Specifying Registers for Local Variables).

It is similar to the fix done for MIPS (bug 25523).

Checked with riscv64-linux-gnu-rv64imafdc-lp64d build.

(cherry picked from commit be74b42ee2a97009a6cd4fc90126add4a41c583b)
sysdeps/unix/sysv/linux/riscv/sysdep.h