aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/module.c11
-rw-r--r--kernel/trace/ftrace.c5
2 files changed, 16 insertions, 0 deletions
diff --git a/kernel/module.c b/kernel/module.c
index 661d73db786e..d753fd9d83ec 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -47,6 +47,7 @@
47#include <linux/license.h> 47#include <linux/license.h>
48#include <asm/sections.h> 48#include <asm/sections.h>
49#include <linux/tracepoint.h> 49#include <linux/tracepoint.h>
50#include <linux/ftrace.h>
50 51
51#if 0 52#if 0
52#define DEBUGP printk 53#define DEBUGP printk
@@ -1834,6 +1835,7 @@ static noinline struct module *load_module(void __user *umod,
1834 unsigned int markersstringsindex; 1835 unsigned int markersstringsindex;
1835 unsigned int tracepointsindex; 1836 unsigned int tracepointsindex;
1836 unsigned int tracepointsstringsindex; 1837 unsigned int tracepointsstringsindex;
1838 unsigned int mcountindex;
1837 struct module *mod; 1839 struct module *mod;
1838 long err = 0; 1840 long err = 0;
1839 void *percpu = NULL, *ptr = NULL; /* Stops spurious gcc warning */ 1841 void *percpu = NULL, *ptr = NULL; /* Stops spurious gcc warning */
@@ -2124,6 +2126,9 @@ static noinline struct module *load_module(void __user *umod,
2124 tracepointsstringsindex = find_sec(hdr, sechdrs, secstrings, 2126 tracepointsstringsindex = find_sec(hdr, sechdrs, secstrings,
2125 "__tracepoints_strings"); 2127 "__tracepoints_strings");
2126 2128
2129 mcountindex = find_sec(hdr, sechdrs, secstrings,
2130 "__mcount_loc");
2131
2127 /* Now do relocations. */ 2132 /* Now do relocations. */
2128 for (i = 1; i < hdr->e_shnum; i++) { 2133 for (i = 1; i < hdr->e_shnum; i++) {
2129 const char *strtab = (char *)sechdrs[strindex].sh_addr; 2134 const char *strtab = (char *)sechdrs[strindex].sh_addr;
@@ -2184,6 +2189,12 @@ static noinline struct module *load_module(void __user *umod,
2184 mod->tracepoints + mod->num_tracepoints); 2189 mod->tracepoints + mod->num_tracepoints);
2185#endif 2190#endif
2186 } 2191 }
2192
2193 if (mcountindex) {
2194 void *mseg = (void *)sechdrs[mcountindex].sh_addr;
2195 ftrace_init_module(mseg, mseg + sechdrs[mcountindex].sh_size);
2196 }
2197
2187 err = module_finalize(hdr, sechdrs, mod); 2198 err = module_finalize(hdr, sechdrs, mod);
2188 if (err < 0) 2199 if (err < 0)
2189 goto cleanup; 2200 goto cleanup;
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index df96d5990c04..ea45bb1c0fd6 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -1541,6 +1541,11 @@ static int ftrace_convert_nops(unsigned long *start,
1541 return 0; 1541 return 0;
1542} 1542}
1543 1543
1544void ftrace_init_module(unsigned long *start, unsigned long *end)
1545{
1546 ftrace_convert_nops(start, end);
1547}
1548
1544extern unsigned long __start_mcount_loc[]; 1549extern unsigned long __start_mcount_loc[];
1545extern unsigned long __stop_mcount_loc[]; 1550extern unsigned long __stop_mcount_loc[];
1546 1551