ソースを参照

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 -
tom_at_work 14 年 前
コミット
b0bd6a13ec
1 ファイル変更8 行追加15 行削除
  1. 8 15
      rtl/linux/arm/dllprt0.as

+ 8 - 15
rtl/linux/arm/dllprt0.as

@@ -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}