[ARM] support tracing when using newer compilers
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Thu, 13 Aug 2009 18:38:16 +0000 (20:38 +0200)
committerUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Thu, 13 Aug 2009 18:34:36 +0000 (20:34 +0200)
Since gcc 4.4 the name and calling convention for function profiling
on ARM changed.  With this patch both types are supported.

See http://sourceware.org/ml/libc-ports/2008-04/msg00009.html for some
details.

Lightly-Tested-by: Anand Gadiyar <gadiyar@ti.com>
Tested-by: Kevin Hilman <khilman@deeprootsystems.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
arch/arm/include/asm/ftrace.h
arch/arm/kernel/armksyms.c
arch/arm/kernel/entry-common.S

index 39c8bc1a006afbfbca896948ae86c4268e7ed52e..0d4c478e01b62829474ac487bcbe1cd09cecc379 100644 (file)
@@ -7,6 +7,7 @@
 
 #ifndef __ASSEMBLY__
 extern void mcount(void);
+extern void __gnu_mcount_nc(void);
 #endif
 
 #endif
index 531e1860e546dbf5e5a13016a16cf30aea061c96..0e627705f74632d9dab0ae5079bc5eb2910a83b3 100644 (file)
@@ -186,4 +186,5 @@ EXPORT_SYMBOL(_find_next_bit_be);
 
 #ifdef CONFIG_FUNCTION_TRACER
 EXPORT_SYMBOL(mcount);
+EXPORT_SYMBOL(__gnu_mcount_nc);
 #endif
index 366e5097a41a4f535d1d24ddccab44f13580fb64..99208728d48fd33133c54d480e7be59857ac7c55 100644 (file)
@@ -132,6 +132,25 @@ ftrace_call:
 
 #else
 
+ENTRY(__gnu_mcount_nc)
+       stmdb sp!, {r0-r3, lr}
+       ldr r0, =ftrace_trace_function
+       ldr r2, [r0]
+       adr r0, ftrace_stub
+       cmp r0, r2
+       bne gnu_trace
+       ldmia sp!, {r0-r3, ip, lr}
+       bx ip
+
+gnu_trace:
+       ldr r1, [sp, #20]                       @ lr of instrumented routine
+       mov r0, lr
+       sub r0, r0, #MCOUNT_INSN_SIZE
+       mov lr, pc
+       mov pc, r2
+       ldmia sp!, {r0-r3, ip, lr}
+       bx ip
+
 ENTRY(mcount)
        stmdb sp!, {r0-r3, lr}
        ldr r0, =ftrace_trace_function