Correctly return to caller in ARM/Linux shared library startup code instead of fall-through to system exit.

git-svn-id: trunk@16982 -
This commit is contained in:
tom_at_work 2011-02-23 09:41:19 +00:00
parent 56d30e7da0
commit a8bf34d3fc

View File

@ -6,31 +6,38 @@ _startlib:
.globl FPC_SHARED_LIB_START .globl FPC_SHARED_LIB_START
.type FPC_SHARED_LIB_START,#function .type FPC_SHARED_LIB_START,#function
FPC_SHARED_LIB_START: FPC_SHARED_LIB_START:
/* Clear the frame pointer since this is the outermost frame */ mov ip, sp
mov fp, #0 push {fp, ip, lr, pc}
ldmia sp!, {a2} sub fp, ip, #4
sub sp, sp, #40
/* pop argc off the stack and save a pointer to argv */ /* load argc */
ldr ip,=operatingsystem_parameter_argc mov a1, ip
ldr a3,=operatingsystem_parameter_argv
str a2,[ip]
/* calc envp */ /* load and save a copy of argc */
add a2,a2,#1 ldr a2, [a1]
add a2,sp,a2,lsl #2 ldr ip, =operatingsystem_parameter_argc
ldr ip,=operatingsystem_parameter_envp str a2, [ip]
str sp,[a3] /* calc argv and store */
str a2,[ip] add a1, a1, #4
ldr ip, =operatingsystem_parameter_argv
str a1, [ip]
/* calc envp and store */
add a2, a2, #1
add a2, a1, a2, lsl #2
ldr ip, =operatingsystem_parameter_envp
str a2, [ip]
/* save initial stackpointer */ /* save initial stackpointer */
ldr ip,=__stklen ldr ip, =__stklen
str sp,[ip] 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 */ /* call main and exit normally */
bl PASCALMAIN bl PASCALMAIN
ldmdb fp, {fp, sp, pc}
.globl _haltproc .globl _haltproc
.type _haltproc,#function .type _haltproc,#function