1
0
mirror of https://github.com/golang/go synced 2024-11-19 16:24:45 -07:00
go/src/runtime/rt0_linux_ppc64.s
Michael Hudson-Doyle 6deb3c0619 runtime, runtime/cgo: conform to PIC register use rules in ppc64 asm
PIC code on ppc64le uses R2 as a TOC pointer and when calling a function
through a function pointer must ensure the function pointer is in R12.  These
rules are easy enough to follow unconditionally in our assembly, so do that.

Change-Id: Icfc4e47ae5dfbe15f581cbdd785cdeed6e40bc32
Reviewed-on: https://go-review.googlesource.com/15526
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-10-18 23:36:39 +00:00

24 lines
609 B
ArmAsm

#include "textflag.h"
// actually a function descriptor for _main<>(SB)
TEXT _rt0_ppc64_linux(SB),NOSPLIT,$0
DWORD $_main<>(SB)
DWORD $0
DWORD $0
TEXT _main<>(SB),NOSPLIT,$-8
// In a statically linked binary, the stack contains argc,
// argv as argc string pointers followed by a NULL, envv as a
// sequence of string pointers followed by a NULL, and auxv.
// There is no TLS base pointer.
//
// TODO(austin): Support ABI v1 dynamic linking entry point
MOVD 0(R1), R3 // argc
ADD $8, R1, R4 // argv
BR main(SB)
TEXT main(SB),NOSPLIT,$-8
MOVD $runtime·rt0_go(SB), R12
MOVD R12, CTR
BR (CTR)