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

« back to all changes in this revision

Viewing changes to fpcsrc/rtl/linux/x86_64/prt0.as

  • 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) 2002 by Florian Klaempfl
 
4
#   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
#
 
15
# Linux ELF startup code for Free Pascal
 
16
#
 
17
 
 
18
/* This is the canonical entry point, usually the first thing in the text
 
19
   segment.  The SVR4/i386 ABI (pages 3-31, 3-32) says that when the entry
 
20
   point runs, most registers' values are unspecified, except for:
 
21
 
 
22
   %rdx         Contains a function pointer to be registered with `atexit'.
 
23
                This is how the dynamic linker arranges to have DT_FINI
 
24
                functions called for shared libraries that have been loaded
 
25
                before this code runs.
 
26
 
 
27
   %rsp         The stack contains the arguments and environment:
 
28
                0(%rsp)                 argc
 
29
                8(%rsp)                 argv[0]
 
30
                ...
 
31
                (8*argc)(%rsp)          NULL
 
32
                (8*(argc+1))(%rsp)      envp[0]
 
33
                ...
 
34
                                        NULL
 
35
*/
 
36
 
 
37
        .text
 
38
        .globl _start
 
39
        .type _start,@function
 
40
_start:
 
41
#       movq %rdx,%r9                 /* Address of the shared library termination
 
42
#                                        function.  */
 
43
        popq     %rsi                 /* Pop the argument count.  */
 
44
        movq     %rsi,operatingsystem_parameter_argc
 
45
        movq     %rsp,operatingsystem_parameter_argv   /* argv starts just at the current stack top.  */
 
46
        leaq     8(,%rsi,8),%rax
 
47
        addq     %rsp,%rax
 
48
        movq     %rax,operatingsystem_parameter_envp
 
49
        andq     $~15,%rsp            /* Align the stack to a 16 byte boundary to follow the ABI.  */
 
50
 
 
51
        /* Save initial stackpointer */
 
52
        movq    %rsp,__stkptr
 
53
 
 
54
        xorq    %rbp, %rbp
 
55
        call    PASCALMAIN
 
56
        jmp     _haltproc
 
57
 
 
58
        .globl  _haltproc
 
59
        .type   _haltproc,@function
 
60
_haltproc:
 
61
        movl    $231,%eax                 /* exit_group call */
 
62
        movzwl    operatingsystem_result,%edi
 
63
        syscall
 
64
        jmp     _haltproc
 
65
 
 
66
/* Define a symbol for the first piece of initialized data.  */
 
67
        .data
 
68
        .globl __data_start
 
69
__data_start:
 
70
        .long 0
 
71
        .weak data_start
 
72
        data_start = __data_start
 
73
 
 
74
.bss
 
75
        .comm __stkptr,8
 
76
 
 
77
        .comm operatingsystem_parameter_envp,8
 
78
        .comm operatingsystem_parameter_argc,8
 
79
        .comm operatingsystem_parameter_argv,8
 
80
 
 
81
 
 
82
/* We need this stuff to make gdb behave itself, otherwise
 
83
   gdb will chokes with SIGILL when trying to debug apps.
 
84
*/
 
85
        .section ".note.ABI-tag", "a"
 
86
        .align 4
 
87
        .long 1f - 0f
 
88
        .long 3f - 2f
 
89
        .long  1
 
90
0:      .asciz "GNU"
 
91
1:      .align 4
 
92
2:      .long 0
 
93
        .long 2,4,0
 
94
3:      .align 4
 
95
 
 
96
        .section        .note.GNU-stack,"",@progbits