1// Copyright 2009 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
7TEXT _rt0_arm_linux(SB),NOSPLIT|NOFRAME,$0
8	MOVW	(R13), R0	// argc
9	MOVW	$4(R13), R1		// argv
10	MOVW	$_rt0_arm_linux1(SB), R4
11	B		(R4)
12
13// When building with -buildmode=c-shared, this symbol is called when the shared
14// library is loaded.
15TEXT _rt0_arm_linux_lib(SB),NOSPLIT,$0
16	B	_rt0_arm_lib(SB)
17
18TEXT _rt0_arm_linux1(SB),NOSPLIT|NOFRAME,$0
19	// We first need to detect the kernel ABI, and warn the user
20	// if the system only supports OABI.
21	// The strategy here is to call some EABI syscall to see if
22	// SIGILL is received.
23	// If you get a SIGILL here, you have the wrong kernel.
24
25	// Save argc and argv (syscall will clobber at least R0).
26	MOVM.DB.W [R0-R1], (R13)
27
28	// do an EABI syscall
29	MOVW	$20, R7 // sys_getpid
30	SWI	$0 // this will trigger SIGILL on OABI systems
31
32	MOVM.IA.W (R13), [R0-R1]
33	B	runtime·rt0_go(SB)
34