Browse Source

Adjust the C and C 2.1 halt code to retrieve the exit code from the parameter instead of accessing ExitCode directly.

git-svn-id: branches/svenbarth/packages@32494 -
svenbarth 9 years ago
parent
commit
3f5be7b177
2 changed files with 5 additions and 55 deletions
  1. 2 17
      rtl/linux/i386/si_c.inc
  2. 3 38
      rtl/linux/i386/si_c21.inc

+ 2 - 17
rtl/linux/i386/si_c.inc

@@ -149,26 +149,11 @@ asm
   call    PASCALMAIN              { start the program }
 end;
 
-procedure _FPC_libc_haltproc; assembler; nostackframe; public name '_haltproc';
+procedure _FPC_libc_haltproc(e: longint); cdecl; assembler; nostackframe; public name '_haltproc';
 asm
 .Lhaltproc:
 
- {$ifdef FPC_PIC}
-  call    fpc_geteipasebx
-  addl    $_GLOBAL_OFFSET_TABLE_,%ebx
-  movl    ExitCode@GOT(%ebx),%ebx
- {$if sizeof(ExitCode)=2}
-  movzwl  (%ebx),%ebx
- {$else}
-  mov     (%ebx),%ebx
- {$endif}
-{$else FPC_PIC}
- {$if sizeof(ExitCode)=2}
-  movzwl  ExitCode,%ebx
- {$else}
-  mov     ExitCode,%ebx
- {$endif}
-{$endif FPC_PIC}
+  movl    e,%ebx
 
   pushl   %ebx
 

+ 3 - 38
rtl/linux/i386/si_c21.inc

@@ -131,7 +131,7 @@ asm
 	hlt
 end;
 
-procedure _FPC_libc21_haltproc; assembler; nostackframe; public name '_haltproc';
+procedure _FPC_libc21_haltproc(e: longint); cdecl; assembler; nostackframe; public name '_haltproc';
 asm
 .Lhaltproc:
   {$ifdef FPC_PIC}
@@ -150,47 +150,12 @@ asm
 .Lnodlexitproc:
   movl    syscall_nr_exit_group,%eax
 
-{$ifdef FPC_PIC}
-  call    .Lpiclab2
-.Lpiclab2:
-  popl    %ebx
-  addl    $_GLOBAL_OFFSET_TABLE_+1,%ebx
-  movl    ExitCode@GOT(%ebx),%ebx
- {$if sizeof(ExitCode)=2}
-  movzwl  (%ebx),%ebx
- {$else}
-  mov     (%ebx),%ebx
- {$endif}
-{$else FPC_PIC}
- {$if sizeof(ExitCode)=2}
-  movzwl  ExitCode,%ebx
- {$else}
-  mov     ExitCode,%ebx
- {$endif}
-{$endif FPC_PIC}
+  movl    e,%ebx
 
   int     $0x80
   movl    syscall_nr_exit,%eax
 
-{$ifdef FPC_PIC}
-  call    .Lpiclab3
-.Lpiclab3:
-  popl    %ebx
-  addl    $_GLOBAL_OFFSET_TABLE_+1,%ebx
-  movl    ExitCode@GOT(%ebx),%ebx
- {$if sizeof(ExitCode)=2}
-  movzwl  (%ebx),%ebx
- {$else}
-  mov     (%ebx),%ebx
- {$endif}
-{$else FPC_PIC}
-
- {$if sizeof(ExitCode)=2}
-  movzwl  ExitCode,%ebx
- {$else}
-  mov     ExitCode,%ebx
- {$endif}
-{$endif FPC_PIC}
+  movl    e,%ebx
 
   int     $0x80
   jmp     .Lhaltproc