94084c
commit 5daf13b1e637eec0f7a2de05b177cb0d76479aa2
94084c
Author: Matheus Castanho <msc@linux.ibm.com>
94084c
Date:   Wed Dec 1 11:14:40 2021 -0300
94084c
94084c
    powerpc64[le]: Allocate extra stack frame on syscall.S
94084c
    
94084c
    The syscall function does not allocate the extra stack frame for scv like other
94084c
    assembly syscalls using DO_CALL_SCV. So after commit d120fb9941 changed the
94084c
    offset that is used to save LR, syscall ended up using an invalid offset,
94084c
    causing regressions on powerpc64. So make sure the extra stack frame is
94084c
    allocated in syscall.S as well to make it consistent with other uses of
94084c
    DO_CALL_SCV and avoid similar issues in the future.
94084c
    
94084c
    Tested on powerpc, powerpc64, and powerpc64le (with and without scv)
94084c
    
94084c
    Reviewed-by: Raphael M Zinsly <rzinsly@linux.ibm.com>
94084c
    
94084c
    (cherry picked from commit ae91d3df24a4a1b1f264d101a71a298bff310d14)
94084c
94084c
diff --git a/sysdeps/unix/sysv/linux/powerpc/syscall.S b/sysdeps/unix/sysv/linux/powerpc/syscall.S
94084c
index a29652feaf6764cf..a5497c8370982fe3 100644
94084c
--- a/sysdeps/unix/sysv/linux/powerpc/syscall.S
94084c
+++ b/sysdeps/unix/sysv/linux/powerpc/syscall.S
94084c
@@ -27,7 +27,11 @@ ENTRY (syscall)
94084c
 	mr   r8,r9
94084c
 #if defined(USE_PPC_SCV) && !IS_IN(rtld) && (defined(__PPC64__) || defined(__powerpc64__))
94084c
 	CHECK_SCV_SUPPORT r9 0f
94084c
+	stdu r1,-SCV_FRAME_SIZE(r1)
94084c
+	cfi_adjust_cfa_offset(SCV_FRAME_SIZE)
94084c
 	DO_CALL_SCV
94084c
+	addi r1,r1,SCV_FRAME_SIZE
94084c
+	cfi_adjust_cfa_offset(-SCV_FRAME_SIZE)
94084c
 	RET_SCV
94084c
 	b 1f
94084c
 #endif