]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/powerpc/kernel/module_64.c
Merge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/davej/cpufreq
[linux-2.6-omap-h63xx.git] / arch / powerpc / kernel / module_64.c
index 1af2377e49929dc367d49b4588fd2ba6d23d7e91..8992b031a7b6a6cc54433453b6b991d1610cb5d6 100644 (file)
@@ -20,6 +20,7 @@
 #include <linux/moduleloader.h>
 #include <linux/err.h>
 #include <linux/vmalloc.h>
+#include <linux/ftrace.h>
 #include <linux/bug.h>
 #include <asm/module.h>
 #include <asm/firmware.h>
@@ -163,6 +164,11 @@ static unsigned long get_stubs_size(const Elf64_Ehdr *hdr,
                }
        }
 
+#ifdef CONFIG_DYNAMIC_FTRACE
+       /* make the trampoline to the ftrace_caller */
+       relocs++;
+#endif
+
        DEBUGP("Looks like a total of %lu stubs, max\n", relocs);
        return relocs * sizeof(struct ppc64_stub_entry);
 }
@@ -441,5 +447,12 @@ int apply_relocate_add(Elf64_Shdr *sechdrs,
                }
        }
 
+#ifdef CONFIG_DYNAMIC_FTRACE
+       me->arch.toc = my_r2(sechdrs, me);
+       me->arch.tramp = stub_for_addr(sechdrs,
+                                      (unsigned long)ftrace_caller,
+                                      me);
+#endif
+
        return 0;
 }