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
78
79
80
81
82
83
|
/*
Start-up code for Free Pascal Compiler, not in a shared library,
not linking with C library.
Written by Edmund Grimley Evans in 2015 and released into the public domain.
*/
.text
.align 2
.globl _dynamic_start
.type _dynamic_start, function
_dynamic_start:
1:
auipc x5,%pcrel_hi(__dl_fini)
sd x10, %pcrel_lo(1b)(x5)
jal x0, _start
.globl _start
.type _start, function
_start:
1:
auipc gp, %pcrel_hi(__bss_start+0x800)
addi gp, gp, %pcrel_lo(1b)
/* Get argc, argv, envp */
ld x5,(x2)
addi x6,x2,8
addi x7,x5,1
slli x7,x7,3
add x7,x6,x7
/* Save argc, argv, envp, and initial stack pointer */
1:auipc x8,%pcrel_hi(operatingsystem_parameter_argc)
sd x5,%pcrel_lo(1b)(x8)
1:auipc x8,%pcrel_hi(operatingsystem_parameter_argv)
sd x6,%pcrel_lo(1b)(x8)
1:auipc x8,%pcrel_hi(operatingsystem_parameter_envp)
sd x7,%pcrel_lo(1b)(x8)
1:auipc x5,%pcrel_hi(__stkptr)
addi x6, x2, 0
sd x6,%pcrel_lo(1b)(x5)
/* Initialise FP to zero */
addi x8,x0,0
/* Call main */
jal x1, PASCALMAIN
.globl _haltproc
.type _haltproc,function
_haltproc:
1:auipc x10,%pcrel_hi(__dl_fini)
ld x10,%pcrel_lo(1b)(x10)
beq x10,x0,.Lexit
jalr x1,x10
.Lexit:
1:auipc x10,%pcrel_hi(operatingsystem_result)
ld x10,%pcrel_lo(1b)(x10)
addi x17, x0, 94
ecall
jal x0, _haltproc
/* Define a symbol for the first piece of initialized data. */
.data
.align 4
.globl __data_start
__data_start:
.quad 0
.weak data_start
data_start = __data_start
.bss
.align 4
.comm __dl_fini,8
.comm __stkptr,8
.comm operatingsystem_parameter_envp,8
.comm operatingsystem_parameter_argc,8
.comm operatingsystem_parameter_argv,8
.section .note.GNU-stack,"",%progbits
|