dllprt0.as 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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-ARM 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. mov ip, sp
  23. stmfd sp!,{fp, ip, lr, pc}
  24. sub fp, ip, #4
  25. /* Save initial stackpointer */
  26. ldr ip,=__stkptr
  27. str sp,[ip]
  28. /* Get environment info from libc */
  29. ldr ip,=environ
  30. ldr r5,[ip]
  31. ldr ip,=operatingsystem_parameter_envp
  32. str r5,[ip]
  33. /* Register exit handler. It is called only when the main process terminates */
  34. ldr r0,=FPC_LIB_EXIT
  35. bl atexit
  36. /* call main and exit normally */
  37. bl PASCALMAIN
  38. ldmdb fp, {fp, sp, pc}
  39. /* --------------------------------------------------------- */
  40. .globl _haltproc
  41. .type _haltproc,#function
  42. _haltproc:
  43. .globl _haltproc_eabi
  44. .type _haltproc_eabi,#function
  45. _haltproc_eabi:
  46. ldr r0,=operatingsystem_result
  47. ldr r0,[r0]
  48. /* Go to libc exit() */
  49. b exit
  50. /* --------------------------------------------------------- */
  51. .data
  52. .comm __stkptr,4
  53. .comm operatingsystem_parameter_envp,4
  54. operatingsystem_parameter_argc:
  55. .global operatingsystem_parameter_argc
  56. .long 1
  57. operatingsystem_parameter_argv:
  58. .global operatingsystem_parameter_argv
  59. .long EmptyCmdLine
  60. EmptyCmdLine:
  61. .long EmptyCmdStr
  62. EmptyCmdStr:
  63. .ascii "\0"
  64. /* --------------------------------------------------------- */
  65. .section .init_array, "aw"
  66. .long FPC_SHARED_LIB_START