|
@@ -24,27 +24,50 @@ FPC_SHARED_LIB_START:
|
|
stmfd sp!,{fp, ip, lr, pc}
|
|
stmfd sp!,{fp, ip, lr, pc}
|
|
sub fp, ip, #4
|
|
sub fp, ip, #4
|
|
|
|
|
|
|
|
+ /* Get GOT */
|
|
|
|
+ ldr r4,.L_GOT1
|
|
|
|
+.LPIC1:
|
|
|
|
+ add r4,pc,r4
|
|
|
|
+
|
|
/* Save initial stackpointer */
|
|
/* Save initial stackpointer */
|
|
- ldr ip,=__stkptr
|
|
|
|
|
|
+ ldr ip,.L__stkptr
|
|
|
|
+ ldr ip,[r4, ip]
|
|
str sp,[ip]
|
|
str sp,[ip]
|
|
|
|
|
|
/* Get environment info from libc */
|
|
/* Get environment info from libc */
|
|
- ldr ip,=environ
|
|
|
|
|
|
+ ldr ip,.Lenviron
|
|
|
|
+ ldr ip,[r4, ip]
|
|
ldr r0,[ip]
|
|
ldr r0,[ip]
|
|
/* Check if environment is NULL */
|
|
/* Check if environment is NULL */
|
|
cmp r0,#0
|
|
cmp r0,#0
|
|
- ldreq r0,=EmptyEnv
|
|
|
|
- ldr ip,=operatingsystem_parameter_envp
|
|
|
|
|
|
+ ldreq r0,.LEmptyEnv
|
|
|
|
+ ldreq r0,[r4, r0]
|
|
|
|
+ ldr ip,.Loperatingsystem_parameter_envp
|
|
|
|
+ ldr ip,[r4, ip]
|
|
str r0,[ip]
|
|
str r0,[ip]
|
|
|
|
|
|
/* Register exit handler. It is called only when the main process terminates */
|
|
/* Register exit handler. It is called only when the main process terminates */
|
|
- ldr r0,=FPC_LIB_EXIT
|
|
|
|
|
|
+ ldr r0,.LFPC_LIB_EXIT
|
|
|
|
+ ldr r0,[r4, r0]
|
|
blx atexit
|
|
blx atexit
|
|
|
|
|
|
/* call main and exit normally */
|
|
/* call main and exit normally */
|
|
blx PASCALMAIN
|
|
blx PASCALMAIN
|
|
ldmea fp, {fp, sp, pc}
|
|
ldmea fp, {fp, sp, pc}
|
|
|
|
|
|
|
|
+.L_GOT1:
|
|
|
|
+ .long _GLOBAL_OFFSET_TABLE_-.LPIC1-8
|
|
|
|
+.L__stkptr:
|
|
|
|
+ .word __stkptr(GOT)
|
|
|
|
+.Lenviron:
|
|
|
|
+ .word environ(GOT)
|
|
|
|
+.LEmptyEnv:
|
|
|
|
+ .word EmptyEnv(GOT)
|
|
|
|
+.Loperatingsystem_parameter_envp:
|
|
|
|
+ .word operatingsystem_parameter_envp(GOT)
|
|
|
|
+.LFPC_LIB_EXIT:
|
|
|
|
+ .word FPC_LIB_EXIT(GOT)
|
|
|
|
+
|
|
/* --------------------------------------------------------- */
|
|
/* --------------------------------------------------------- */
|
|
.globl _haltproc
|
|
.globl _haltproc
|
|
.type _haltproc,#function
|
|
.type _haltproc,#function
|
|
@@ -52,11 +75,15 @@ _haltproc:
|
|
.globl _haltproc_eabi
|
|
.globl _haltproc_eabi
|
|
.type _haltproc_eabi,#function
|
|
.type _haltproc_eabi,#function
|
|
_haltproc_eabi:
|
|
_haltproc_eabi:
|
|
- ldr r0,=operatingsystem_result
|
|
|
|
|
|
+ ldr r0,.Loperatingsystem_result
|
|
|
|
+.LPIC10:
|
|
|
|
+ add r0,pc,r0
|
|
ldr r0,[r0]
|
|
ldr r0,[r0]
|
|
- /* Go to libc exit() */
|
|
|
|
- ldr ip,=exit
|
|
|
|
- bx ip
|
|
|
|
|
|
+ /* Call libc exit() */
|
|
|
|
+ blx exit
|
|
|
|
+
|
|
|
|
+.Loperatingsystem_result:
|
|
|
|
+ .long operatingsystem_result-.LPIC10-8
|
|
|
|
|
|
/* --------------------------------------------------------- */
|
|
/* --------------------------------------------------------- */
|
|
.data
|
|
.data
|