dllprt0.as 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #
  2. # This file is part of the Free Pascal run time library.
  3. # Copyright (c) 2013 by Yury Sidorov and other
  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. # Shared library startup code for Free Pascal. Android-i386 target.
  16. #
  17. .file "dllprt0.as"
  18. .text
  19. .globl FPC_SHARED_LIB_START
  20. .type FPC_SHARED_LIB_START,@function
  21. FPC_SHARED_LIB_START:
  22. pushl %ebp
  23. movl %esp,%ebp
  24. /* Align the stack to a 16 byte boundary */
  25. andl $~15, %esp
  26. /* Save initial stackpointer */
  27. movl %esp,__stkptr
  28. /* Get environment info from libc */
  29. movl environ,%eax
  30. movl %eax,operatingsystem_parameter_envp
  31. /* Register exit handler. It is called only when the main process terminates */
  32. leal FPC_LIB_EXIT,%eax
  33. pushl %eax
  34. call atexit
  35. addl $4,%esp
  36. /* call main and exit normally */
  37. call PASCALMAIN
  38. leave
  39. ret
  40. /* --------------------------------------------------------- */
  41. .globl _haltproc
  42. .type _haltproc,@function
  43. _haltproc:
  44. movzwl operatingsystem_result,%ebx
  45. pushl %ebx
  46. /* Call libc exit() */
  47. call exit
  48. /* --------------------------------------------------------- */
  49. .data
  50. .comm __stkptr,4
  51. .comm operatingsystem_parameter_envp,4
  52. operatingsystem_parameter_argc:
  53. .global operatingsystem_parameter_argc
  54. .long 1
  55. operatingsystem_parameter_argv:
  56. .global operatingsystem_parameter_argv
  57. .long EmptyCmdLine
  58. EmptyCmdLine:
  59. .long EmptyCmdStr
  60. EmptyCmdStr:
  61. .ascii "\0"
  62. /* --------------------------------------------------------- */
  63. .section .init_array, "aw"
  64. .long FPC_SHARED_LIB_START