1
0
mirror of https://github.com/golang/go synced 2024-11-20 03:24:41 -07:00
go/src/runtime/rt0_linux_ppc64le.s
Matthew Dempsky 7bb38f6e47 runtime: replace tls0 with m0.tls
We're allocating TLS storage for m0 anyway, so might as well use it.

Change-Id: I7dc20bbea5320c8ab8a367f18a9540706751e771
Reviewed-on: https://go-review.googlesource.com/16890
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-11-13 01:53:00 +00:00

36 lines
895 B
ArmAsm

#include "go_asm.h"
#include "textflag.h"
TEXT _rt0_ppc64le_linux(SB),NOSPLIT,$0
BR _main<>(SB)
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.
//
// 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·m0+m_tls(SB), R13 // TLS
ADD $0x7000, R13
dlink:
BR main(SB)
TEXT main(SB),NOSPLIT,$-8
MOVD $runtime·rt0_go(SB), R12
MOVD R12, CTR
BR (CTR)