prt0.as 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. # $Id$
  2. /* Startup code for elf32-sparc
  3. Copyright (C) 1997, 1998 Free Software Foundation, Inc.
  4. This file is part of the GNU C Library.
  5. Contributed by Richard Henderson <[email protected]>, 1997.
  6. The GNU C Library is free software; you can redistribute it and/or
  7. modify it under the terms of the GNU Lesser General Public
  8. License as published by the Free Software Foundation; either
  9. version 2.1 of the License, or (at your option) any later version.
  10. The GNU C Library is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. Lesser General Public License for more details.
  14. You should have received a copy of the GNU Lesser General Public
  15. License along with the GNU C Library; if not, write to the Free
  16. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  17. 02111-1307 USA. */
  18. #include <sysdep.h>
  19. .section ".text"
  20. .align 4
  21. .global _start
  22. .type _start,#function
  23. _start:
  24. /* Terminate the stack frame, and reserve space for functions to
  25. drop their arguments. */
  26. mov %g0, %fp
  27. sub %sp, 6*4, %sp
  28. /* Extract the arguments and environment as encoded on the stack. The
  29. argument info starts after one register window (16 words) past the SP. */
  30. ld [%sp+22*4], %o1
  31. add %sp, 23*4, %o2
  32. /* Load the addresses of the user entry points. */
  33. sethi %hi(main), %o0
  34. sethi %hi(fpc_initialize), %o3
  35. sethi %hi(fpc_finalize), %o4
  36. or %o0, %lo(main), %o0
  37. or %o3, %lo(fpc_initialize), %o3
  38. or %o4, %lo(fpc_finalize), %o4
  39. /* When starting a binary via the dynamic linker, %g1 contains the
  40. address of the shared library termination function, which will be
  41. registered with atexit(). If we are statically linked, this will
  42. be NULL. */
  43. mov %g1, %o5
  44. /* Call the user program entry point. */
  45. call PASCALMAIN
  46. nop
  47. /* Die very horribly if exit returns. */
  48. unimp
  49. .size _start, .-_start
  50. # $Log$
  51. # Revision 1.4 2003-06-02 22:03:37 mazen
  52. # *making init and fini symbols compatible FPC code by
  53. # changing _init ==> fpc_initialize
  54. # and _fini ==> fpc_finalize
  55. #
  56. # Revision 1.3 2002/11/18 19:03:46 mazen
  57. # * start code of gcc adapted for FPC
  58. #