crti.S 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. # Machine description for AArch64 architecture.
  2. # Copyright (C) 2009-2022 Free Software Foundation, Inc.
  3. # Contributed by ARM Ltd.
  4. #
  5. # This file is free software; you can redistribute it and/or modify it
  6. # under the terms of the GNU General Public License as published by the
  7. # Free Software Foundation; either version 3, or (at your option) any
  8. # later version.
  9. #
  10. # This file is distributed in the hope that it will be useful, but
  11. # WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. # General Public License for more details.
  14. #
  15. # Under Section 7 of GPL version 3, you are granted additional
  16. # permissions described in the GCC Runtime Library Exception, version
  17. # 3.1, as published by the Free Software Foundation.
  18. #
  19. # You should have received a copy of the GNU General Public License and
  20. # a copy of the GCC Runtime Library Exception along with this program;
  21. # see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  22. # <http://www.gnu.org/licenses/>.
  23. /* An executable stack is *not* required for these functions. */
  24. #if defined(__ELF__) && defined(__linux__)
  25. .section .note.GNU-stack,"",%progbits
  26. .previous
  27. #endif
  28. # This file creates a stack frame for the contents of the .fini and
  29. # .init sections. Users may put any desired instructions in those
  30. # sections.
  31. #ifdef __ELF__
  32. #define TYPE(x) .type x,function
  33. #else
  34. #define TYPE(x)
  35. #endif
  36. # Note - this macro is complemented by the FUNC_END macro
  37. # in crtn.S. If you change this macro you must also change
  38. # that macro match.
  39. .macro FUNC_START
  40. # Create a stack frame and save any call-preserved registers
  41. stp x29, x30, [sp, #-16]!
  42. stp x27, x28, [sp, #-16]!
  43. stp x25, x26, [sp, #-16]!
  44. stp x23, x24, [sp, #-16]!
  45. stp x21, x22, [sp, #-16]!
  46. stp x19, x20, [sp, #-16]!
  47. .endm
  48. .section ".init"
  49. .align 2
  50. .global _init
  51. TYPE(_init)
  52. _init:
  53. FUNC_START
  54. .section ".fini"
  55. .align 2
  56. .global _fini
  57. TYPE(_fini)
  58. _fini:
  59. FUNC_START
  60. # end of crti.S