@@ -36,6 +36,12 @@ TEXT runtime·rt0_go(SB),NOSPLIT,$0
36
36
MOVD _cgo_init(SB), R12
37
37
CMP R0, R12
38
38
BEQ nocgo
39
+ #ifdef GOARCH_ppc64
40
+ // ppc64 use elf ABI v1. we must get the real entry address from
41
+ // first slot of the function descriptor before call.
42
+ MOVD 8 (R12), R2
43
+ MOVD (R12), R12
44
+ #endif
39
45
MOVD R12, CTR // r12 = "global function entry point"
40
46
MOVD R13, R5 // arg 2: TLS base pointer
41
47
MOVD $setg_gcc<>(SB), R4 // arg 1: setg
597
603
#endif
598
604
// This is a "global call", so put the global entry point in r12
599
605
MOVD R3, R12
606
+
607
+ #ifdef GOARCH_ppc64
608
+ // ppc64 use elf ABI v1. we must get the real entry address from
609
+ // first slot of the function descriptor before call.
610
+ #ifndef GOOS_aix
611
+ // aix just passes the function pointer for the moment, see golang.org/cl/146898 for details.
612
+ MOVD 8 (R12), R2
613
+ MOVD (R12), R12
614
+ #endif
615
+ #endif
600
616
MOVD R12, CTR
601
617
MOVD R4, R3 // arg in r3
602
618
BL (CTR)
@@ -754,9 +770,20 @@ TEXT runtime·setg(SB), NOSPLIT, $0-8
754
770
BL runtime·save_g(SB)
755
771
RET
756
772
773
+ #ifdef GOARCH_ppc64
774
+ TEXT setg_gcc<>(SB),NOSPLIT|NOFRAME,$0 -0
775
+ DWORD $_setg_gcc<>(SB)
776
+ DWORD $0
777
+ DWORD $0
778
+ #endif
779
+
757
780
// void setg_gcc(G*); set g in C TLS.
758
781
// Must obey the gcc calling convention.
782
+ #ifdef GOARCH_ppc64le
759
783
TEXT setg_gcc<>(SB),NOSPLIT|NOFRAME,$0 -0
784
+ #else
785
+ TEXT _setg_gcc<>(SB),NOSPLIT|NOFRAME,$0 -0
786
+ #endif
760
787
// The standard prologue clobbers R31, which is callee-save in
761
788
// the C ABI, so we have to use $-8-0 and save LR ourselves.
762
789
MOVD LR, R4
0 commit comments