Define elf_ifunc_invoke for ARM.
[glibc-ports.git] / sysdeps / arm / machine-gmon.h
blobdbda0ddeba47afe2e5c958c0b624c8c8464150d3
1 /* Machine-dependent definitions for profiling support. ARM version.
2 Copyright (C) 1996, 1997, 1998 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, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18 02111-1307 USA. */
20 /* GCC for the ARM cannot compile __builtin_return_address(N) for N != 0,
21 so we must use an assembly stub. */
23 #include <sysdep.h>
24 #ifndef NO_UNDERSCORES
25 /* The asm symbols for C functions are `_function'.
26 The canonical name for the counter function is `mcount', no _. */
27 void _mcount (void) asm ("mcount");
28 #else
29 /* The canonical name for the function is `_mcount' in both C and asm,
30 but some old asm code might assume it's `mcount'. */
31 void _mcount (void);
32 weak_alias (_mcount, mcount)
33 #endif
35 static void mcount_internal (u_long frompc, u_long selfpc) __attribute_used__;
37 #define _MCOUNT_DECL(frompc, selfpc) \
38 static void mcount_internal (u_long frompc, u_long selfpc)
40 /* This macro/func MUST save r0, r1 because the compiler inserts
41 blind calls to _mount(), ignoring the fact that _mcount may
42 clobber registers; therefore, _mcount may NOT clobber registers */
43 /* if (this_fp!=0) {
44 r0 = this_fp
45 r1 = this_lr
46 r1 = [r1-4] which is caller's lr
47 if (r1!=0)
48 r1 = caller's lr
49 call mcount_internal(this_lr, caller's_lr)
53 #ifdef __thumb2__
55 #define MCOUNT \
56 void _mcount (void) \
57 { \
58 __asm__("push {r0, r1, r2, r3};" \
59 "movs fp, fp;" \
60 "it eq;" \
61 "moveq r1, #0;" \
62 "itttt ne;" \
63 "ldrne r1, [fp, $-4];" \
64 "ldrne r0, [fp, $-12];" \
65 "movnes r0, r0;" \
66 "ldrne r0, [r0, $-4];" \
67 "movs r0, r0;" \
68 "it ne;" \
69 "blne mcount_internal;" \
70 "pop {r0, r1, r2, r3}"); \
73 #else
75 #define MCOUNT \
76 void _mcount (void) \
77 { \
78 __asm__("stmdb sp!, {r0, r1, r2, r3};" \
79 "movs fp, fp;" \
80 "moveq r1, #0;" \
81 "ldrne r1, [fp, $-4];" \
82 "ldrne r0, [fp, $-12];" \
83 "movnes r0, r0;" \
84 "ldrne r0, [r0, $-4];" \
85 "movs r0, r0;" \
86 "blne mcount_internal;" \
87 "ldmia sp!, {r0, r1, r2, r3}"); \
90 #endif