* Do not use persistent register r5 in the library init code. It fixes crash during library load on some versions of Android. Issue #23974.

* Made the startup code Thumb-safe.

git-svn-id: trunk@23694 -
This commit is contained in:
yury 2013-03-04 23:49:41 +00:00
parent 63d1c3aa94
commit 5d061a7efa
2 changed files with 11 additions and 8 deletions

View File

@ -30,17 +30,17 @@ FPC_SHARED_LIB_START:
/* Get environment info from libc */ /* Get environment info from libc */
ldr ip,=environ ldr ip,=environ
ldr r5,[ip] ldr r0,[ip]
ldr ip,=operatingsystem_parameter_envp ldr ip,=operatingsystem_parameter_envp
str r5,[ip] str r0,[ip]
/* Register exit handler. It is called only when the main process terminates */ /* Register exit handler. It is called only when the main process terminates */
ldr r0,=FPC_LIB_EXIT ldr r0,=FPC_LIB_EXIT
bl atexit blx atexit
/* call main and exit normally */ /* call main and exit normally */
bl PASCALMAIN blx PASCALMAIN
ldmdb fp, {fp, sp, pc} ldmea fp, {fp, sp, pc}
/* --------------------------------------------------------- */ /* --------------------------------------------------------- */
.globl _haltproc .globl _haltproc
@ -52,7 +52,8 @@ _haltproc_eabi:
ldr r0,=operatingsystem_result ldr r0,=operatingsystem_result
ldr r0,[r0] ldr r0,[r0]
/* Go to libc exit() */ /* Go to libc exit() */
b exit ldr ip,=exit
bx ip
/* --------------------------------------------------------- */ /* --------------------------------------------------------- */
.data .data

View File

@ -57,7 +57,8 @@ _fpc_start:
str r5,[ip] str r5,[ip]
/* Finally go to libc startup code. It will call "PASCALMAIN" via alias "main" */ /* Finally go to libc startup code. It will call "PASCALMAIN" via alias "main" */
b _start ldr ip,=_start
bx ip
/* --------------------------------------------------------- */ /* --------------------------------------------------------- */
.globl _haltproc .globl _haltproc
@ -69,7 +70,8 @@ _haltproc_eabi:
ldr r0,=operatingsystem_result ldr r0,=operatingsystem_result
ldr r0,[r0] ldr r0,[r0]
/* Go to libc exit() */ /* Go to libc exit() */
b exit ldr ip,=exit
bx ip
/* --------------------------------------------------------- */ /* --------------------------------------------------------- */
.data .data