aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/asm_ppc64x.s
diff options
context:
space:
mode:
authormajiang <ma.jiang@zte.com.cn>2018-11-16 15:39:59 +0000
committerLynn Boger <laboger@linux.vnet.ibm.com>2018-11-20 14:50:09 +0000
commit1135071b47b1c9c0069d384c136e94d2883282bc (patch)
tree171c9974d402694882265d1e647d1f1ab3140b91 /src/runtime/asm_ppc64x.s
parent2cc6d62d666f49d91c6d088bcba3ef18072d093f (diff)
downloadgo-1135071b47b1c9c0069d384c136e94d2883282bc.tar.gz
go-1135071b47b1c9c0069d384c136e94d2883282bc.zip
cmd/link, runtime: add initial cgo support for ppc64
We should be able to build docker after this get applied. Updates #13192 Change-Id: I5378d3518fac52d6bd4c97828884c1b382b7ace5 GitHub-Last-Rev: 210b7bc2e172f641f1102982e04542bf73a1aa46 GitHub-Pull-Request: golang/go#28546 Reviewed-on: https://go-review.googlesource.com/c/146898 Reviewed-by: Jiang Ma <ma.jiang@zte.com.cn> Reviewed-by: Clément Chigot <clement.chigot@atos.net> Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com> Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/runtime/asm_ppc64x.s')
-rw-r--r--src/runtime/asm_ppc64x.s27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/runtime/asm_ppc64x.s b/src/runtime/asm_ppc64x.s
index fb0003c9b2..0a89b57cd8 100644
--- a/src/runtime/asm_ppc64x.s
+++ b/src/runtime/asm_ppc64x.s
@@ -36,6 +36,12 @@ TEXT runtime·rt0_go(SB),NOSPLIT,$0
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.
+ MOVD 8(R12), R2
+ MOVD (R12), R12
+#endif
MOVD R12, CTR // r12 = "global function entry point"
MOVD R13, R5 // arg 2: TLS base pointer
MOVD $setg_gcc<>(SB), R4 // arg 1: setg
@@ -597,6 +603,16 @@ g0:
#endif
// 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.
+#ifndef GOOS_aix
+ // aix just passes the function pointer for the moment, see golang.org/cl/146898 for details.
+ MOVD 8(R12), R2
+ MOVD (R12), R12
+#endif
+#endif
MOVD R12, CTR
MOVD R4, R3 // arg in r3
BL (CTR)
@@ -754,9 +770,20 @@ TEXT runtime·setg(SB), NOSPLIT, $0-8
BL runtime·save_g(SB)
RET
+#ifdef GOARCH_ppc64
+TEXT setg_gcc<>(SB),NOSPLIT|NOFRAME,$0-0
+ DWORD $_setg_gcc<>(SB)
+ DWORD $0
+ DWORD $0
+#endif
+
// void setg_gcc(G*); set g in C TLS.
// Must obey the gcc calling convention.
+#ifdef GOARCH_ppc64le
TEXT setg_gcc<>(SB),NOSPLIT|NOFRAME,$0-0
+#else
+TEXT _setg_gcc<>(SB),NOSPLIT|NOFRAME,$0-0
+#endif
// The standard prologue clobbers R31, which is callee-save in
// the C ABI, so we have to use $-8-0 and save LR ourselves.
MOVD LR, R4