Set up environment variables and call Pascal initialization in arm/linux shared library initialization

git-svn-id: trunk@16981 -
This commit is contained in:
tom_at_work 2011-02-22 22:32:44 +00:00
parent a3ebc51add
commit 56d30e7da0

View File

@ -1,5 +1,36 @@
.file "androidprt0.as"
.file "dllprt0.as"
.text
.globl _startlib
.type _startlib,#function
_startlib:
.globl FPC_SHARED_LIB_START
.type FPC_SHARED_LIB_START,#function
FPC_SHARED_LIB_START:
/* Clear the frame pointer since this is the outermost frame */
mov fp, #0
ldmia sp!, {a2}
/* pop argc off the stack and save a pointer to argv */
ldr ip,=operatingsystem_parameter_argc
ldr a3,=operatingsystem_parameter_argv
str a2,[ip]
/* calc envp */
add a2,a2,#1
add a2,sp,a2,lsl #2
ldr ip,=operatingsystem_parameter_envp
str sp,[a3]
str a2,[ip]
/* save initial stackpointer */
ldr ip,=__stklen
str sp,[ip]
/* align sp again to 8 byte boundary, needed by eabi */
sub sp,sp,#4
/* let the libc call main and exit with its return code */
bl PASCALMAIN
.globl _haltproc
.type _haltproc,#function
@ -32,3 +63,4 @@ operatingsystem_parameters:
.bss
.comm __stkptr,4