mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-16 04:59:25 +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
|
||||
push {fp, ip, lr, pc}
|
||||
sub fp, ip, #4
|
||||
sub sp, sp, #40
|
||||
|
||||
/* load argc */
|
||||
mov a1, ip
|
||||
|
||||
/* load and save a copy of argc */
|
||||
ldr a2, [a1]
|
||||
/* a1 contains argc, a2 contains argv and a3 contains envp */
|
||||
ldr ip, =operatingsystem_parameter_argc
|
||||
str a2, [ip]
|
||||
|
||||
/* calc argv and store */
|
||||
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_argv
|
||||
str a2, [ip]
|
||||
|
||||
ldr ip, =operatingsystem_parameter_envp
|
||||
str a2, [ip]
|
||||
str a3, [ip]
|
||||
|
||||
/* save initial stackpointer */
|
||||
ldr ip, =__stklen
|
||||
str sp, [ip]
|
||||
|
||||
ldr ip, =TC_SYSTEM_ISLIBRARY
|
||||
mov a1, #1
|
||||
str a1, [ip]
|
||||
|
||||
/* call main and exit normally */
|
||||
bl PASCALMAIN
|
||||
ldmdb fp, {fp, sp, pc}
|
||||
|
Loading…
Reference in New Issue
Block a user