powerpc64: Fix by using the configure value $libc_cv_cc_submachine [BZ #31629]
[glibc.git] / sysdeps / sh / _mcount.S
blobbaf1c8e02322109ab7b56126b723832f6c8c9402
1 /* Machine-specific calling sequence for `mcount' profiling function.  SuperH
2    Copyright (C) 2001-2024 Free Software Foundation, Inc.
3    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.
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.
15    You should have received a copy of the GNU Lesser General Public
16    License along with the GNU C Library; if not, see
17    <https://www.gnu.org/licenses/>.  */
19 #include <sysdep.h>
21         .globl C_SYMBOL_NAME(_mcount)
22         .type C_SYMBOL_NAME(_mcount),@function
23         cfi_startproc
24         .align  5
25 C_LABEL(_mcount)
26         /* Save registers.  */
27         mov.l   r4,@-r15
28         cfi_adjust_cfa_offset (4)
29         cfi_rel_offset (r4, 0)
30         mov.l   r5,@-r15
31         cfi_adjust_cfa_offset (4)
32         cfi_rel_offset (r5, 0)
33         mov.l   r6,@-r15
34         cfi_adjust_cfa_offset (4)
35         cfi_rel_offset (r6, 0)
36         mov.l   r7,@-r15
37         cfi_adjust_cfa_offset (4)
38         cfi_rel_offset (r7, 0)
39         sts.l   pr,@-r15
40         cfi_adjust_cfa_offset (4)
41         cfi_rel_offset (pr, 0)
43         mov.l   @(20,r15),r4
44         sts     pr,r5
46 #ifdef SHARED
47         mov.l   0f,r1
48         mova    0f,r0
49         add     r1,r0
50         mov.l   1f,r1
51         mov.l   @(r0,r1),r1
52 #else
53         mov.l   1f,r1
54 #endif
55         jsr     @r1
56          nop
58         /* Pop the saved registers.  */
59         lds.l   @r15+,pr
60         cfi_adjust_cfa_offset (-4)
61         cfi_restore (pr)
62         mov.l   @r15+,r7
63         cfi_adjust_cfa_offset (-4)
64         cfi_restore (r7)
65         mov.l   @r15+,r6
66         cfi_adjust_cfa_offset (-4)
67         cfi_restore (r6)
68         mov.l   @r15+,r5
69         cfi_adjust_cfa_offset (-4)
70         cfi_restore (r5)
71         rts
72          mov.l  @r15+,r4
73         /* Omit CFI for restore in delay slot.  */
75         .align 2
76 #ifdef SHARED
77 0:      .long   _GLOBAL_OFFSET_TABLE_
78 1:      .long   C_SYMBOL_NAME(__mcount_internal)@GOT
79 #else
80 1:      .long   C_SYMBOL_NAME(__mcount_internal)
81 #endif
82         cfi_endproc
83 ASM_SIZE_DIRECTIVE(C_SYMBOL_NAME(_mcount))
85 #undef mcount
86 weak_alias (_mcount, mcount)