mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 16:09:25 +02:00
* i386-android: Use PIC in the program start-up code.
git-svn-id: trunk@32035 -
This commit is contained in:
parent
16b02dcd2b
commit
ae33685b9d
@ -66,7 +66,7 @@ _haltproc:
|
|||||||
call fpc_geteipasebx
|
call fpc_geteipasebx
|
||||||
addl $_GLOBAL_OFFSET_TABLE_,%ebx
|
addl $_GLOBAL_OFFSET_TABLE_,%ebx
|
||||||
/* Jump to libc exit(). _haltproc has the same declaration as exit. */
|
/* Jump to libc exit(). _haltproc has the same declaration as exit. */
|
||||||
jmp exit@GOT
|
jmp exit@PLT
|
||||||
|
|
||||||
/* --------------------------------------------------------- */
|
/* --------------------------------------------------------- */
|
||||||
.data
|
.data
|
||||||
|
@ -42,23 +42,30 @@
|
|||||||
.globl _fpc_start
|
.globl _fpc_start
|
||||||
.type _fpc_start,@function
|
.type _fpc_start,@function
|
||||||
_fpc_start:
|
_fpc_start:
|
||||||
|
/* GOT init */
|
||||||
|
call fpc_geteipasebx
|
||||||
|
addl $_GLOBAL_OFFSET_TABLE_,%ebx
|
||||||
/* Clear the frame pointer since this is the outermost frame. */
|
/* Clear the frame pointer since this is the outermost frame. */
|
||||||
xorl %ebp,%ebp
|
xorl %ebp,%ebp
|
||||||
/* Save initial stackpointer */
|
/* Save initial stackpointer */
|
||||||
movl %esp,__stkptr
|
movl __stkptr@GOT(%ebx),%eax
|
||||||
|
movl %esp,(%eax)
|
||||||
/* First locate the start of the environment variables */
|
/* First locate the start of the environment variables */
|
||||||
/* Get argc in ecx */
|
/* Get argc in ecx */
|
||||||
movl (%esp),%ecx
|
movl (%esp),%ecx
|
||||||
/* Save argc */
|
/* Save argc */
|
||||||
movl %ecx,operatingsystem_parameter_argc
|
movl operatingsystem_parameter_argc@GOT(%ebx),%eax
|
||||||
/* Get argv pointer in ebx */
|
movl %ecx,(%eax)
|
||||||
leal 4(%esp),%ebx
|
/* Get argv pointer in edx */
|
||||||
|
leal 4(%esp),%edx
|
||||||
/* Save argv */
|
/* Save argv */
|
||||||
movl %ebx,operatingsystem_parameter_argv
|
movl operatingsystem_parameter_argv@GOT(%ebx),%eax
|
||||||
|
movl %edx,(%eax)
|
||||||
/* The start of the environment is: esp+ecx*4+12 */
|
/* The start of the environment is: esp+ecx*4+12 */
|
||||||
leal 12(%esp,%ecx,4),%eax
|
leal 12(%esp,%ecx,4),%edx
|
||||||
/* Save envp */
|
/* Save envp */
|
||||||
movl %eax,operatingsystem_parameter_envp
|
movl operatingsystem_parameter_envp@GOT(%ebx),%eax
|
||||||
|
movl %edx,(%eax)
|
||||||
|
|
||||||
/* 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". */
|
||||||
/* No need to align stack since it will aligned by libc. */
|
/* No need to align stack since it will aligned by libc. */
|
||||||
@ -68,8 +75,11 @@ _fpc_start:
|
|||||||
.globl _haltproc
|
.globl _haltproc
|
||||||
.type _haltproc,@function
|
.type _haltproc,@function
|
||||||
_haltproc:
|
_haltproc:
|
||||||
|
/* GOT init */
|
||||||
|
call fpc_geteipasebx
|
||||||
|
addl $_GLOBAL_OFFSET_TABLE_,%ebx
|
||||||
/* Jump to libc exit(). _haltproc has the same declaration as exit. */
|
/* Jump to libc exit(). _haltproc has the same declaration as exit. */
|
||||||
jmp exit
|
jmp exit@PLT
|
||||||
|
|
||||||
/* --------------------------------------------------------- */
|
/* --------------------------------------------------------- */
|
||||||
.data
|
.data
|
||||||
|
Loading…
Reference in New Issue
Block a user