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