aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/cgo
diff options
context:
space:
mode:
authorMichael Pratt <mpratt@google.com>2023-04-17 14:09:39 -0400
committerGopher Robot <gobot@golang.org>2023-04-17 18:44:00 +0000
commit2068d5658e99f6cf13dd2648f3542d2c5bcdabfc (patch)
tree5987614098391faa8671335d75b6ec943d7077b2 /src/runtime/cgo
parent0e9b2bc39a9f90c49ba7313e2af522dc058988b0 (diff)
downloadgo-2068d5658e99f6cf13dd2648f3542d2c5bcdabfc.tar.xz
Revert "Revert "Revert "runtime: consolidate function descriptor definitions on PPC64"""
This reverts CL 481075 (a re-apply of previously reverted CL 478917). Reason for revert: CL 481061 causes C TSAN failures and must be reverted. See CL 485275. This CL depends on CL 481061. For #59678. Change-Id: I4bf7f43d9df1ae28e04cd4065552bcbee82ef13f Reviewed-on: https://go-review.googlesource.com/c/go/+/485316 Reviewed-by: Than McIntosh <thanm@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Michael Pratt <mpratt@google.com> Auto-Submit: Michael Pratt <mpratt@google.com>
Diffstat (limited to 'src/runtime/cgo')
-rw-r--r--src/runtime/cgo/asm_ppc64x.s25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/runtime/cgo/asm_ppc64x.s b/src/runtime/cgo/asm_ppc64x.s
index 7752feb650..8eb4a42157 100644
--- a/src/runtime/cgo/asm_ppc64x.s
+++ b/src/runtime/cgo/asm_ppc64x.s
@@ -7,25 +7,26 @@
#include "textflag.h"
#include "asm_ppc64x.h"
-#ifdef GO_PPC64X_HAS_FUNCDESC
-// crosscall2 is marked with go:cgo_export_static. On AIX, this creates and exports
-// the symbol name and descriptor as the AIX linker expects, but does not work if
-// referenced from within Go. Create and use an aliased descriptor of crosscall2
-// to workaround this.
-DEFINE_PPC64X_FUNCDESC(_crosscall2<>, crosscall2)
-#define CROSSCALL2_FPTR $_crosscall2<>(SB)
-#else
-#define CROSSCALL2_FPTR $crosscall2(SB)
-#endif
-
// Set the x_crosscall2_ptr C function pointer variable point to crosscall2.
// It's such a pointer chain: _crosscall2_ptr -> x_crosscall2_ptr -> crosscall2
TEXT ·set_crosscall2(SB),NOSPLIT,$0-0
MOVD _crosscall2_ptr(SB), R5
- MOVD CROSSCALL2_FPTR, R6
+#ifdef GOARCH_ppc64
+ MOVD $_crosscall2<>(SB), R6
+#else
+ MOVD $crosscall2(SB), R6
+#endif
MOVD R6, (R5)
RET
+#ifdef GO_PPC64X_HAS_FUNCDESC
+// _crosscall2<> is a function descriptor to the real crosscall2.
+DATA _crosscall2<>+0(SB)/8, $crosscall2(SB)
+DATA _crosscall2<>+8(SB)/8, $TOC(SB)
+DATA _crosscall2<>+16(SB)/8, $0
+GLOBL _crosscall2<>(SB), NOPTR, $24
+#endif
+
// Called by C code generated by cmd/cgo.
// func crosscall2(fn, a unsafe.Pointer, n int32, ctxt uintptr)
// Saves C callee-saved registers and calls cgocallback with three arguments.