1 /* PowerPC-specific implementation of profiling support.
2 Copyright (C) 1997-2012 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 <http://www.gnu.org/licenses/>. */
19 /* This would be bad. */
26 /* We do profiling as described in the SYSV ELF ABI, except that glibc
27 _mcount manages its own counters. The caller has put the address the
28 caller will return to in the usual place on the stack, 4(r1). _mcount
29 is responsible for ensuring that when it returns no argument-passing
30 registers are disturbed, and that the LR is set back to (what the
31 caller sees as) 4(r1).
33 This is intended so that the following code can be inserted at the
34 front of any routine without changing the routine:
44 cfi_adjust_cfa_offset (48)
45 /* We need to save the parameter-passing registers. */
61 bl JUMPTARGET(__mcount_internal)
63 bl __mcount_internal@local
65 /* Restore the registers... */
80 /* ...unwind the stack frame, and return to your usual programming. */