| 1 |
// Copyright 2022 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 |
|
| 7 |
TEXT _rt0_loong64_linux(SB),NOSPLIT|NOFRAME,$0 |
| 8 |
// In a statically linked binary, the stack contains argc, |
| 9 |
// argv as argc string pointers followed by a NULL, envv as a |
| 10 |
// sequence of string pointers followed by a NULL, and auxv. |
| 11 |
// There is no TLS base pointer. |
| 12 |
MOVW 0(R3), R4 // argc |
| 13 |
ADDV $8, R3, R5 // argv |
| 14 |
JMP main(SB) |
| 15 |
|
| 16 |
// When building with -buildmode=c-shared, this symbol is called when the shared |
| 17 |
// library is loaded. |
| 18 |
TEXT _rt0_loong64_linux_lib(SB),NOSPLIT,$0 |
| 19 |
JMP _rt0_loong64_lib(SB) |
| 20 |
|
| 21 |
TEXT main(SB),NOSPLIT|NOFRAME,$0 |
| 22 |
// in external linking, glibc jumps to main with argc in R4 |
| 23 |
// and argv in R5 |
| 24 |
|
| 25 |
MOVV $runtime·rt0_go(SB), R19 |
| 26 |
JMP (R19) |