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