Commit 521ccb5c authored by Martin Schwidefsky's avatar Martin Schwidefsky Committed by Steven Rostedt

ftrace/x86: mcount offset calculation

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: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
parent 07d8b595
...@@ -38,11 +38,10 @@ extern void mcount(void); ...@@ -38,11 +38,10 @@ extern void mcount(void);
static inline unsigned long ftrace_call_adjust(unsigned long addr) static inline unsigned long ftrace_call_adjust(unsigned long addr)
{ {
/* /*
* call mcount is "e8 <4 byte offset>" * addr is the address of the mcount call instruction.
* The addr points to the 4 byte offset and the caller of this * recordmcount does the necessary offset calculation.
* function wants the pointer to e8. Simply subtract one.
*/ */
return addr - 1; return addr;
} }
#ifdef CONFIG_DYNAMIC_FTRACE #ifdef CONFIG_DYNAMIC_FTRACE
......
...@@ -335,6 +335,7 @@ do_file(char const *const fname) ...@@ -335,6 +335,7 @@ do_file(char const *const fname)
reltype = R_386_32; reltype = R_386_32;
make_nop = make_nop_x86; make_nop = make_nop_x86;
ideal_nop = ideal_nop5_x86_32; ideal_nop = ideal_nop5_x86_32;
mcount_adjust_32 = -1;
break; break;
case EM_ARM: reltype = R_ARM_ABS32; case EM_ARM: reltype = R_ARM_ABS32;
altmcount = "__gnu_mcount_nc"; altmcount = "__gnu_mcount_nc";
...@@ -350,6 +351,7 @@ do_file(char const *const fname) ...@@ -350,6 +351,7 @@ do_file(char const *const fname)
make_nop = make_nop_x86; make_nop = make_nop_x86;
ideal_nop = ideal_nop5_x86_64; ideal_nop = ideal_nop5_x86_64;
reltype = R_X86_64_64; reltype = R_X86_64_64;
mcount_adjust_64 = -1;
break; break;
} /* end switch */ } /* end switch */
......
...@@ -223,6 +223,7 @@ if ($arch eq "x86_64") { ...@@ -223,6 +223,7 @@ if ($arch eq "x86_64") {
$mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\smcount([+-]0x[0-9a-zA-Z]+)?\$"; $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\smcount([+-]0x[0-9a-zA-Z]+)?\$";
$type = ".quad"; $type = ".quad";
$alignment = 8; $alignment = 8;
$mcount_adjust = -1;
# force flags for this arch # force flags for this arch
$ld .= " -m elf_x86_64"; $ld .= " -m elf_x86_64";
...@@ -232,6 +233,7 @@ if ($arch eq "x86_64") { ...@@ -232,6 +233,7 @@ if ($arch eq "x86_64") {
} elsif ($arch eq "i386") { } elsif ($arch eq "i386") {
$alignment = 4; $alignment = 4;
$mcount_adjust = -1;
# force flags for this arch # force flags for this arch
$ld .= " -m elf_i386"; $ld .= " -m elf_i386";
......
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