From: Martin Schwidefsky <schwidefsky@xxxxxxxxxx> Do the mcount offset adjustment in the recordmcount.pl/recordmcount.[ch] at compile time and not in ftrace_call_adjust at run time. Signed-off-by: Martin Schwidefsky <schwidefsky@xxxxxxxxxx> --- arch/x86/include/asm/ftrace.h | 7 +++---- scripts/recordmcount.c | 10 ++++++++-- scripts/recordmcount.pl | 2 ++ 3 files changed, 13 insertions(+), 6 deletions(-) Index: test-2.6/arch/x86/include/asm/ftrace.h =================================================================== --- test-2.6.orig/arch/x86/include/asm/ftrace.h 2009-09-12 09:47:14.000000000 +0200 +++ test-2.6/arch/x86/include/asm/ftrace.h 2011-05-03 09:39:02.145472579 +0200 @@ -38,11 +38,10 @@ static inline unsigned long ftrace_call_adjust(unsigned long addr) { /* - * call mcount is "e8 <4 byte offset>" - * The addr points to the 4 byte offset and the caller of this - * function wants the pointer to e8. Simply subtract one. + * addr is the address of the mcount call instruction. + * recordmcount does the necessary offset calculation. */ - return addr - 1; + return addr; } #ifdef CONFIG_DYNAMIC_FTRACE Index: test-2.6/scripts/recordmcount.c =================================================================== --- test-2.6.orig/scripts/recordmcount.c 2011-03-16 09:26:43.006913981 +0100 +++ test-2.6/scripts/recordmcount.c 2011-05-03 09:39:02.145472579 +0200 @@ -300,7 +300,10 @@ w2(ehdr->e_machine), fname); fail_file(); } break; - case EM_386: reltype = R_386_32; break; + case EM_386: + reltype = R_386_32; + mcount_adjust_32 = -1; + break; case EM_ARM: reltype = R_ARM_ABS32; altmcount = "__gnu_mcount_nc"; break; @@ -311,7 +314,10 @@ case EM_S390: /* reltype: e_class */ gpfx = '_'; break; case EM_SH: reltype = R_SH_DIR32; break; case EM_SPARCV9: reltype = R_SPARC_64; gpfx = '_'; break; - case EM_X86_64: reltype = R_X86_64_64; break; + case EM_X86_64: + reltype = R_X86_64_64; + mcount_adjust_64 = -1; + break; } /* end switch */ switch (ehdr->e_ident[EI_CLASS]) { Index: test-2.6/scripts/recordmcount.pl =================================================================== --- test-2.6.orig/scripts/recordmcount.pl 2011-03-16 09:26:43.006913981 +0100 +++ test-2.6/scripts/recordmcount.pl 2011-05-03 09:39:02.145472579 +0200 @@ -222,6 +222,7 @@ $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\smcount([+-]0x[0-9a-zA-Z]+)?\$"; $type = ".quad"; $alignment = 8; + $mcount_adjust = -1; # force flags for this arch $ld .= " -m elf_x86_64"; @@ -231,6 +232,7 @@ } elsif ($arch eq "i386") { $alignment = 4; + $mcount_adjust = -1; # force flags for this arch $ld .= " -m elf_i386"; -- To unsubscribe from this list: send the line "unsubscribe linux-arch" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html