mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-13 07:34:28 +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
|
||||
addl $_GLOBAL_OFFSET_TABLE_,%ebx
|
||||
/* Jump to libc exit(). _haltproc has the same declaration as exit. */
|
||||
jmp exit@GOT
|
||||
jmp exit@PLT
|
||||
|
||||
/* --------------------------------------------------------- */
|
||||
.data
|
||||
|
@ -42,23 +42,30 @@
|
||||
.globl _fpc_start
|
||||
.type _fpc_start,@function
|
||||
_fpc_start:
|
||||
/* GOT init */
|
||||
call fpc_geteipasebx
|
||||
addl $_GLOBAL_OFFSET_TABLE_,%ebx
|
||||
/* Clear the frame pointer since this is the outermost frame. */
|
||||
xorl %ebp,%ebp
|
||||
/* Save initial stackpointer */
|
||||
movl %esp,__stkptr
|
||||
movl __stkptr@GOT(%ebx),%eax
|
||||
movl %esp,(%eax)
|
||||
/* First locate the start of the environment variables */
|
||||
/* Get argc in ecx */
|
||||
movl (%esp),%ecx
|
||||
/* Save argc */
|
||||
movl %ecx,operatingsystem_parameter_argc
|
||||
/* Get argv pointer in ebx */
|
||||
leal 4(%esp),%ebx
|
||||
movl operatingsystem_parameter_argc@GOT(%ebx),%eax
|
||||
movl %ecx,(%eax)
|
||||
/* Get argv pointer in edx */
|
||||
leal 4(%esp),%edx
|
||||
/* 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 */
|
||||
leal 12(%esp,%ecx,4),%eax
|
||||
leal 12(%esp,%ecx,4),%edx
|
||||
/* 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". */
|
||||
/* No need to align stack since it will aligned by libc. */
|
||||
@ -68,8 +75,11 @@ _fpc_start:
|
||||
.globl _haltproc
|
||||
.type _haltproc,@function
|
||||
_haltproc:
|
||||
/* GOT init */
|
||||
call fpc_geteipasebx
|
||||
addl $_GLOBAL_OFFSET_TABLE_,%ebx
|
||||
/* Jump to libc exit(). _haltproc has the same declaration as exit. */
|
||||
jmp exit
|
||||
jmp exit@PLT
|
||||
|
||||
/* --------------------------------------------------------- */
|
||||
.data
|
||||
|
Loading…
Reference in New Issue
Block a user