crt0.S 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /* Startup code for Alpha/ELF.
  2. Copyright (C) 1993,1995,1996,1997,1998,2000,2001 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. Contributed by Richard Henderson <rth@tamu.edu>
  5. The GNU C Library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Lesser General Public
  7. License as published by the Free Software Foundation; either
  8. version 2.1 of the License, or (at your option) any later version.
  9. The GNU C Library 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. See the GNU
  12. Lesser General Public License for more details.
  13. You should have received a copy of the GNU Lesser General Public
  14. License along with the GNU C Library; if not, write to the Free
  15. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  16. 02111-1307 USA. */
  17. .text
  18. .align 3
  19. .globl _start
  20. .ent _start, 0
  21. .type _start,@function
  22. _start:
  23. .frame $15, 0, $31
  24. mov $31, $15
  25. br $29, 1f
  26. 1: ldgp $29, 0($29)
  27. subq $30, 16, $30
  28. .prologue 0
  29. /* Load address of the user's main function. */
  30. lda $16, main
  31. ldl $17, 16($30) /* get argc */
  32. lda $18, 24($30) /* get argv */
  33. #if 0
  34. /* Load address of our own entry points to .fini and .init. */
  35. lda $19, _init
  36. lda $20, _fini
  37. /* Store address of the shared library termination function. */
  38. mov $0, $21
  39. /* Provide the highest stack address to the user code. */
  40. stq $30, 0($30)
  41. #endif
  42. /* Call the user's main function, and exit with its value.
  43. But let the libc call main. */
  44. jsr $26, __uClibc_main
  45. /* Die very horribly if exit returns. Call_pal hlt is callable from
  46. kernel mode only; this will result in an illegal instruction trap. */
  47. call_pal 0
  48. .end _start
  49. /* For ECOFF backwards compatibility. */
  50. .weak __start;
  51. __start = _start
  52. /* Define a symbol for the first piece of initialized data. */
  53. .data
  54. .globl __data_start
  55. __data_start:
  56. .long 0
  57. .weak data_start
  58. data_start = __data_start