gprt0.as 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. #
  2. # $Id: gprt0.as,v 1.3 2004/07/03 21:50:30 daniel Exp $
  3. # This file is part of the Free Pascal run time library.
  4. # Copyright (c) 1999-2000 by Marco van de Voort, Michael Van Canneyt
  5. # and Peter Vreman
  6. # members of the Free Pascal development team.
  7. #
  8. # See the file COPYING.FPC, included in this distribution,
  9. # for details about the copyright.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY;without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  14. #
  15. #**********************************************************************}
  16. #
  17. # FreeBSD ELF startup code for Free Pascal for dynamical linking to libc
  18. # with profiling support.
  19. #
  20. .file "gpcrt1.c"
  21. .version "01.01"
  22. gcc2_compiled.:
  23. .section .note.ABI-tag,"a",@progbits
  24. .p2align 2
  25. .type abitag,@object
  26. .size abitag,24
  27. abitag:
  28. .long 8
  29. .long 4
  30. .long 1
  31. .byte 0x46,0x72,0x65,0x65,0x42,0x53,0x44,0x0
  32. .long 900044
  33. .globl __progname
  34. .section .rodata
  35. .LC0:
  36. .byte 0x0
  37. .data
  38. .p2align 2
  39. .type __progname,@object
  40. .size __progname,4
  41. __progname:
  42. .long .LC0
  43. .align 4
  44. ___fpucw:
  45. .long 0x1332
  46. .globl ___fpc_brk_addr /* heap management */
  47. .type ___fpc_brk_addr,@object
  48. .size ___fpc_brk_addr,4
  49. ___fpc_brk_addr:
  50. .long 0
  51. .text
  52. .p2align 2,0x90
  53. .globl _start
  54. .type _start,@function
  55. _start:
  56. #APP
  57. movl %edx,%edx
  58. #NO_APP
  59. pushl %ebp
  60. movl %esp,%ebp
  61. subl $12,%esp
  62. pushl %edi
  63. pushl %esi
  64. pushl %ebx
  65. movl 4(%ebp),%ebx
  66. movl %ebx,operatingsystem_parameter_argc
  67. leal 12(%ebp,%ebx,4),%esi
  68. leal 8(%ebp),%eax
  69. movl %eax,operatingsystem_parameter_argv
  70. movl %eax,-4(%ebp)
  71. movl %esi,operatingsystem_parameter_envp
  72. movl %esi,environ
  73. movl $_DYNAMIC,%ecx
  74. testl %ebx,%ebx
  75. jle .L3
  76. movl 8(%ebp),%eax
  77. testl %eax,%eax
  78. je .L3
  79. movl %eax,__progname
  80. cmpb $0,(%eax)
  81. je .L3
  82. .p2align 2,0x90
  83. .L7:
  84. cmpb $47,(%eax)
  85. jne .L6
  86. leal 1(%eax),%edi
  87. movl %edi,__progname
  88. .L6:
  89. incl %eax
  90. cmpb $0,(%eax)
  91. jne .L7
  92. .L3:
  93. testl %ecx,%ecx
  94. je .L10
  95. addl $-12,%esp
  96. pushl %edx
  97. call atexit
  98. addl $16,%esp
  99. .L10:
  100. addl $-12,%esp
  101. pushl $_mcleanup
  102. call atexit
  103. addl $-12,%esp
  104. pushl $_fini
  105. call atexit
  106. addl $32,%esp
  107. addl $-8,%esp
  108. pushl $etext
  109. pushl $eprol
  110. call monstartup
  111. call _init
  112. finit /* initialize fpu */
  113. fwait
  114. fldcw ___fpucw
  115. xorl %ebp,%ebp
  116. call main
  117. pushl %eax
  118. jmp _haltproc
  119. .globl _haltproc
  120. .type _haltproc,@function
  121. _haltproc:
  122. movzwl operatingsystem_result,%ebx
  123. pushl %ebx
  124. call exit
  125. mov $1,%eax
  126. movzwl operatingsystem_result,%ebx
  127. pushl %ebx
  128. call .Lactualsyscall
  129. addl $4,%esp
  130. jmp _haltproc
  131. .Lactualsyscall:
  132. int $0x80
  133. jb .LErrorcode
  134. xor %ebx,%ebx
  135. ret
  136. .LErrorcode:
  137. mov %eax,%ebx
  138. mov $-1,%eax
  139. ret
  140. .p2align 2,0x90
  141. .Lfe1:
  142. .size _start,.Lfe1-_start
  143. #APP
  144. .text
  145. eprol:
  146. .previous
  147. #NO_APP
  148. .comm environ,4,4
  149. .globl _DYNAMIC
  150. .weak _DYNAMIC
  151. .ident "GCC: (GNU) c 2.95.4 20020320 [FreeBSD]"
  152. .bss
  153. .comm operatingsystem_parameter_envp,4
  154. .comm operatingsystem_parameter_argc,4
  155. .comm operatingsystem_parameter_argv,4
  156. .section .note.GNU-stack,"",@progbits