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//go:build linux && (mips || mipsle)
6
7#include "textflag.h"
8
9TEXT _rt0_mips_linux(SB),NOSPLIT,$0
10	JMP	_main<>(SB)
11
12TEXT _rt0_mipsle_linux(SB),NOSPLIT,$0
13	JMP	_main<>(SB)
14
15TEXT _main<>(SB),NOSPLIT|NOFRAME,$0
16	// In a statically linked binary, the stack contains argc,
17	// argv as argc string pointers followed by a NULL, envv as a
18	// sequence of string pointers followed by a NULL, and auxv.
19	// There is no TLS base pointer.
20	MOVW	0(R29), R4 // argc
21	ADD	$4, R29, R5 // argv
22	JMP	main(SB)
23
24TEXT main(SB),NOSPLIT|NOFRAME,$0
25	// In external linking, libc jumps to main with argc in R4, argv in R5
26	MOVW	$runtime·rt0_go(SB), R1
27	JMP	(R1)
28