dllprt0.as 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. .file "dllprt0.as"
  27. .version "01.01"
  28. gcc2_compiled.:
  29. .section .rodata
  30. .LC0:
  31. .ascii "\0"
  32. .data
  33. .p2align 2
  34. .globl __progname
  35. .type __progname,@object
  36. .size __progname,4
  37. __progname:
  38. .long .LC0
  39. .globl ___fpc_brk_addr /* heap management */
  40. .type ___fpc_brk_addr,@object
  41. .size ___fpc_brk_addr,4
  42. .text
  43. .p2align 2,,3
  44. .globl FPC_LIB_START
  45. .type FPC_LIB_START,@function
  46. FPC_LIB_START:
  47. .globl FPC_SHARED_LIB_START
  48. .type FPC_SHARED_LIB_START,@function
  49. FPC_SHARED_LIB_START:
  50. call PASCALMAIN@PLT
  51. ret
  52. .p2align 2,0x90
  53. .globl _haltproc
  54. .type _haltproc,@function
  55. _haltproc:
  56. mov $1,%eax
  57. movzwl operatingsystem_result,%ebx
  58. pushl %ebx
  59. call _actualsyscall
  60. addl $4,%esp
  61. jmp _haltproc
  62. _actualsyscall:
  63. int $0x80
  64. jb .LErrorcode
  65. xor %ebx,%ebx
  66. ret
  67. .LErrorcode:
  68. mov %eax,%ebx
  69. mov $-1,%eax
  70. ret
  71. .comm environ,4,4
  72. .weak _DYNAMIC
  73. .ident "GCC: (GNU) 2.7.2.1"
  74. __stkptr:
  75. .skip 4
  76. .comm operatingsystem_parameter_envp,4
  77. .comm operatingsystem_parameter_argc,4
  78. .comm operatingsystem_parameter_argv,4
  79. //.section .threadvar,"aw",@nobits
  80. .comm ___fpc_threadvar_offset,4
  81. .section .note.GNU-stack,"",%progbits