瀏覽代碼

Add PIC code for solaris/i386/start.inc

Pierre Muller 2 年之前
父節點
當前提交
d65de901db
共有 3 個文件被更改,包括 33 次插入1 次删除
  1. 二進制
      rtl/core
  2. 二進制
      rtl/solaris/core
  3. 33 1
      rtl/solaris/i386/start.inc

二進制
rtl/core


二進制
rtl/solaris/core


+ 33 - 1
rtl/solaris/i386/start.inc

@@ -54,7 +54,14 @@ Dump of assembler code for function _start:   }
 procedure _start;assembler;nostackframe;public name '_start';
 asm
    mov    %esp,%eax
-   mov    %eax,StackTopPtr
+{$ifdef FPC_PIC}
+  call fpc_geteipasebx
+  addl $_GLOBAL_OFFSET_TABLE_,%ebx
+  movl StackTopPtr@GOT(%ebx),%ecx
+{$else FPC_PIC}
+   mov   $StackTopPtr,%ecx
+{$endif FPC_PIC}
+   mov    %eax,(%ecx)
    pushl  $0x0
    pushl  $0x0
    mov    %esp,%ebp
@@ -83,18 +90,43 @@ asm
    *)
 .Label2:
    mov    0x8(%ebp),%eax
+{$ifdef FPC_PIC}
+  movl argc@GOT(%ebx),%ecx
+  movl %eax,(%ecx)
+{$else FPC_PIC}
    mov    %eax,argc
+{$endif FPC_PIC}
+{$ifdef FPC_PIC}
+  movl _environ@GOT(%ebx),%ecx
+  movl (%ecx),%edx
+{$else FPC_PIC}
    mov    _environ,%edx
+{$endif FPC_PIC}
    test   %edx,%edx
    jne    .Label3
    lea    0x10(%ebp,%eax,4),%edx
 .Label3:
+{$ifdef FPC_PIC}
+  movl _environ@GOT(%ebx),%ecx
+  movl %edx,(%ecx)
+{$else FPC_PIC}
    movl   %edx,_environ
+{$endif FPC_PIC}
+{$ifdef FPC_PIC}
+  movl envp@GOT(%ebx),%ecx
+  movl %edx,(%ecx)
+{$else FPC_PIC}
    movl   %edx,envp
+{$endif FPC_PIC}
    and    $0xfffffff0,%esp
    push   %edx
    lea    0xc(%ebp),%edx
+{$ifdef FPC_PIC}
+  movl argv@GOT(%ebx),%ecx
+  movl %edx,(%ecx)
+{$else FPC_PIC}
    mov    %edx,argv
+{$endif FPC_PIC}
    push   %edx
    push   %eax
    //call   __fpstart {@plt}