summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/arm/crt0.S
blob: 3944bd34cbef381a19e81eae5aca87d030c254c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/* Copyright (C) 1991, 1992 Free Software Foundation, Inc.
This file is part of the GNU C Library.

The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.

The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Library General Public License for more details.

You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB.  If
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA.  */


#define BASEREG r9

@ r0 = argc
@ r1 = argv
@ r2 = envp
@ sl = data segment



	.text
	.align 2
	.global _start, exit, main
	.type _start,%function

.text
_start:
    @ adjust the data sgement base pointer
	ldr r3,=__data_start
	sub sl,sl,r3
	mov	BASEREG,sl

	ldr	r3, .L3
	str r2,[BASEREG,r3]
	ldr r0,[sp, #0]
	ldr r1,[sp, #4]
	ldr r2,[sp, #8]
	bl  main
	ldr r0,=0
	bl  exit


.L3:  .word environ


	.data
	.align 2
	.global __errno, __environ
	
__environ:  .long 0
.weak environ
environ = __environ

__errno:    .long 0
.weak errno
errno = __errno