~ubuntu-branches/debian/lenny/fpc/lenny

« back to all changes in this revision

Viewing changes to fpcsrc/rtl/linux/i386/si_dll.inc

  • Committer: Bazaar Package Importer
  • Author(s): Mazen Neifer, Torsten Werner, Mazen Neifer
  • Date: 2008-05-17 17:12:11 UTC
  • mfrom: (3.1.9 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080517171211-9qi33xhd9evfa0kg
Tags: 2.2.0-dfsg1-9
[ Torsten Werner ]
* Add Mazen Neifer to Uploaders field.

[ Mazen Neifer ]
* Moved FPC sources into a version dependent directory from /usr/share/fpcsrc
  to /usr/share/fpcsrc/${FPCVERSION}. This allow installing more than on FPC
  release.
* Fixed far call issue in compiler preventing building huge binearies.
  (closes: #477743)
* Updated building dependencies, recomennded and suggested packages.
* Moved fppkg to fp-utils as it is just a helper tool and is not required by
  compiler.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
{
 
2
    This file is part of the Free Pascal run time library.
 
3
    Copyright (c) 2005 by Michael Van Canneyt, Peter Vreman,
 
4
    & Daniel Mantione, members of the Free Pascal development team.
 
5
 
 
6
    See the file COPYING.FPC, included in this distribution,
 
7
    for details about the copyright.
 
8
 
 
9
    This program is distributed in the hope that it will be useful,
 
10
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
12
 
 
13
 **********************************************************************}
 
14
{$goto on}
 
15
{
 
16
 Linux ELF startup code for Free Pascal
 
17
 
 
18
 
 
19
 Stack layout at program start:
 
20
 
 
21
         nil
 
22
         envn
 
23
         ....
 
24
         ....           ENVIRONMENT VARIABLES
 
25
         env1
 
26
         env0
 
27
         nil
 
28
         argn
 
29
         ....
 
30
         ....           COMMAND LINE OPTIONS
 
31
         arg1
 
32
         arg0
 
33
         argc <--- esp
 
34
}
 
35
 
 
36
procedure PASCALMAIN; external name 'PASCALMAIN';
 
37
 
 
38
{******************************************************************************
 
39
                        Shared library start/halt
 
40
 ******************************************************************************}
 
41
 
 
42
procedure _FPC_shared_lib_start(argc : dword;argv,envp : pointer); cdecl; public name '_start';
 
43
begin
 
44
  { we've to discuss about the use of this ;) }
 
45
  asm
 
46
    { Save initial stackpointer }
 
47
    movl    %esp,initialstkptr
 
48
  end;
 
49
 
 
50
  operatingsystem_parameter_argc:=argc;    { Copy the argument count      }
 
51
  operatingsystem_parameter_argv:=argv;    { Copy the argument pointer    }
 
52
  operatingsystem_parameter_envp:=envp;    { Copy the environment pointer }
 
53
 
 
54
  IsLibrary:=true;
 
55
 
 
56
  PASCALMAIN;
 
57
end;
 
58
 
 
59
{$ifndef VER2_0}
 
60
procedure initdummy; assembler; nostackframe;
 
61
label
 
62
  FPC_LIB_START;
 
63
asm
 
64
.init
 
65
  .align 16
 
66
  .globl FPC_LIB_START
 
67
//    .type FPC_LIB_START,@function
 
68
FPC_LIB_START:
 
69
{$ifdef FPC_PIC}
 
70
  jmp   _FPC_shared_lib_start@PLT
 
71
{$else FPC_PIC}
 
72
  jmp   _FPC_shared_lib_start
 
73
{$endif FPC_PIC}
 
74
.text
 
75
end;
 
76
{$endif VER_2_0}
 
77
 
 
78
procedure _FPC_shared_lib_haltproc; assembler; nostackframe; public name '_haltproc';
 
79
asm
 
80
{$ifdef FPC_PIC}
 
81
  call    fpc_geteipasebx
 
82
  addl    $_GLOBAL_OFFSET_TABLE_,%ebx
 
83
{$endif}
 
84
.Lhaltproc:
 
85
  xorl    %eax,%eax
 
86
  incl    %eax                    { eax=1, exit call }
 
87
{$ifdef FPC_PIC}
 
88
  pushl   %ebx
 
89
  movl    ExitCode@GOT(%ebx),%ebx
 
90
{$if sizeof(ExitCode)=2}
 
91
  movzwl  (%ebx),%ebx
 
92
{$else}
 
93
  mov     (%ebx),%ebx
 
94
{$endif}
 
95
{$endif}
 
96
  int     $0x80
 
97
  jmp     .Lhaltproc
 
98
  popl    %ebx
 
99
end;
 
100