module: Fix up CONFIG_KALLSYMS=n build.
PATCH 1/1 module: Fix up CONFIG_KALLSYMS=n build.
Starting from commit 4a4962263f07d14660849ec134ee42b63e95ea9a "reduce symbol table for loaded modules (v2)", the kernel/module.c build is broken with CONFIG_KALLSYMS disabled.
CC kernel/module.okernel/module.c:1995: warning: type defaults to 'int' in declaration of 'Elf_Hdr' kernel/module.c:1995: error: expected ';', ',' or ')' before '*' token kernel/module.c: In function 'load_module':kernel/module.c:2203: error: 'strmap' undeclared (first use in this function) kernel/module.c:2203: error: (Each undeclared identifier is reported only once kernel/module.c:2203: error: for each function it appears in.) kernel/module.c:2239: error: 'symoffs' undeclared (first use in this function) kernel/module.c:2239: error: implicit declaration of function 'layout_symtab' kernel/module.c:2240: error: 'stroffs' undeclared (first use in this function) make[1]: *** [kernel/module.o] Error 1
make: *** [kernel/module.o] Error 2
There are three different issues:
- layout_symtab() takes a const Elf_Ehdr
- layout_symtab() needs to return a value
- symoffs/stroffs/strmap are referenced by the load_module() code despite being ifdefed out, which seems unnecessary given the noop behaviour of layout_symtab()/add_kallsyms() in the case of CONFIG_KALLSYMS=n.
---
kernel/module.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
kernel/module.c +4 -3
@@ -1992,12 +1992,14 @@ static inline unsigned long layout_symtab(struct module *mod,Elf_Shdr *sechdrs, unsigned int symindex, unsigned int strindex, - const Elf_Hdr *hdr, + const Elf_Ehdr *hdr, const char *secstrings, unsigned long *pstroffs, unsigned long *strmap) { + return 0; } + static inline void add_kallsyms(struct module *mod, Elf_Shdr *sechdrs, unsigned int shnum,
@@ -2081,9 +2083,8 @@ static noinline struct module *load_module(void __user *umod,struct module *mod;long err =0 ;void *percpu =NULL , *ptr =NULL ;/* Stops spurious gcc warning */ -#ifdef CONFIG_KALLSYMS unsigned long symoffs, stroffs, *strmap; -#endif +mm_segment_t old_fs; DEBUGP("load_module: umod=%p, len=%lu, uargs=%p\n",
Quoted 5 lines
Quoted 1 line
Quoted 1 line
Paul Mundt <[email protected]> 25.09.09 05:45 >>>
There are three different issues:
-
layout_symtab()takes a constElf_Ehdr
Quoted 8 lines
-
layout_symtab()needs to return a value- symoffs/stroffs/strmap are referenced by the
load_module()code despite being ifdefed out, which seems unnecessary given the noop behaviour of layout_symtab()/add_kallsyms() in the case ofCONFIG_KALLSYMS=n.Signed-off-by Paul Mundt <[email protected]>
Oh, sorry for not having checked that. Thanks, and
Quoted 23 lines · Paul Mundt
Starting from commit
4a4962263f07d14660849ec134ee42b63e95ea9a"reduce symbol table for loaded modules (v2)", thekernel/module.cbuild is broken withCONFIG_KALLSYMSdisabled.CC kernel/module.o
kernel/module.c:1995: warning: type defaults to 'int' in declaration of 'Elf_Hdr'kernel/module.c:1995: error: expected ';', ',' or ')' before '*' tokenkernel/module.c: In function 'load_module':kernel/module.c:2203: error: 'strmap' undeclared (first use in this function)kernel/module.c:2203: error: (Each undeclared identifier is reported only oncekernel/module.c:2203: error: for each function it appears in.)kernel/module.c:2239: error: 'symoffs' undeclared (first use in this function)kernel/module.c:2239: error: implicit declaration of function 'layout_symtab'kernel/module.c:2240: error: 'stroffs' undeclared (first use in this function) make[1]: *** [kernel/module.o] Error 1
make: *** [kernel/module.o] Error 2There are three different issues:
-
layout_symtab()takes a constElf_Ehdr-
layout_symtab()needs to return a value
Quoted 8 lines
- symoffs/stroffs/strmap are referenced by the
load_module()code despite being ifdefed out, which seems unnecessary given the noop behaviour of layout_symtab()/add_kallsyms() in the case ofCONFIG_KALLSYMS=n.Signed-off-by Paul Mundt <[email protected]>Cc Jan Beulich <[email protected]>Cc Rusty Russell <[email protected]>
Indeed.
Rusty Russell
Acked-byQuoted 29 lines · Américo Wang
Quoted 28 lines · Paul Mundt
Starting from commit
4a4962263f07d14660849ec134ee42b63e95ea9a"reduce symbol table for loaded modules (v2)", thekernel/module.cbuild is broken withCONFIG_KALLSYMSdisabled.CC
kernel/module.okernel/module.c:1995: warning: type defaults to 'int' in declaration of 'Elf_Hdr'kernel/module.c:1995: error: expected ';', ',' or ')' before '*' tokenkernel/module.c: In function 'load_module':kernel/module.c:2203: error: 'strmap' undeclared (first use in this function)kernel/module.c:2203: error: (Each undeclared identifier is reported only oncekernel/module.c:2203: error: for each function it appears in.)kernel/module.c:2239: error: 'symoffs' undeclared (first use in this function)kernel/module.c:2239: error: implicit declaration of function 'layout_symtab'kernel/module.c:2240: error: 'stroffs' undeclared (first use in this function) make[1]: *** [kernel/module.o] Error 1
make: *** [kernel/module.o] Error 2There are three different issues:
-
layout_symtab()takes a constElf_Ehdr-
layout_symtab()needs to return a value- symoffs/stroffs/strmap are referenced by the
load_module()code despite being ifdefed out, which seems unnecessary given the noop behaviour of layout_symtab()/add_kallsyms() in the case ofCONFIG_KALLSYMS=n.
Quoted 7 lines
Quoted 3 lines
Signed-off-by Paul Mundt <[email protected]>Cc Jan Beulich <[email protected]>Cc Rusty Russell <[email protected]>Indeed.
Acked-by WANG Cong <[email protected]>
And this completes the set:
Thanks Paul!
Cheers,
Rusty.
Quoted 34 lines · Rusty Russell
Quoted 33 lines · Américo Wang
Quoted 31 lines · Paul Mundt
Starting from commit
4a4962263f07d14660849ec134ee42b63e95ea9a"reduce symbol table for loaded modules (v2)", thekernel/module.cbuild is broken withCONFIG_KALLSYMSdisabled.CC
kernel/module.okernel/module.c:1995: warning: type defaults to 'int' in declaration of 'Elf_Hdr'kernel/module.c:1995: error: expected ';', ',' or ')' before '*' tokenkernel/module.c: In function 'load_module':kernel/module.c:2203: error: 'strmap' undeclared (first use in this function)kernel/module.c:2203: error: (Each undeclared identifier is reported only oncekernel/module.c:2203: error: for each function it appears in.)kernel/module.c:2239: error: 'symoffs' undeclared (first use in this function)kernel/module.c:2239: error: implicit declaration of function 'layout_symtab'kernel/module.c:2240: error: 'stroffs' undeclared (first use in this function) make[1]: *** [kernel/module.o] Error 1
make: *** [kernel/module.o] Error 2There are three different issues:
-
layout_symtab()takes a constElf_Ehdr-
layout_symtab()needs to return a value- symoffs/stroffs/strmap are referenced by the
load_module()code despite being ifdefed out, which seems unnecessary given the noop behaviour of layout_symtab()/add_kallsyms() in the case ofCONFIG_KALLSYMS=n.Signed-off-by Paul Mundt <[email protected]>Cc Jan Beulich <[email protected]>Cc Rusty Russell <[email protected]>
Quoted 7 lines
Quoted 3 lines
Indeed.
Acked-by WANG Cong <[email protected]>And this completes the set:
Acked-by Rusty Russell <[email protected]>
Hmm, I expected you to take this patch and forward to Linus? In which case I had expected to see a "S-o-b".
Sam
Quoted 5 lines · Sam Ravnborg
Quoted 1 line · Rusty Russell
Acked-by Rusty Russell <[email protected]>Hmm, I expected you to take this patch and forward to Linus? In which case I had expected to see a "S-o-b".
Andrew already took it, and I'd already pushed my modules patches. Seemed like the fastest way to get this in?
Cheers,
Rusty.