mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-14 07:10:05 +00:00
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 (commit381a0c26d7
). 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 (cherry picked from commit4fbba6fe90
)
This commit is contained in:
parent
ae1b6b13d4
commit
aa638b86b2
6
NEWS
6
NEWS
@ -4,6 +4,12 @@ See the end for copying conditions.
|
||||
|
||||
Please send GNU C library bug reports via <https://sourceware.org/bugzilla/>
|
||||
using `glibc' in the "product" field.
|
||||
|
||||
Version 2.31.1
|
||||
|
||||
The following bugs are resolved with this release:
|
||||
[25523] MIPS/Linux inline syscall template is miscompiled
|
||||
|
||||
|
||||
Version 2.31
|
||||
|
||||
|
@ -178,10 +178,11 @@ union __mips_syscall_return
|
||||
long int _sys_result; \
|
||||
\
|
||||
{ \
|
||||
long int _arg1 = (long int) (arg1); \
|
||||
register long int __s0 asm ("$16") __attribute__ ((unused)) \
|
||||
= (number); \
|
||||
register long int __v0 asm ("$2"); \
|
||||
register long int __a0 asm ("$4") = (long int) (arg1); \
|
||||
register long int __a0 asm ("$4") = _arg1; \
|
||||
register long int __a3 asm ("$7"); \
|
||||
__asm__ volatile ( \
|
||||
".set\tnoreorder\n\t" \
|
||||
@ -202,11 +203,13 @@ union __mips_syscall_return
|
||||
long int _sys_result; \
|
||||
\
|
||||
{ \
|
||||
long int _arg1 = (long int) (arg1); \
|
||||
long int _arg2 = (long int) (arg2); \
|
||||
register long int __s0 asm ("$16") __attribute__ ((unused)) \
|
||||
= (number); \
|
||||
register long int __v0 asm ("$2"); \
|
||||
register long int __a0 asm ("$4") = (long int) (arg1); \
|
||||
register long int __a1 asm ("$5") = (long int) (arg2); \
|
||||
register long int __a0 asm ("$4") = _arg1; \
|
||||
register long int __a1 asm ("$5") = _arg2; \
|
||||
register long int __a3 asm ("$7"); \
|
||||
__asm__ volatile ( \
|
||||
".set\tnoreorder\n\t" \
|
||||
@ -228,12 +231,15 @@ union __mips_syscall_return
|
||||
long int _sys_result; \
|
||||
\
|
||||
{ \
|
||||
long int _arg1 = (long int) (arg1); \
|
||||
long int _arg2 = (long int) (arg2); \
|
||||
long int _arg3 = (long int) (arg3); \
|
||||
register long int __s0 asm ("$16") __attribute__ ((unused)) \
|
||||
= (number); \
|
||||
register long int __v0 asm ("$2"); \
|
||||
register long int __a0 asm ("$4") = (long int) (arg1); \
|
||||
register long int __a1 asm ("$5") = (long int) (arg2); \
|
||||
register long int __a2 asm ("$6") = (long int) (arg3); \
|
||||
register long int __a0 asm ("$4") = _arg1; \
|
||||
register long int __a1 asm ("$5") = _arg2; \
|
||||
register long int __a2 asm ("$6") = _arg3; \
|
||||
register long int __a3 asm ("$7"); \
|
||||
__asm__ volatile ( \
|
||||
".set\tnoreorder\n\t" \
|
||||
@ -255,13 +261,17 @@ union __mips_syscall_return
|
||||
long int _sys_result; \
|
||||
\
|
||||
{ \
|
||||
long int _arg1 = (long int) (arg1); \
|
||||
long int _arg2 = (long int) (arg2); \
|
||||
long int _arg3 = (long int) (arg3); \
|
||||
long int _arg4 = (long int) (arg4); \
|
||||
register long int __s0 asm ("$16") __attribute__ ((unused)) \
|
||||
= (number); \
|
||||
register long int __v0 asm ("$2"); \
|
||||
register long int __a0 asm ("$4") = (long int) (arg1); \
|
||||
register long int __a1 asm ("$5") = (long int) (arg2); \
|
||||
register long int __a2 asm ("$6") = (long int) (arg3); \
|
||||
register long int __a3 asm ("$7") = (long int) (arg4); \
|
||||
register long int __a0 asm ("$4") = _arg1; \
|
||||
register long int __a1 asm ("$5") = _arg2; \
|
||||
register long int __a2 asm ("$6") = _arg3; \
|
||||
register long int __a3 asm ("$7") = _arg4; \
|
||||
__asm__ volatile ( \
|
||||
".set\tnoreorder\n\t" \
|
||||
v0_init \
|
||||
|
@ -138,10 +138,11 @@
|
||||
long int _sys_result; \
|
||||
\
|
||||
{ \
|
||||
long long int _arg1 = ARGIFY (arg1); \
|
||||
register long long int __s0 asm ("$16") __attribute__ ((unused))\
|
||||
= (number); \
|
||||
register long long int __v0 asm ("$2"); \
|
||||
register long long int __a0 asm ("$4") = ARGIFY (arg1); \
|
||||
register long long int __a0 asm ("$4") = _arg1; \
|
||||
register long long int __a3 asm ("$7"); \
|
||||
__asm__ volatile ( \
|
||||
".set\tnoreorder\n\t" \
|
||||
@ -162,11 +163,13 @@
|
||||
long int _sys_result; \
|
||||
\
|
||||
{ \
|
||||
long long int _arg1 = ARGIFY (arg1); \
|
||||
long long int _arg2 = ARGIFY (arg2); \
|
||||
register long long int __s0 asm ("$16") __attribute__ ((unused))\
|
||||
= (number); \
|
||||
register long long int __v0 asm ("$2"); \
|
||||
register long long int __a0 asm ("$4") = ARGIFY (arg1); \
|
||||
register long long int __a1 asm ("$5") = ARGIFY (arg2); \
|
||||
register long long int __a0 asm ("$4") = _arg1; \
|
||||
register long long int __a1 asm ("$5") = _arg2; \
|
||||
register long long int __a3 asm ("$7"); \
|
||||
__asm__ volatile ( \
|
||||
".set\tnoreorder\n\t" \
|
||||
@ -188,12 +191,15 @@
|
||||
long int _sys_result; \
|
||||
\
|
||||
{ \
|
||||
long long int _arg1 = ARGIFY (arg1); \
|
||||
long long int _arg2 = ARGIFY (arg2); \
|
||||
long long int _arg3 = ARGIFY (arg3); \
|
||||
register long long int __s0 asm ("$16") __attribute__ ((unused))\
|
||||
= (number); \
|
||||
register long long int __v0 asm ("$2"); \
|
||||
register long long int __a0 asm ("$4") = ARGIFY (arg1); \
|
||||
register long long int __a1 asm ("$5") = ARGIFY (arg2); \
|
||||
register long long int __a2 asm ("$6") = ARGIFY (arg3); \
|
||||
register long long int __a0 asm ("$4") = _arg1; \
|
||||
register long long int __a1 asm ("$5") = _arg2; \
|
||||
register long long int __a2 asm ("$6") = _arg3; \
|
||||
register long long int __a3 asm ("$7"); \
|
||||
__asm__ volatile ( \
|
||||
".set\tnoreorder\n\t" \
|
||||
@ -215,13 +221,17 @@
|
||||
long int _sys_result; \
|
||||
\
|
||||
{ \
|
||||
long long int _arg1 = ARGIFY (arg1); \
|
||||
long long int _arg2 = ARGIFY (arg2); \
|
||||
long long int _arg3 = ARGIFY (arg3); \
|
||||
long long int _arg4 = ARGIFY (arg4); \
|
||||
register long long int __s0 asm ("$16") __attribute__ ((unused))\
|
||||
= (number); \
|
||||
register long long int __v0 asm ("$2"); \
|
||||
register long long int __a0 asm ("$4") = ARGIFY (arg1); \
|
||||
register long long int __a1 asm ("$5") = ARGIFY (arg2); \
|
||||
register long long int __a2 asm ("$6") = ARGIFY (arg3); \
|
||||
register long long int __a3 asm ("$7") = ARGIFY (arg4); \
|
||||
register long long int __a0 asm ("$4") = _arg1; \
|
||||
register long long int __a1 asm ("$5") = _arg2; \
|
||||
register long long int __a2 asm ("$6") = _arg3; \
|
||||
register long long int __a3 asm ("$7") = _arg4; \
|
||||
__asm__ volatile ( \
|
||||
".set\tnoreorder\n\t" \
|
||||
v0_init \
|
||||
@ -242,14 +252,19 @@
|
||||
long int _sys_result; \
|
||||
\
|
||||
{ \
|
||||
long long int _arg1 = ARGIFY (arg1); \
|
||||
long long int _arg2 = ARGIFY (arg2); \
|
||||
long long int _arg3 = ARGIFY (arg3); \
|
||||
long long int _arg4 = ARGIFY (arg4); \
|
||||
long long int _arg5 = ARGIFY (arg5); \
|
||||
register long long int __s0 asm ("$16") __attribute__ ((unused))\
|
||||
= (number); \
|
||||
register long long int __v0 asm ("$2"); \
|
||||
register long long int __a0 asm ("$4") = ARGIFY (arg1); \
|
||||
register long long int __a1 asm ("$5") = ARGIFY (arg2); \
|
||||
register long long int __a2 asm ("$6") = ARGIFY (arg3); \
|
||||
register long long int __a3 asm ("$7") = ARGIFY (arg4); \
|
||||
register long long int __a4 asm ("$8") = ARGIFY (arg5); \
|
||||
register long long int __a0 asm ("$4") = _arg1; \
|
||||
register long long int __a1 asm ("$5") = _arg2; \
|
||||
register long long int __a2 asm ("$6") = _arg3; \
|
||||
register long long int __a3 asm ("$7") = _arg4; \
|
||||
register long long int __a4 asm ("$8") = _arg5; \
|
||||
__asm__ volatile ( \
|
||||
".set\tnoreorder\n\t" \
|
||||
v0_init \
|
||||
@ -270,15 +285,21 @@
|
||||
long int _sys_result; \
|
||||
\
|
||||
{ \
|
||||
long long int _arg1 = ARGIFY (arg1); \
|
||||
long long int _arg2 = ARGIFY (arg2); \
|
||||
long long int _arg3 = ARGIFY (arg3); \
|
||||
long long int _arg4 = ARGIFY (arg4); \
|
||||
long long int _arg5 = ARGIFY (arg5); \
|
||||
long long int _arg6 = ARGIFY (arg6); \
|
||||
register long long int __s0 asm ("$16") __attribute__ ((unused))\
|
||||
= (number); \
|
||||
register long long int __v0 asm ("$2"); \
|
||||
register long long int __a0 asm ("$4") = ARGIFY (arg1); \
|
||||
register long long int __a1 asm ("$5") = ARGIFY (arg2); \
|
||||
register long long int __a2 asm ("$6") = ARGIFY (arg3); \
|
||||
register long long int __a3 asm ("$7") = ARGIFY (arg4); \
|
||||
register long long int __a4 asm ("$8") = ARGIFY (arg5); \
|
||||
register long long int __a5 asm ("$9") = ARGIFY (arg6); \
|
||||
register long long int __a0 asm ("$4") = _arg1; \
|
||||
register long long int __a1 asm ("$5") = _arg2; \
|
||||
register long long int __a2 asm ("$6") = _arg3; \
|
||||
register long long int __a3 asm ("$7") = _arg4; \
|
||||
register long long int __a4 asm ("$8") = _arg5; \
|
||||
register long long int __a5 asm ("$9") = _arg6; \
|
||||
__asm__ volatile ( \
|
||||
".set\tnoreorder\n\t" \
|
||||
v0_init \
|
||||
|
@ -134,10 +134,11 @@
|
||||
long int _sys_result; \
|
||||
\
|
||||
{ \
|
||||
long int _arg1 = (long int) (arg1); \
|
||||
register long int __s0 asm ("$16") __attribute__ ((unused)) \
|
||||
= (number); \
|
||||
register long int __v0 asm ("$2"); \
|
||||
register long int __a0 asm ("$4") = (long int) (arg1); \
|
||||
register long int __a0 asm ("$4") = _arg1; \
|
||||
register long int __a3 asm ("$7"); \
|
||||
__asm__ volatile ( \
|
||||
".set\tnoreorder\n\t" \
|
||||
@ -158,11 +159,13 @@
|
||||
long int _sys_result; \
|
||||
\
|
||||
{ \
|
||||
long int _arg1 = (long int) (arg1); \
|
||||
long int _arg2 = (long int) (arg2); \
|
||||
register long int __s0 asm ("$16") __attribute__ ((unused)) \
|
||||
= (number); \
|
||||
register long int __v0 asm ("$2"); \
|
||||
register long int __a0 asm ("$4") = (long int) (arg1); \
|
||||
register long int __a1 asm ("$5") = (long int) (arg2); \
|
||||
register long int __a0 asm ("$4") = _arg1; \
|
||||
register long int __a1 asm ("$5") = _arg2; \
|
||||
register long int __a3 asm ("$7"); \
|
||||
__asm__ volatile ( \
|
||||
".set\tnoreorder\n\t" \
|
||||
@ -184,12 +187,15 @@
|
||||
long int _sys_result; \
|
||||
\
|
||||
{ \
|
||||
long int _arg1 = (long int) (arg1); \
|
||||
long int _arg2 = (long int) (arg2); \
|
||||
long int _arg3 = (long int) (arg3); \
|
||||
register long int __s0 asm ("$16") __attribute__ ((unused)) \
|
||||
= (number); \
|
||||
register long int __v0 asm ("$2"); \
|
||||
register long int __a0 asm ("$4") = (long int) (arg1); \
|
||||
register long int __a1 asm ("$5") = (long int) (arg2); \
|
||||
register long int __a2 asm ("$6") = (long int) (arg3); \
|
||||
register long int __a0 asm ("$4") = _arg1; \
|
||||
register long int __a1 asm ("$5") = _arg2; \
|
||||
register long int __a2 asm ("$6") = _arg3; \
|
||||
register long int __a3 asm ("$7"); \
|
||||
__asm__ volatile ( \
|
||||
".set\tnoreorder\n\t" \
|
||||
@ -211,13 +217,17 @@
|
||||
long int _sys_result; \
|
||||
\
|
||||
{ \
|
||||
long int _arg1 = (long int) (arg1); \
|
||||
long int _arg2 = (long int) (arg2); \
|
||||
long int _arg3 = (long int) (arg3); \
|
||||
long int _arg4 = (long int) (arg4); \
|
||||
register long int __s0 asm ("$16") __attribute__ ((unused)) \
|
||||
= (number); \
|
||||
register long int __v0 asm ("$2"); \
|
||||
register long int __a0 asm ("$4") = (long int) (arg1); \
|
||||
register long int __a1 asm ("$5") = (long int) (arg2); \
|
||||
register long int __a2 asm ("$6") = (long int) (arg3); \
|
||||
register long int __a3 asm ("$7") = (long int) (arg4); \
|
||||
register long int __a0 asm ("$4") = _arg1; \
|
||||
register long int __a1 asm ("$5") = _arg2; \
|
||||
register long int __a2 asm ("$6") = _arg3; \
|
||||
register long int __a3 asm ("$7") = _arg4; \
|
||||
__asm__ volatile ( \
|
||||
".set\tnoreorder\n\t" \
|
||||
v0_init \
|
||||
@ -238,14 +248,19 @@
|
||||
long int _sys_result; \
|
||||
\
|
||||
{ \
|
||||
long int _arg1 = (long int) (arg1); \
|
||||
long int _arg2 = (long int) (arg2); \
|
||||
long int _arg3 = (long int) (arg3); \
|
||||
long int _arg4 = (long int) (arg4); \
|
||||
long int _arg5 = (long int) (arg5); \
|
||||
register long int __s0 asm ("$16") __attribute__ ((unused)) \
|
||||
= (number); \
|
||||
register long int __v0 asm ("$2"); \
|
||||
register long int __a0 asm ("$4") = (long int) (arg1); \
|
||||
register long int __a1 asm ("$5") = (long int) (arg2); \
|
||||
register long int __a2 asm ("$6") = (long int) (arg3); \
|
||||
register long int __a3 asm ("$7") = (long int) (arg4); \
|
||||
register long int __a4 asm ("$8") = (long int) (arg5); \
|
||||
register long int __a0 asm ("$4") = _arg1; \
|
||||
register long int __a1 asm ("$5") = _arg2; \
|
||||
register long int __a2 asm ("$6") = _arg3; \
|
||||
register long int __a3 asm ("$7") = _arg4; \
|
||||
register long int __a4 asm ("$8") = _arg5; \
|
||||
__asm__ volatile ( \
|
||||
".set\tnoreorder\n\t" \
|
||||
v0_init \
|
||||
@ -266,15 +281,21 @@
|
||||
long int _sys_result; \
|
||||
\
|
||||
{ \
|
||||
long int _arg1 = (long int) (arg1); \
|
||||
long int _arg2 = (long int) (arg2); \
|
||||
long int _arg3 = (long int) (arg3); \
|
||||
long int _arg4 = (long int) (arg4); \
|
||||
long int _arg5 = (long int) (arg5); \
|
||||
long int _arg6 = (long int) (arg6); \
|
||||
register long int __s0 asm ("$16") __attribute__ ((unused)) \
|
||||
= (number); \
|
||||
register long int __v0 asm ("$2"); \
|
||||
register long int __a0 asm ("$4") = (long int) (arg1); \
|
||||
register long int __a1 asm ("$5") = (long int) (arg2); \
|
||||
register long int __a2 asm ("$6") = (long int) (arg3); \
|
||||
register long int __a3 asm ("$7") = (long int) (arg4); \
|
||||
register long int __a4 asm ("$8") = (long int) (arg5); \
|
||||
register long int __a5 asm ("$9") = (long int) (arg6); \
|
||||
register long int __a0 asm ("$4") = _arg1; \
|
||||
register long int __a1 asm ("$5") = _arg2; \
|
||||
register long int __a2 asm ("$6") = _arg3; \
|
||||
register long int __a3 asm ("$7") = _arg4; \
|
||||
register long int __a4 asm ("$8") = _arg5; \
|
||||
register long int __a5 asm ("$9") = _arg6; \
|
||||
__asm__ volatile ( \
|
||||
".set\tnoreorder\n\t" \
|
||||
v0_init \
|
||||
|
Loading…
Reference in New Issue
Block a user