mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-13 08:19:27 +02:00
* arm-android: Use PIC in the program start-up code.
git-svn-id: trunk@32024 -
This commit is contained in:
parent
4026cfcf60
commit
accf3a6150
@ -37,29 +37,52 @@
|
|||||||
.globl _fpc_start
|
.globl _fpc_start
|
||||||
.type _fpc_start,#function
|
.type _fpc_start,#function
|
||||||
_fpc_start:
|
_fpc_start:
|
||||||
|
/* Get GOT */
|
||||||
|
ldr r3,.L_GOT1
|
||||||
|
.LPIC1:
|
||||||
|
add r3,pc,r3
|
||||||
|
|
||||||
/* Clear the frame pointer since this is the outermost frame. */
|
/* Clear the frame pointer since this is the outermost frame. */
|
||||||
mov fp, #0
|
mov fp, #0
|
||||||
/* Save initial stackpointer */
|
/* Save initial stackpointer */
|
||||||
ldr ip,=__stkptr
|
ldr ip,.L__stkptr
|
||||||
|
ldr ip,[r3, ip]
|
||||||
str sp,[ip]
|
str sp,[ip]
|
||||||
mov r4,sp
|
mov r0,sp
|
||||||
/* Pop argc off the stack and save a pointer to argv */
|
/* Pop argc off the stack and save a pointer to argv */
|
||||||
ldmia r4!, {r5}
|
ldmia r0!, {r1}
|
||||||
ldr ip,=operatingsystem_parameter_argc
|
ldr ip,.Loperatingsystem_parameter_argc
|
||||||
str r5,[ip]
|
ldr ip,[r3, ip]
|
||||||
ldr ip,=operatingsystem_parameter_argv
|
str r1,[ip]
|
||||||
str r4,[ip]
|
ldr ip,.Loperatingsystem_parameter_argv
|
||||||
|
ldr ip,[r3, ip]
|
||||||
|
str r0,[ip]
|
||||||
|
|
||||||
/* calc envp */
|
/* calc envp */
|
||||||
add r5,r5,#1
|
add r1,r1,#1
|
||||||
add r5,r4,r5,LSL #2
|
add r1,r0,r1,LSL #2
|
||||||
ldr ip,=operatingsystem_parameter_envp
|
ldr ip,.Loperatingsystem_parameter_envp
|
||||||
str r5,[ip]
|
ldr ip,[r3, ip]
|
||||||
|
str r1,[ip]
|
||||||
|
|
||||||
/* Finally go to libc startup code. It will call "PASCALMAIN" via alias "main" */
|
/* Finally go to libc startup code. It will call "PASCALMAIN" via alias "main" */
|
||||||
ldr ip,=_start
|
ldr ip,.L_start
|
||||||
|
ldr ip,[r3, ip]
|
||||||
bx ip
|
bx ip
|
||||||
|
|
||||||
|
.L_GOT1:
|
||||||
|
.long _GLOBAL_OFFSET_TABLE_-.LPIC1-8
|
||||||
|
.L__stkptr:
|
||||||
|
.word __stkptr(GOT)
|
||||||
|
.L_start:
|
||||||
|
.word _start(GOT)
|
||||||
|
.Loperatingsystem_parameter_argc:
|
||||||
|
.word operatingsystem_parameter_argc(GOT)
|
||||||
|
.Loperatingsystem_parameter_argv:
|
||||||
|
.word operatingsystem_parameter_argv(GOT)
|
||||||
|
.Loperatingsystem_parameter_envp:
|
||||||
|
.word operatingsystem_parameter_envp(GOT)
|
||||||
|
|
||||||
/* --------------------------------------------------------- */
|
/* --------------------------------------------------------- */
|
||||||
.globl _haltproc
|
.globl _haltproc
|
||||||
.type _haltproc,#function
|
.type _haltproc,#function
|
||||||
@ -67,11 +90,8 @@ _haltproc:
|
|||||||
.globl _haltproc_eabi
|
.globl _haltproc_eabi
|
||||||
.type _haltproc_eabi,#function
|
.type _haltproc_eabi,#function
|
||||||
_haltproc_eabi:
|
_haltproc_eabi:
|
||||||
ldr r0,=operatingsystem_result
|
/* Simply call libc exit(). _haltproc has the same declaration as exit. */
|
||||||
ldr r0,[r0]
|
blx exit
|
||||||
/* Go to libc exit() */
|
|
||||||
ldr ip,=exit
|
|
||||||
bx ip
|
|
||||||
|
|
||||||
/* --------------------------------------------------------- */
|
/* --------------------------------------------------------- */
|
||||||
.data
|
.data
|
||||||
|
Loading…
Reference in New Issue
Block a user