ftrace/x86: mcount offset calculation
authorMartin Schwidefsky <schwidefsky@de.ibm.com>
Tue, 10 May 2011 08:10:41 +0000 (10:10 +0200)
committerSteven Rostedt <rostedt@goodmis.org>
Mon, 16 May 2011 18:55:57 +0000 (14:55 -0400)
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@de.ibm.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
arch/x86/include/asm/ftrace.h
scripts/recordmcount.c
scripts/recordmcount.pl

index db24c2278be04c7400f6f5057904d49642fa75e9..268c783ab1c0e5393db3339fee48b90381ff5bee 100644 (file)
@@ -38,11 +38,10 @@ extern void mcount(void);
 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 0e18975824f768a4c6d01ba8b1802019035e2e27..7648a5d11154d6fe87fe1c3cdf25a43d19bcb273 100644 (file)
@@ -335,6 +335,7 @@ do_file(char const *const fname)
                reltype = R_386_32;
                make_nop = make_nop_x86;
                ideal_nop = ideal_nop5_x86_32;
+               mcount_adjust_32 = -1;
                break;
        case EM_ARM:     reltype = R_ARM_ABS32;
                         altmcount = "__gnu_mcount_nc";
@@ -350,6 +351,7 @@ do_file(char const *const fname)
                make_nop = make_nop_x86;
                ideal_nop = ideal_nop5_x86_64;
                reltype = R_X86_64_64;
+               mcount_adjust_64 = -1;
                break;
        }  /* end switch */
 
index a871cd41405580653a41cb89c09b96bfbdc954ea..414e7f5e42ec9fd786996b94f151a4430a91276b 100755 (executable)
@@ -223,6 +223,7 @@ if ($arch eq "x86_64") {
     $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";
@@ -232,6 +233,7 @@ if ($arch eq "x86_64") {
 
 } elsif ($arch eq "i386") {
     $alignment = 4;
+    $mcount_adjust = -1;
 
     # force flags for this arch
     $ld .= " -m elf_i386";