aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/runtime/asm_ppc64x.h14
-rw-r--r--src/runtime/asm_ppc64x.s14
-rw-r--r--src/runtime/cgo/asm_ppc64x.s6
3 files changed, 22 insertions, 12 deletions
diff --git a/src/runtime/asm_ppc64x.h b/src/runtime/asm_ppc64x.h
index 5e55055fdb..cce5537a9c 100644
--- a/src/runtime/asm_ppc64x.h
+++ b/src/runtime/asm_ppc64x.h
@@ -23,3 +23,17 @@
// and currently always use that much, PIC on ppc64 would need to use 48).
#define FIXED_FRAME 32
+
+// aix/ppc64 uses XCOFF which has function descriptors.
+#ifdef GOOS_aix
+#ifdef GOARCH_ppc64
+#define GO_PPC64X_HAS_FUNCDESC
+#endif
+#endif
+
+// linux/ppc64 uses ELFv1 which has function descriptors.
+#ifdef GOOS_linux
+#ifdef GOARCH_ppc64
+#define GO_PPC64X_HAS_FUNCDESC
+#endif
+#endif
diff --git a/src/runtime/asm_ppc64x.s b/src/runtime/asm_ppc64x.s
index 37472c0f79..96a25f4047 100644
--- a/src/runtime/asm_ppc64x.s
+++ b/src/runtime/asm_ppc64x.s
@@ -38,13 +38,13 @@ TEXT runtime·rt0_go(SB),NOSPLIT|TOPFRAME,$0
MOVD R3, (g_stack+stack_lo)(g)
MOVD R1, (g_stack+stack_hi)(g)
- // if there is a _cgo_init, call it using the gcc ABI.
+ // If there is a _cgo_init, call it using the gcc ABI.
MOVD _cgo_init(SB), R12
CMP R0, R12
BEQ nocgo
-#ifdef GOARCH_ppc64
- // ppc64 use elf ABI v1. we must get the real entry address from
- // first slot of the function descriptor before call.
+
+#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
@@ -597,10 +597,8 @@ g0:
// This is a "global call", so put the global entry point in r12
MOVD R3, R12
-#ifdef GOARCH_ppc64
- // ppc64 use elf ABI v1. we must get the real entry address from
- // first slot of the function descriptor before call.
- // Same for AIX.
+#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
diff --git a/src/runtime/cgo/asm_ppc64x.s b/src/runtime/cgo/asm_ppc64x.s
index c201005044..fea749670b 100644
--- a/src/runtime/cgo/asm_ppc64x.s
+++ b/src/runtime/cgo/asm_ppc64x.s
@@ -30,10 +30,8 @@ TEXT crosscall2(SB),NOSPLIT|NOFRAME,$0
BL runtime·reginit(SB)
BL runtime·load_g(SB)
-#ifdef GOARCH_ppc64
- // ppc64 use elf ABI v1. we must get the real entry address from
- // first slot of the function descriptor before call.
- // Same for AIX.
+#ifdef GO_PPC64X_HAS_FUNCDESC
+ // Load the real entry address from the first slot of the function descriptor.
MOVD 8(R3), R2
MOVD (R3), R3
#endif