]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
x86/function-graph: fix constraint for recording old return value
authorSteven Rostedt <srostedt@redhat.com>
Wed, 13 May 2009 17:52:19 +0000 (13:52 -0400)
committerSteven Rostedt <rostedt@goodmis.org>
Wed, 13 May 2009 17:52:19 +0000 (13:52 -0400)
After upgrading from gcc 4.2.2 to 4.4.0, the function graph tracer broke.
Investigating, I found that in the asm that replaces the return value,
gcc was using the same register for the old value as it was for the
new value.

mov (addr), old
mov new, (addr)

But if old and new are the same register, we clobber new with old!
I first thought this was a bug in gcc 4.4.0 and reported it:

  http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40132

Andrew Pinski responded (quickly), saying that it was correct gcc behavior
and the code needed to denote old as an "early clobber".

Instead of "=r"(old), we need "=&r"(old).

[Impact: keep function graph tracer from breaking with gcc 4.4.0 ]

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
arch/x86/kernel/ftrace.c

index 18dfa30795c9fe79e617457983acb7e1baa5dbd6..b79c5533c421b4aa7e18d753b64dba3c1f055b90 100644 (file)
@@ -442,7 +442,7 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr)
                _ASM_EXTABLE(1b, 4b)
                _ASM_EXTABLE(2b, 4b)
 
-               : [old] "=r" (old), [faulted] "=r" (faulted)
+               : [old] "=&r" (old), [faulted] "=r" (faulted)
                : [parent] "r" (parent), [return_hooker] "r" (return_hooker)
                : "memory"
        );