Profiling is enabled by means of the -pg
compiler option. In this mode, the compiler inserts a call to
__gnu_mcount_nc
into every function prologue.
However, no implementation of __gnu_mcount_nc
is provided (to do so would be impossible without knowledge of
the execution environment).
You must provide your own implementation of
__gnu_mcount_nc
. Here are the requirements:
lr
register. The sp
register should
be adjusted accordingly. For example, this is how to write it
as a stub function:
.globl __gnu_mcount_nc .type __gnu_mcount_nc, %function __gnu_mcount_nc: mov ip, lr pop { lr } bx ip
r12
and the CPSR condition code bits. In particular all coprocessor
state and registers r0
-r3
must
be preserved.
lr
value stored on the top of the stack (on entry
to __gnu_mcount_nc
), and the callee can
be determined from the current value of the lr
register (i.e. the caller of this function).
gmon.out
when the program exits
(via atexit
). Refer to the
gprof
profiler manual for more information.