1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
#
# This file is part of the Free Pascal run time library.
# Copyright (c) 1999-2000 by Marco van de Voort, Michael Van Canneyt
# and Peter Vreman
# members of the Free Pascal development team.
#
# See the file COPYING.FPC, included in this distribution,
# for details about the copyright.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY;without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
#**********************************************************************}
#
# FreeBSD standard (shared) ELF startup code for Free Pascal
#
# FreeBSD RunTime dynamic loader only
# calls the functions specified by -init
# as functions without parameters
# Thus, it is not possible to retrieve argc, argv and envp
# for libraries.
# On x86_64 CPU, using weak for the operatingsystem_parameter_XXX
# allows to bind to main program parameters,
# but this does not seem to work for i386 loader.
.file "dllprt0.as"
.version "01.01"
gcc2_compiled.:
.section .rodata
.LC0:
.ascii "\0"
.data
.p2align 2
.globl __progname
.type __progname,@object
.size __progname,4
__progname:
.long .LC0
.align 4
.type __fpucw,@object
.size __fpucw,4
.global __fpucw
___fpucw:
.long 0x1332
.globl ___fpc_brk_addr /* heap management */
.type ___fpc_brk_addr,@object
.size ___fpc_brk_addr,4
.text
.p2align 2,,3
.globl FPC_LIB_START
.type FPC_LIB_START,@function
FPC_LIB_START:
.globl FPC_SHARED_LIB_START
.type FPC_SHARED_LIB_START,@function
FPC_SHARED_LIB_START:
movb $1,operatingsystem_islibrary
finit /* initialize fpu */
fwait
fldcw ___fpucw
/* xorl %ebp,%ebp */
call PASCALMAIN@PLT
ret
pushl %eax
jmp _haltproc
.p2align 2,0x90
.globl _haltproc
.type _haltproc,@function
_haltproc:
.globl FPC_SHARED_LIB_EXIT
.type FPC_SHARED_LIB_EXIT,@function
FPC_SHARED_LIB_EXIT:
call FPC_LIB_EXIT@PLT
mov $1,%eax
movzwl operatingsystem_result,%ebx
pushl %ebx
call _actualsyscall
addl $4,%esp
jmp _haltproc
_actualsyscall:
int $0x80
jb .LErrorcode
xor %ebx,%ebx
ret
.LErrorcode:
mov %eax,%ebx
mov $-1,%eax
ret
.comm environ,4,4
.weak _DYNAMIC
.ident "GCC: (GNU) 2.7.2.1"
__stkptr:
.skip 4
.comm operatingsystem_parameter_envp,4
.comm operatingsystem_parameter_argc,4
.comm operatingsystem_parameter_argv,4
//.section .threadvar,"aw",@nobits
.comm ___fpc_threadvar_offset,4
|