mirror of
https://github.com/golang/go.git
synced 2026-02-06 09:50:02 +00:00
runtime: fix _rt0_ppc64x_lib on aix
CL 706395 refactored the ppc64 library entry point and missed some important aix-specific characteristics: - _rt0_ppc64x_lib should account for the function descriptor when getting the callback pointer. - _rt0_ppc64x_lib should only call _cgo_sys_thread_create when built as a c-archive. Fixes #75801 Cq-Include-Trybots: luci.golang.try:gotip-linux-ppc64_power10 Change-Id: I343ca09d3b9688ffa585668a6c52f0ad519d6203 Reviewed-on: https://go-review.googlesource.com/c/go/+/710175 Reviewed-by: Paul Murphy <paumurph@redhat.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
This commit is contained in:
parent
a5f55a441e
commit
4ad5585c2c
1 changed files with 23 additions and 3 deletions
|
|
@ -14,8 +14,14 @@
|
|||
// This is called using the host ABI. argc and argv arguments
|
||||
// should be in R3 and R4 respectively.
|
||||
TEXT _rt0_ppc64x_lib(SB),NOSPLIT|NOFRAME,$0
|
||||
// Convert to Go ABI, and Allocate argument storage for call to newosproc0.
|
||||
STACK_AND_SAVE_HOST_TO_GO_ABI(16)
|
||||
// Start with standard C stack frame layout and linkage, allocate
|
||||
// 16 bytes of argument space, save callee-save regs, and set R0 to $0.
|
||||
// Allocate an extra 16 bytes to account for the larger fixed frame size
|
||||
// of aix/elfv1 (48 vs 32) to ensure 16 bytes of parameter save space.
|
||||
STACK_AND_SAVE_HOST_TO_GO_ABI(32)
|
||||
// The above will not preserve R2 (TOC). Save it in case Go is
|
||||
// compiled without a TOC pointer (e.g -buildmode=default).
|
||||
MOVD R2, 24(R1)
|
||||
|
||||
MOVD R3, _rt0_ppc64x_lib_argc<>(SB)
|
||||
MOVD R4, _rt0_ppc64x_lib_argv<>(SB)
|
||||
|
|
@ -28,14 +34,28 @@ TEXT _rt0_ppc64x_lib(SB),NOSPLIT|NOFRAME,$0
|
|||
MOVD R12, CTR
|
||||
BL (CTR)
|
||||
|
||||
#ifdef GOOS_aix
|
||||
// See runtime/cgo/gcc_aix_ppc64.c
|
||||
MOVBZ runtime·isarchive(SB), R3 // Check buildmode = c-archive
|
||||
CMP $0, R3
|
||||
BEQ done
|
||||
#endif
|
||||
|
||||
// Create a new thread to do the runtime initialization and return.
|
||||
// _cgo_sys_thread_create is a C function.
|
||||
MOVD _cgo_sys_thread_create(SB), R12
|
||||
CMP $0, R12
|
||||
BEQ nocgo
|
||||
MOVD $_rt0_ppc64x_lib_go(SB), R3
|
||||
MOVD $0, R4
|
||||
#ifdef GO_PPC64X_HAS_FUNCDESC
|
||||
// Load the real entry address from the first slot of the function descriptor.
|
||||
MOVD 8(R12), R2
|
||||
MOVD (R12), R12
|
||||
#endif
|
||||
MOVD R12, CTR
|
||||
BL (CTR)
|
||||
MOVD 24(R1), R2 // Restore the old frame, and R2.
|
||||
BR done
|
||||
|
||||
nocgo:
|
||||
|
|
@ -48,7 +68,7 @@ nocgo:
|
|||
BL (CTR)
|
||||
|
||||
done:
|
||||
UNSTACK_AND_RESTORE_GO_TO_HOST_ABI(16)
|
||||
UNSTACK_AND_RESTORE_GO_TO_HOST_ABI(32)
|
||||
RET
|
||||
|
||||
#ifdef GO_PPC64X_HAS_FUNCDESC
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue