Commit d3c61619 authored by Stefan Agner's avatar Stefan Agner Committed by Russell King

ARM: 8788/1: ftrace: remove old mcount support

Commit cafa0010 ("Raise the minimum required gcc version to 4.6")
raised the minimum GCC version to 4.6. Old mcount is only required for
GCC versions older than 4.4.0. Hence old mcount support can be dropped
too.
Signed-off-by: default avatarStefan Agner <stefan@agner.ch>
Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
parent f3c89992
...@@ -70,11 +70,6 @@ config ARM_UNWIND ...@@ -70,11 +70,6 @@ config ARM_UNWIND
the performance is not affected. Currently, this feature the performance is not affected. Currently, this feature
only works with EABI compilers. If unsure say Y. only works with EABI compilers. If unsure say Y.
config OLD_MCOUNT
bool
depends on FUNCTION_TRACER && FRAME_POINTER
default y
config DEBUG_USER config DEBUG_USER
bool "Verbose user fault messages" bool "Verbose user fault messages"
help help
......
...@@ -16,9 +16,6 @@ extern void __gnu_mcount_nc(void); ...@@ -16,9 +16,6 @@ extern void __gnu_mcount_nc(void);
#ifdef CONFIG_DYNAMIC_FTRACE #ifdef CONFIG_DYNAMIC_FTRACE
struct dyn_arch_ftrace { struct dyn_arch_ftrace {
#ifdef CONFIG_OLD_MCOUNT
bool old_mcount;
#endif
}; };
static inline unsigned long ftrace_call_adjust(unsigned long addr) static inline unsigned long ftrace_call_adjust(unsigned long addr)
......
...@@ -167,9 +167,6 @@ EXPORT_SYMBOL(_find_next_bit_be); ...@@ -167,9 +167,6 @@ EXPORT_SYMBOL(_find_next_bit_be);
#endif #endif
#ifdef CONFIG_FUNCTION_TRACER #ifdef CONFIG_FUNCTION_TRACER
#ifdef CONFIG_OLD_MCOUNT
EXPORT_SYMBOL(mcount);
#endif
EXPORT_SYMBOL(__gnu_mcount_nc); EXPORT_SYMBOL(__gnu_mcount_nc);
#endif #endif
......
...@@ -15,23 +15,8 @@ ...@@ -15,23 +15,8 @@
* start of every function. In mcount, apart from the function's address (in * start of every function. In mcount, apart from the function's address (in
* lr), we need to get hold of the function's caller's address. * lr), we need to get hold of the function's caller's address.
* *
* Older GCCs (pre-4.4) inserted a call to a routine called mcount like this: * Newer GCCs (4.4+) solve this problem by using a version of mcount with call
* * sites like:
* bl mcount
*
* These versions have the limitation that in order for the mcount routine to
* be able to determine the function's caller's address, an APCS-style frame
* pointer (which is set up with something like the code below) is required.
*
* mov ip, sp
* push {fp, ip, lr, pc}
* sub fp, ip, #4
*
* With EABI, these frame pointers are not available unless -mapcs-frame is
* specified, and if building as Thumb-2, not even then.
*
* Newer GCCs (4.4+) solve this problem by introducing a new version of mcount,
* with call sites like:
* *
* push {lr} * push {lr}
* bl __gnu_mcount_nc * bl __gnu_mcount_nc
...@@ -46,17 +31,10 @@ ...@@ -46,17 +31,10 @@
* allows it to be clobbered in subroutines and doesn't use it to hold * allows it to be clobbered in subroutines and doesn't use it to hold
* parameters.) * parameters.)
* *
* When using dynamic ftrace, we patch out the mcount call by a "mov r0, r0" * When using dynamic ftrace, we patch out the mcount call by a "pop {lr}"
* for the mcount case, and a "pop {lr}" for the __gnu_mcount_nc case (see * instead of the __gnu_mcount_nc call (see arch/arm/kernel/ftrace.c).
* arch/arm/kernel/ftrace.c).
*/ */
#ifndef CONFIG_OLD_MCOUNT
#if (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 4))
#error Ftrace requires CONFIG_FRAME_POINTER=y with GCC older than 4.4.0.
#endif
#endif
.macro mcount_adjust_addr rd, rn .macro mcount_adjust_addr rd, rn
bic \rd, \rn, #1 @ clear the Thumb bit if present bic \rd, \rn, #1 @ clear the Thumb bit if present
sub \rd, \rd, #MCOUNT_INSN_SIZE sub \rd, \rd, #MCOUNT_INSN_SIZE
...@@ -209,51 +187,6 @@ ftrace_graph_call\suffix: ...@@ -209,51 +187,6 @@ ftrace_graph_call\suffix:
mcount_exit mcount_exit
.endm .endm
#ifdef CONFIG_OLD_MCOUNT
/*
* mcount
*/
.macro mcount_enter
stmdb sp!, {r0-r3, lr}
.endm
.macro mcount_get_lr reg
ldr \reg, [fp, #-4]
.endm
.macro mcount_exit
ldr lr, [fp, #-4]
ldmia sp!, {r0-r3, pc}
.endm
ENTRY(mcount)
#ifdef CONFIG_DYNAMIC_FTRACE
stmdb sp!, {lr}
ldr lr, [fp, #-4]
ldmia sp!, {pc}
#else
__mcount _old
#endif
ENDPROC(mcount)
#ifdef CONFIG_DYNAMIC_FTRACE
ENTRY(ftrace_caller_old)
__ftrace_caller _old
ENDPROC(ftrace_caller_old)
#endif
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
ENTRY(ftrace_graph_caller_old)
__ftrace_graph_caller
ENDPROC(ftrace_graph_caller_old)
#endif
.purgem mcount_enter
.purgem mcount_get_lr
.purgem mcount_exit
#endif
/* /*
* __gnu_mcount_nc * __gnu_mcount_nc
*/ */
......
...@@ -47,30 +47,6 @@ void arch_ftrace_update_code(int command) ...@@ -47,30 +47,6 @@ void arch_ftrace_update_code(int command)
stop_machine(__ftrace_modify_code, &command, NULL); stop_machine(__ftrace_modify_code, &command, NULL);
} }
#ifdef CONFIG_OLD_MCOUNT
#define OLD_MCOUNT_ADDR ((unsigned long) mcount)
#define OLD_FTRACE_ADDR ((unsigned long) ftrace_caller_old)
#define OLD_NOP 0xe1a00000 /* mov r0, r0 */
static unsigned long ftrace_nop_replace(struct dyn_ftrace *rec)
{
return rec->arch.old_mcount ? OLD_NOP : NOP;
}
static unsigned long adjust_address(struct dyn_ftrace *rec, unsigned long addr)
{
if (!rec->arch.old_mcount)
return addr;
if (addr == MCOUNT_ADDR)
addr = OLD_MCOUNT_ADDR;
else if (addr == FTRACE_ADDR)
addr = OLD_FTRACE_ADDR;
return addr;
}
#else
static unsigned long ftrace_nop_replace(struct dyn_ftrace *rec) static unsigned long ftrace_nop_replace(struct dyn_ftrace *rec)
{ {
return NOP; return NOP;
...@@ -80,7 +56,6 @@ static unsigned long adjust_address(struct dyn_ftrace *rec, unsigned long addr) ...@@ -80,7 +56,6 @@ static unsigned long adjust_address(struct dyn_ftrace *rec, unsigned long addr)
{ {
return addr; return addr;
} }
#endif
int ftrace_arch_code_modify_prepare(void) int ftrace_arch_code_modify_prepare(void)
{ {
...@@ -150,15 +125,6 @@ int ftrace_update_ftrace_func(ftrace_func_t func) ...@@ -150,15 +125,6 @@ int ftrace_update_ftrace_func(ftrace_func_t func)
} }
#endif #endif
#ifdef CONFIG_OLD_MCOUNT
if (!ret) {
pc = (unsigned long)&ftrace_call_old;
new = ftrace_call_replace(pc, (unsigned long)func);
ret = ftrace_modify_code(pc, 0, new, false);
}
#endif
return ret; return ret;
} }
...@@ -203,16 +169,6 @@ int ftrace_make_nop(struct module *mod, ...@@ -203,16 +169,6 @@ int ftrace_make_nop(struct module *mod,
new = ftrace_nop_replace(rec); new = ftrace_nop_replace(rec);
ret = ftrace_modify_code(ip, old, new, true); ret = ftrace_modify_code(ip, old, new, true);
#ifdef CONFIG_OLD_MCOUNT
if (ret == -EINVAL && addr == MCOUNT_ADDR) {
rec->arch.old_mcount = true;
old = ftrace_call_replace(ip, adjust_address(rec, addr));
new = ftrace_nop_replace(rec);
ret = ftrace_modify_code(ip, old, new, true);
}
#endif
return ret; return ret;
} }
...@@ -290,13 +246,6 @@ static int ftrace_modify_graph_caller(bool enable) ...@@ -290,13 +246,6 @@ static int ftrace_modify_graph_caller(bool enable)
#endif #endif
#ifdef CONFIG_OLD_MCOUNT
if (!ret)
ret = __ftrace_modify_caller(&ftrace_graph_call_old,
ftrace_graph_caller_old,
enable);
#endif
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment