diff options
author | Austin Clements <austin@google.com> | 2014-12-16 18:34:55 -0500 |
---|---|---|
committer | Austin Clements <austin@google.com> | 2015-01-07 20:36:27 +0000 |
commit | af7ca8dce4991860263d5e0d0322461cfd00c599 (patch) | |
tree | d590342faa9de3ff44ed3f50dffd1e94abf29fc4 /src/runtime/rt0_linux_ppc64le.s | |
parent | f1c4444dfcca5967543d43190b6c80c9254b99ac (diff) | |
download | go-af7ca8dce4991860263d5e0d0322461cfd00c599.tar.gz go-af7ca8dce4991860263d5e0d0322461cfd00c599.zip |
cmd/cgo, runtime/cgo: support ppc64
This implements support for calls to and from C in the ppc64 C ABI, as
well as supporting functionality such as an entry point from the
dynamic linker.
Change-Id: I68da6df50d5638cb1a3d3fef773fb412d7bf631a
Reviewed-on: https://go-review.googlesource.com/2009
Reviewed-by: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/runtime/rt0_linux_ppc64le.s')
-rw-r--r-- | src/runtime/rt0_linux_ppc64le.s | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/src/runtime/rt0_linux_ppc64le.s b/src/runtime/rt0_linux_ppc64le.s index dda29ab3a0..f5c0af5c71 100644 --- a/src/runtime/rt0_linux_ppc64le.s +++ b/src/runtime/rt0_linux_ppc64le.s @@ -4,11 +4,29 @@ TEXT _rt0_ppc64le_linux(SB),NOSPLIT,$0 BR _main<>(SB) TEXT _main<>(SB),NOSPLIT,$-8 - MOVD 0(R1), R3 // argc - ADD $8, R1, R4 // argv + // 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. + // + // In a dynamically linked binary, r3 contains argc, r4 + // contains argv, r5 contains envp, r6 contains auxv, and r13 + // contains the TLS pointer. + // + // Figure out which case this is by looking at r4: if it's 0, + // we're statically linked; otherwise we're dynamically + // linked. + CMP R0, R4 + BNE dlink + + // Statically linked + MOVD 0(R1), R3 // argc + ADD $8, R1, R4 // argv MOVD $runtimeĀ·tls0(SB), R13 // TLS ADD $0x7000, R13 - BR main(SB) + +dlink: + BR main(SB) TEXT main(SB),NOSPLIT,$-8 MOVD $runtimeĀ·rt0_go(SB), R31 |