crt1.S 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /* Copyright (C) 1991, 1992 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. The GNU C Library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Library General Public License as
  5. published by the Free Software Foundation; either version 2 of the
  6. License, or (at your option) any later version.
  7. The GNU C Library is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Library General Public License for more details.
  11. You should have received a copy of the GNU Library General Public
  12. License along with the GNU C Library; see the file COPYING.LIB. If
  13. not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  14. Cambridge, MA 02139, USA. */
  15. #include <features.h>
  16. #include <asm/unistd.h>
  17. #include "NM_Macros.S"
  18. #define __ASSEMBLY__
  19. #include <asm/ptrace.h> /* for REGWIN_SZ */
  20. .global _start
  21. .type __start,@function
  22. .weak _init
  23. .weak _fini
  24. .type main,@function
  25. .type __uClibc_main,@function
  26. .type __h_errno_location, @function
  27. .type _stdio_init, @function
  28. .type _stdio_term, @function
  29. .text
  30. _start:
  31. nop
  32. nop
  33. MOVIA %o0, main@h
  34. lds %o1,[%sp, (REGWIN_SZ / 4) + 0] /* main's argc */
  35. lds %o2,[%sp, (REGWIN_SZ / 4) + 1] /* main's argv */
  36. MOVIA %o3, _init@h
  37. MOVIA %o4, _fini@h
  38. mov %o5, %i0 /* rtld_fini */
  39. mov %o6, %sp /* stack_end */
  40. MOVIA %o7, __uClibc_main@h
  41. call %o7
  42. nop
  43. /* If that didn't kill us, ... */
  44. __exit:
  45. MOVIP %g1, __NR_exit
  46. trap 63