crt1.S 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /* ELF startup code for HPPA.
  2. Copyright (C) 2002 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. In addition to the permissions in the GNU Lesser General Public
  9. License, the Free Software Foundation gives you unlimited
  10. permission to link the compiled version of this file with other
  11. programs, and to distribute those programs without any restriction
  12. coming from the use of this file. (The GNU Lesser General Public
  13. License restrictions do apply in other respects; for example, they
  14. cover modification of the file, and distribution when not linked
  15. into another program.)
  16. Note that people who make modified versions of this file are not
  17. obligated to grant this special exception for their modified
  18. versions; it is their choice whether to do so. The GNU Lesser
  19. General Public License gives permission to release a modified
  20. version without this exception; this exception also makes it
  21. possible to release a modified version which carries forward this
  22. exception.
  23. The GNU C Library is distributed in the hope that it will be useful,
  24. but WITHOUT ANY WARRANTY; without even the implied warranty of
  25. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  26. Lesser General Public License for more details.
  27. You should have received a copy of the GNU Lesser General Public
  28. License along with the GNU C Library; if not, write to the Free
  29. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  30. 02111-1307 USA. */
  31. .text
  32. .align 4
  33. .import main, code
  34. .import $global$, data
  35. .import __uClibc_main, code
  36. .import _fini, code
  37. .import _init, code
  38. .globl _start
  39. .export _start, ENTRY
  40. .type _start,@function
  41. _start:
  42. .proc
  43. .callinfo
  44. /* load main */
  45. ldil LP%main, %r26
  46. ldo RP%main(%r26), %r26
  47. /* argc and argv should be in 25 and 24 */
  48. /* Expand the stack to store the 5th through 7th args */
  49. ldo 64(%sp), %sp
  50. /* void (*rtld_fini) (void) (actually the 6th arg) */
  51. stw %r23, -56(%sp)
  52. /* void (*init) (void) */
  53. ldil LP%_init, %r23
  54. ldo RP%_init(%r23), %r23
  55. /* void (*fini) (void) */
  56. ldil LP%_fini, %r22
  57. ldo RP%_fini(%r22), %r22
  58. stw %r22, -52(%sp)
  59. /* void *stack_end */
  60. stw %sp, -60(%sp)
  61. /* load global */
  62. ldil L%$global$, %dp
  63. ldo R%$global$(%dp), %dp
  64. bl __uClibc_main,%r2
  65. nop
  66. /* die horribly if it returned (it shouldn't) */
  67. iitlbp %r0,(%r0)
  68. nop
  69. .procend
  70. /* Define a symbol for the first piece of initialized data. */
  71. .data
  72. .globl __data_start
  73. __data_start:
  74. .long 0
  75. .weak data_start
  76. data_start = __data_start