prt0.as 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. #include <sysdep.h>
  17. #include "bp-sym.h"
  18. /* These are the various addresses we require. */
  19. .section ".rodata"
  20. .align 2
  21. weak_extern(_init)
  22. weak_extern(_fini)
  23. L(start_addresses):
  24. .long _SDA_BASE_
  25. .long JUMPTARGET(BP_SYM (main))
  26. .long JUMPTARGET(_init)
  27. .long JUMPTARGET(_fini)
  28. ASM_SIZE_DIRECTIVE(L(start_addresses))
  29. .section ".text"
  30. ENTRY(_start)
  31. /* Save the stack pointer, in case we're statically linked under Linux. */
  32. mr r9,r1
  33. /* Set up an initial stack frame, and clear the LR. */
  34. clrrwi r1,r1,4
  35. li r0,0
  36. stwu r1,-16(r1)
  37. mtlr r0
  38. stw r0,0(r1)
  39. /* Set r13 to point at the 'small data area', and put the address of
  40. start_addresses in r8... */
  41. lis r8,L(start_addresses)@ha
  42. lwzu r13,L(start_addresses)@l(r8)
  43. /* and continue in libc-start, in glibc. */
  44. b JUMPTARGET(BP_SYM (__libc_start_main))
  45. END(_start)
  46. /* Define a symbol for the first piece of initialized data. */
  47. .section ".data"
  48. .globl __data_start
  49. __data_start:
  50. weak_alias (__data_start, data_start)
  51. /*
  52. $Log$
  53. Revision 1.2 2002-07-26 17:09:44 florian
  54. * log fixed
  55. Revision 1.1 2002/07/26 16:57:40 florian
  56. + initial version, plain copy from glibc/sysdeps/powerpc/elf/start.S
  57. */