From a8cd10f2ab66d15ec43c6c6f688c3362f638237f Mon Sep 17 00:00:00 2001 From: "Paul E. Murphy" Date: Tue, 14 Mar 2023 16:30:38 -0500 Subject: [PATCH] runtime: add arg storage to ppc64le/linux runtime.sigprofNonGoWrapper frame CL 475935 fixed the the ELFv2 ABI violations, but in the process created a Go ABI violation by failing to allocate stack space for arguments. Allocate this space while keeping the frame 16 byte aligned. Updates #58953 Change-Id: I9942d9a433118b391ef8cd7bcea5808695cf94d4 Reviewed-on: https://go-review.googlesource.com/c/go/+/476296 Reviewed-by: Ian Lance Taylor TryBot-Result: Gopher Robot Reviewed-by: Archana Ravindar Run-TryBot: Paul Murphy Reviewed-by: Cherry Mui --- src/runtime/sys_linux_ppc64x.s | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/runtime/sys_linux_ppc64x.s b/src/runtime/sys_linux_ppc64x.s index 492a02bd38..b8f3cfddeb 100644 --- a/src/runtime/sys_linux_ppc64x.s +++ b/src/runtime/sys_linux_ppc64x.s @@ -747,22 +747,23 @@ TEXT runtime·sigprofNonGoWrapper<>(SB),NOSPLIT|NOFRAME,$0 MOVW CR, R0 MOVD R0, 8(R1) // Don't save a back chain pointer when calling into Go. It will be overwritten. - // Go stores LR where ELF stores a back chain pointer. - ADD $-(32+SAVE_ALL_REG_SIZE), R1 + // Go stores LR where ELF stores a back chain pointer. And, allocate 64B for + // FIXED_FRAME and 24B argument space, rounded up to a 16 byte boundary. + ADD $-(64+SAVE_ALL_REG_SIZE), R1 - SAVE_GPR(32) - SAVE_FPR(32+SAVE_GPR_SIZE) - SAVE_VR(32+SAVE_GPR_SIZE+SAVE_FPR_SIZE, R6) + SAVE_GPR(64) + SAVE_FPR(64+SAVE_GPR_SIZE) + SAVE_VR(64+SAVE_GPR_SIZE+SAVE_FPR_SIZE, R6) MOVD $0, R0 CALL runtime·sigprofNonGo(SB) - RESTORE_GPR(32) - RESTORE_FPR(32+SAVE_GPR_SIZE) - RESTORE_VR(32+SAVE_GPR_SIZE+SAVE_FPR_SIZE, R6) + RESTORE_GPR(64) + RESTORE_FPR(64+SAVE_GPR_SIZE) + RESTORE_VR(64+SAVE_GPR_SIZE+SAVE_FPR_SIZE, R6) // Clear frame, restore LR, return - ADD $(32+SAVE_ALL_REG_SIZE), R1 + ADD $(64+SAVE_ALL_REG_SIZE), R1 MOVD 16(R1), R0 MOVD R0, LR MOVD 8(R1), R0 -- 2.50.0