1// Copyright 2016 The Go Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style 3// license that can be found in the LICENSE file. 4 5#include "textflag.h" 6#include "asm_ppc64x.h" 7 8DEFINE_PPC64X_FUNCDESC(_rt0_ppc64_linux, _main<>) 9DEFINE_PPC64X_FUNCDESC(main, _main<>) 10 11TEXT _main<>(SB),NOSPLIT,$-8 12 // In a statically linked binary, the stack contains argc, 13 // argv as argc string pointers followed by a NULL, envv as a 14 // sequence of string pointers followed by a NULL, and auxv. 15 // There is no TLS base pointer. 16 // 17 // TODO(austin): Support ABI v1 dynamic linking entry point 18 XOR R0, R0 // Note, newer kernels may not always set R0 to 0. 19 MOVD $runtime·rt0_go(SB), R12 20 MOVD R12, CTR 21 MOVBZ runtime·iscgo(SB), R5 22 CMP R5, $0 23 BEQ nocgo 24 BR (CTR) 25nocgo: 26 MOVD 0(R1), R3 // argc 27 ADD $8, R1, R4 // argv 28 BR (CTR) 29