summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/arm/crt0pic.S
blob: a668ac31f8baf31dca64c45aa7b055f7bfddc7b5 (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
67
68
69
70
71
72
73
74
75
76
77
.text
	.align 2
	.global __environ
	.global _start
	.global exit
	.global main
	.global __libc_init
	.global __init_stdio
	.global __stdio_close_all
	.global _void_void_null_func

	.type   _start,%function
	.type   exit,%function
	.type   main,%function
	.type   __libc_init,%function
	.type   __init_stdio,%function
	.type   __stdio_close_all,%function
	.type   _void_void_null_func,%function



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

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

	ldr r3, .L3
	str r2,[r9,r3]
	
	/* Tell libc to initialize whatever it needs */
        bl __libc_init		    
        bl __init_stdio

	/* pull argc, argv and envp off the stack */
	ldr r0,[sp, #0]
	ldr r1,[sp, #4]
	ldr r2,[sp, #8]

	bl      main
/*	ldr r0,=0  */
	bl      exit

_void_void_null_func:
	mov     pc, lr

.weak __libc_init
__libc_init = _void_void_null_func

.weak __init_stdio
__init_stdio = _void_void_null_func

.weak __stdio_close_all
__stdio_close_all = _void_void_null_func

.align 2
.L3:
	.word environ


.data
	.align 2
	.global __environ
	
__environ:  
	.long 0

.weak environ
environ = __environ