Re: [PATCH] ftrace/x86: Fix function graph tracer reset path

From: Steven Rostedt
Date: Mon May 16 2016 - 09:58:43 EST



Nice work Masami!

On Mon, 16 May 2016 21:32:50 +0900
Namhyung Kim <namhyung@xxxxxxxxxx> wrote:


> > -/* This is global to keep gas from relaxing the jumps */
> > -ENTRY(early_idt_handler)
> > +/* This is weak to keep gas from relaxing the jumps */
> > +WEAK(early_idt_handler)
> > cld

> So IIUC, this -mshared option disables the optimization on branch
> instructions and generates slightly bigger code. Not sure how much
> affected by this though.
>
> Steve, do you think it's better to use this option?

Can we solve this by doing the same thing it did for the kernel?

-- Steve

diff --git a/arch/x86/kernel/mcount_64.S b/arch/x86/kernel/mcount_64.S
index ed48a9f465f8..e13a695c3084 100644
--- a/arch/x86/kernel/mcount_64.S
+++ b/arch/x86/kernel/mcount_64.S
@@ -182,7 +182,8 @@ GLOBAL(ftrace_graph_call)
jmp ftrace_stub
#endif

-GLOBAL(ftrace_stub)
+/* This is weak to keep gas from relaxing the jumps */
+WEAK(ftrace_stub)
retq
END(ftrace_caller)