diff options
author | Namhyung Kim <namhyung.kim@lge.com> | 2014-01-03 00:12:46 -0500 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2014-01-03 15:27:18 -0500 |
commit | e0d18fe063464cb3f1a6d1939e4fcf47d92d8386 (patch) | |
tree | 061fdc3f78de07af82fbe7695c3c5e78d896c3bd /kernel/trace | |
parent | b7e0bf341f6cfa92ae0a0e3d0c3496729595e1e9 (diff) |
tracing/probes: Fix build break on !CONFIG_KPROBE_EVENT
When kprobe-based dynamic event tracer is not enabled, it caused
following build error:
kernel/built-in.o: In function `traceprobe_update_arg':
(.text+0x10c8dd): undefined reference to `fetch_symbol_u8'
kernel/built-in.o: In function `traceprobe_update_arg':
(.text+0x10c8e9): undefined reference to `fetch_symbol_u16'
kernel/built-in.o: In function `traceprobe_update_arg':
(.text+0x10c8f5): undefined reference to `fetch_symbol_u32'
kernel/built-in.o: In function `traceprobe_update_arg':
(.text+0x10c901): undefined reference to `fetch_symbol_u64'
kernel/built-in.o: In function `traceprobe_update_arg':
(.text+0x10c909): undefined reference to `fetch_symbol_string'
kernel/built-in.o: In function `traceprobe_update_arg':
(.text+0x10c913): undefined reference to `fetch_symbol_string_size'
...
It was due to the fetch methods are referred from CHECK_FETCH_FUNCS
macro and since it was only defined in trace_kprobe.c. Move NULL
definition of such fetch functions to the header file.
Note, it also requires CONFIG_BRANCH_PROFILING enabled to trigger
this failure as well. This is because the "fetch_symbol_*" variables
are referenced in a "else if" statement that will only call
update_symbol_cache(), which is a static inline stub function
when CONFIG_KPROBE_EVENT is not enabled. gcc is smart enough
to optimize this "else if" out and that also removes the code that
references the undefined variables.
But when BRANCH_PROFILING is enabled, it fools gcc into keeping
the if statement around and thus references the undefined symbols
and fails to build.
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace')
-rw-r--r-- | kernel/trace/trace_probe.h | 8 | ||||
-rw-r--r-- | kernel/trace/trace_uprobe.c | 8 |
2 files changed, 8 insertions, 8 deletions
diff --git a/kernel/trace/trace_probe.h b/kernel/trace/trace_probe.h index e29d743fef5d..b73574a5f429 100644 --- a/kernel/trace/trace_probe.h +++ b/kernel/trace/trace_probe.h | |||
@@ -243,6 +243,14 @@ unsigned long update_symbol_cache(struct symbol_cache *sc); | |||
243 | void free_symbol_cache(struct symbol_cache *sc); | 243 | void free_symbol_cache(struct symbol_cache *sc); |
244 | struct symbol_cache *alloc_symbol_cache(const char *sym, long offset); | 244 | struct symbol_cache *alloc_symbol_cache(const char *sym, long offset); |
245 | #else | 245 | #else |
246 | /* uprobes do not support symbol fetch methods */ | ||
247 | #define fetch_symbol_u8 NULL | ||
248 | #define fetch_symbol_u16 NULL | ||
249 | #define fetch_symbol_u32 NULL | ||
250 | #define fetch_symbol_u64 NULL | ||
251 | #define fetch_symbol_string NULL | ||
252 | #define fetch_symbol_string_size NULL | ||
253 | |||
246 | struct symbol_cache { | 254 | struct symbol_cache { |
247 | }; | 255 | }; |
248 | static inline unsigned long __used update_symbol_cache(struct symbol_cache *sc) | 256 | static inline unsigned long __used update_symbol_cache(struct symbol_cache *sc) |
diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c index 1fdea6d3f851..79e52d93860b 100644 --- a/kernel/trace/trace_uprobe.c +++ b/kernel/trace/trace_uprobe.c | |||
@@ -172,14 +172,6 @@ static __kprobes void FETCH_FUNC_NAME(memory, string_size)(struct pt_regs *regs, | |||
172 | *(u32 *)dest = len; | 172 | *(u32 *)dest = len; |
173 | } | 173 | } |
174 | 174 | ||
175 | /* uprobes do not support symbol fetch methods */ | ||
176 | #define fetch_symbol_u8 NULL | ||
177 | #define fetch_symbol_u16 NULL | ||
178 | #define fetch_symbol_u32 NULL | ||
179 | #define fetch_symbol_u64 NULL | ||
180 | #define fetch_symbol_string NULL | ||
181 | #define fetch_symbol_string_size NULL | ||
182 | |||
183 | static unsigned long translate_user_vaddr(void *file_offset) | 175 | static unsigned long translate_user_vaddr(void *file_offset) |
184 | { | 176 | { |
185 | unsigned long base_addr; | 177 | unsigned long base_addr; |