Browse Source

Add PIC code for solaris/i386/start.inc

Pierre Muller 2 years ago
parent
commit
d65de901db
3 changed files with 33 additions and 1 deletions
  1. BIN
      rtl/core
  2. BIN
      rtl/solaris/core
  3. 33 1
      rtl/solaris/i386/start.inc

BIN
rtl/core


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