Commit b590cddfa6f40447158323b43a13cdae01d9a051
1 parent
da5cabf80e
Exists in
master
and in
39 other branches
kdb: fix compile error without CONFIG_KALLSYMS
If CONFIG_KGDB_KDB is set and CONFIG_KALLSYMS is not set the kernel will fail to build with the error: kernel/built-in.o: In function `kallsyms_symbol_next': kernel/debug/kdb/kdb_support.c:237: undefined reference to `kdb_walk_kallsyms' kernel/built-in.o: In function `kallsyms_symbol_complete': kernel/debug/kdb/kdb_support.c:193: undefined reference to `kdb_walk_kallsyms' The kdb_walk_kallsyms needs a #ifdef proper header to match the C implementation. This patch also fixes the compiler warnings in kdb_support.c when compiling without CONFIG_KALLSYMS set. The compiler warnings are a result of the kallsyms_lookup() macro not initializing the two of the pass by reference variables. Signed-off-by: Jason Wessel <jason.wessel@windriver.com> Reported-by: Michal Simek <monstr@monstr.eu>
Showing 2 changed files with 9 additions and 2 deletions Side-by-side Diff
kernel/debug/kdb/kdb_private.h
... | ... | @@ -255,7 +255,14 @@ |
255 | 255 | extern void kdb_print_nameval(const char *name, unsigned long val); |
256 | 256 | extern void kdb_send_sig_info(struct task_struct *p, struct siginfo *info); |
257 | 257 | extern void kdb_meminfo_proc_show(void); |
258 | +#ifdef CONFIG_KALLSYMS | |
258 | 259 | extern const char *kdb_walk_kallsyms(loff_t *pos); |
260 | +#else /* ! CONFIG_KALLSYMS */ | |
261 | +static inline const char *kdb_walk_kallsyms(loff_t *pos) | |
262 | +{ | |
263 | + return NULL; | |
264 | +} | |
265 | +#endif /* ! CONFIG_KALLSYMS */ | |
259 | 266 | extern char *kdb_getstr(char *, size_t, char *); |
260 | 267 | |
261 | 268 | /* Defines for kdb_symbol_print */ |
kernel/debug/kdb/kdb_support.c
... | ... | @@ -82,8 +82,8 @@ |
82 | 82 | int kdbnearsym(unsigned long addr, kdb_symtab_t *symtab) |
83 | 83 | { |
84 | 84 | int ret = 0; |
85 | - unsigned long symbolsize; | |
86 | - unsigned long offset; | |
85 | + unsigned long symbolsize = 0; | |
86 | + unsigned long offset = 0; | |
87 | 87 | #define knt1_size 128 /* must be >= kallsyms table size */ |
88 | 88 | char *knt1 = NULL; |
89 | 89 |