dllprt0.as 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /* Startup code for programs linked with GNU libc.
  2. Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, write to the Free
  14. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  15. 02111-1307 USA. */
  16. .section ".text"
  17. .globl FPC_SHARED_LIB_START
  18. .type FPC_SHARED_LIB_START,@function
  19. .globl _start
  20. _start:
  21. FPC_SHARED_LIB_START:
  22. mr 26,1
  23. /* Set up an initial stack frame, and clear the LR. */
  24. clrrwi 1,1,4
  25. li 0,0
  26. stwu 1,-16(1)
  27. mtlr 0
  28. stw 0,0(1)
  29. lwz 3,0(26) /* get argc */
  30. lis 11,operatingsystem_parameter_argc@ha
  31. stw 3,operatingsystem_parameter_argc@l(11);
  32. addi 4,26,4 /* get argv */
  33. lis 11,operatingsystem_parameter_argv@ha
  34. stw 4,operatingsystem_parameter_argv@l(11);
  35. addi 27,3,1 /* calculate argc + 1 into r27 */
  36. slwi 27,27,2 /* calculate (argc + 1) * sizeof(char *) into r27 */
  37. add 5,4,27 /* get address of env[0] */
  38. lis 11,operatingsystem_parameter_envp@ha
  39. stw 5,operatingsystem_parameter_envp@l(11);
  40. lis 11,__stkptr@ha
  41. stw 1,__stkptr@l(11);
  42. /* update library flag in RTL */
  43. lis 11,operatingsystem_islibrary@ha
  44. li 6, 1
  45. stb 6, operatingsystem_islibrary@l(11)
  46. bl PASCALMAIN
  47. b _haltproc
  48. .globl _haltproc
  49. .globl FPC_SHARED_LIB_EXIT
  50. .type FPC_SHARED_LIB_EXIT,@function
  51. .type _haltproc,@function
  52. FPC_SHARED_LIB_EXIT:
  53. _haltproc:
  54. li 0,1 /* exit call */
  55. sc
  56. b _haltproc
  57. /* Define a symbol for the first piece of initialized data. */
  58. .section ".data"
  59. .globl __data_start
  60. __data_start:
  61. data_start:
  62. .section ".bss"
  63. .type __stkptr, @object
  64. .size __stkptr, 4
  65. .global __stkptr
  66. __stkptr:
  67. .skip 4
  68. .type operatingsystem_parameters, @object
  69. .size operatingsystem_parameters, 12
  70. operatingsystem_parameters:
  71. .skip 3 * 4
  72. .global operatingsystem_parameter_argc
  73. .global operatingsystem_parameter_argv
  74. .global operatingsystem_parameter_envp
  75. .set operatingsystem_parameter_argc, operatingsystem_parameters+0
  76. .set operatingsystem_parameter_argv, operatingsystem_parameters+4
  77. .set operatingsystem_parameter_envp, operatingsystem_parameters+8
  78. .section .note.GNU-stack,"",%progbits