_mcount.S 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /* Machine-specific calling sequence for `mcount' profiling function. SuperH
  2. Copyright (C) 2001-2019 Free Software Foundation, Inc.
  3. Contributed by NIIBE Yutaka <gniibe@m17n.org>
  4. This file is part of the GNU C Library.
  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, see
  15. <http://www.gnu.org/licenses/>. */
  16. #include <sysdep.h>
  17. .globl C_SYMBOL_NAME(_mcount)
  18. .type C_SYMBOL_NAME(_mcount),@function
  19. cfi_startproc
  20. .align 5
  21. C_LABEL(_mcount)
  22. /* Save registers. */
  23. mov.l r4,@-r15
  24. cfi_adjust_cfa_offset (4)
  25. cfi_rel_offset (r4, 0)
  26. mov.l r5,@-r15
  27. cfi_adjust_cfa_offset (4)
  28. cfi_rel_offset (r5, 0)
  29. mov.l r6,@-r15
  30. cfi_adjust_cfa_offset (4)
  31. cfi_rel_offset (r6, 0)
  32. mov.l r7,@-r15
  33. cfi_adjust_cfa_offset (4)
  34. cfi_rel_offset (r7, 0)
  35. sts.l pr,@-r15
  36. cfi_adjust_cfa_offset (4)
  37. cfi_rel_offset (pr, 0)
  38. mov.l @(20,r15),r4
  39. sts pr,r5
  40. #ifdef SHARED
  41. mov.l 0f,r1
  42. mova 0f,r0
  43. add r1,r0
  44. mov.l 1f,r1
  45. mov.l @(r0,r1),r1
  46. #else
  47. mov.l 1f,r1
  48. #endif
  49. jsr @r1
  50. nop
  51. /* Pop the saved registers. */
  52. lds.l @r15+,pr
  53. cfi_adjust_cfa_offset (-4)
  54. cfi_restore (pr)
  55. mov.l @r15+,r7
  56. cfi_adjust_cfa_offset (-4)
  57. cfi_restore (r7)
  58. mov.l @r15+,r6
  59. cfi_adjust_cfa_offset (-4)
  60. cfi_restore (r6)
  61. mov.l @r15+,r5
  62. cfi_adjust_cfa_offset (-4)
  63. cfi_restore (r5)
  64. rts
  65. mov.l @r15+,r4
  66. /* Omit CFI for restore in delay slot. */
  67. .align 2
  68. #ifdef SHARED
  69. 0: .long _GLOBAL_OFFSET_TABLE_
  70. 1: .long C_SYMBOL_NAME(__mcount_internal)@GOT
  71. #else
  72. 1: .long C_SYMBOL_NAME(__mcount_internal)
  73. #endif
  74. cfi_endproc
  75. ASM_SIZE_DIRECTIVE(C_SYMBOL_NAME(_mcount))
  76. #undef mcount
  77. weak_alias (_mcount, mcount)