mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 12:09:30 +02:00
Fixed argc/argv/envp for arm/linux shared libraries. They are by default in registers a1/a2/a3 as per ABI: the first arguments when calling a method (in this case the FPC_SHARED_LIB_START) are passed via registers, not on the stack.
git-svn-id: trunk@17033 -
This commit is contained in:
parent
5abdfb6f7e
commit
b0bd6a13ec
@ -9,32 +9,25 @@ FPC_SHARED_LIB_START:
|
|||||||
mov ip, sp
|
mov ip, sp
|
||||||
push {fp, ip, lr, pc}
|
push {fp, ip, lr, pc}
|
||||||
sub fp, ip, #4
|
sub fp, ip, #4
|
||||||
sub sp, sp, #40
|
|
||||||
|
|
||||||
/* load argc */
|
/* a1 contains argc, a2 contains argv and a3 contains envp */
|
||||||
mov a1, ip
|
|
||||||
|
|
||||||
/* load and save a copy of argc */
|
|
||||||
ldr a2, [a1]
|
|
||||||
ldr ip, =operatingsystem_parameter_argc
|
ldr ip, =operatingsystem_parameter_argc
|
||||||
str a2, [ip]
|
|
||||||
|
|
||||||
/* calc argv and store */
|
|
||||||
add a1, a1, #4
|
|
||||||
ldr ip, =operatingsystem_parameter_argv
|
|
||||||
str a1, [ip]
|
str a1, [ip]
|
||||||
|
|
||||||
/* calc envp and store */
|
ldr ip, =operatingsystem_parameter_argv
|
||||||
add a2, a2, #1
|
str a2, [ip]
|
||||||
add a2, a1, a2, lsl #2
|
|
||||||
|
|
||||||
ldr ip, =operatingsystem_parameter_envp
|
ldr ip, =operatingsystem_parameter_envp
|
||||||
str a2, [ip]
|
str a3, [ip]
|
||||||
|
|
||||||
/* save initial stackpointer */
|
/* save initial stackpointer */
|
||||||
ldr ip, =__stklen
|
ldr ip, =__stklen
|
||||||
str sp, [ip]
|
str sp, [ip]
|
||||||
|
|
||||||
|
ldr ip, =TC_SYSTEM_ISLIBRARY
|
||||||
|
mov a1, #1
|
||||||
|
str a1, [ip]
|
||||||
|
|
||||||
/* call main and exit normally */
|
/* call main and exit normally */
|
||||||
bl PASCALMAIN
|
bl PASCALMAIN
|
||||||
ldmdb fp, {fp, sp, pc}
|
ldmdb fp, {fp, sp, pc}
|
||||||
|
Loading…
Reference in New Issue
Block a user