module: fix build error when CONFIG_SYSFS is disabled
PATCH v2 1/1 module: fix build error when CONFIG_SYSFS is disabled
Fix build error when disable CONFIG_SYSFS:kernel/module.c:2805:8: error: implicit declaration of function ‘sect_empty’; did you mean ‘desc_empty’? [-Werror=implicit-function-declaration]
2805 | if (!sect_empty(sechdr) && sechdr->sh_type == SHT_NOTE &&
---
Changes from v2:
Put the sect_empty() definition outside of #ifdef CONFIG_SYSFS.
kernel/module.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
kernel/module.c +7 -5
@@ -1462,6 +1462,13 @@ resolve_symbol_wait(struct module *mod,return ksym; } +#ifdef CONFIG_KALLSYMS +static inline bool sect_empty (const Elf_Shdr *sect) +{ +return !(sect->sh_flags &SHF_ALLOC ) || sect->sh_size ==0 ; +} +#endif +/* * /sys/module/foo/sections stuff * J. Corbet <[email protected]>
@@ -1469,11 +1476,6 @@ resolve_symbol_wait(struct module *mod, #ifdef CONFIG_SYSFS #ifdef CONFIG_KALLSYMS -static inline bool sect_empty(const Elf_Shdr *sect) -{ - return !(sect->sh_flags & SHF_ALLOC) || sect->sh_size == 0; -} - struct module_sect_attr { struct bin_attribute battr; unsigned long address;
Signature · 1 line
2.17.1
Quoting Bixuan Cui (2021-05-25 03:50:49)
Quoted 8 lines
Fix build error when disable
CONFIG_SYSFS:kernel/module.c:2805:8: error: implicit declaration of function ���sect_empty���; did you mean ���desc_empty���? [-Werror=implicit-function-declaration]
2805 | if (!sect_empty(sechdr) &&sechdr->sh_type==SHT_NOTE&&Fixes 9ee6682aa528 ("module: add printk formats to add module build ID to stacktraces")Reported-by Hulk Robot <[email protected]>Signed-off-by Bixuan Cui <[email protected]>Signed-off-by Stephen Boyd <[email protected]>
Ok. The SoB chain is wrong but you may have my SoB.
Quoted 40 lines
---
Changes from v2:
Put thesect_empty()definition outside of #ifdefCONFIG_SYSFS.kernel/module.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)kernel/module.c +7
-6@@ -1462,6 +1462,13 @@ resolve_symbol_wait(struct module *mod,return ksym; } +#ifdef CONFIG_KALLSYMS +static inline bool sect_empty (const Elf_Shdr *sect) +{ +return !(sect->sh_flags &SHF_ALLOC ) || sect->sh_size ==0 ; +} +#endif +/* * /sys/module/foo/sections stuff * J. Corbet <[email protected]> @@ -1469,11 +1476,6 @@ resolve_symbol_wait(struct module *mod, #ifdef CONFIG_SYSFS #ifdef CONFIG_KALLSYMS -static inline bool sect_empty (const Elf_Shdr *sect) -{ -return !(sect->sh_flags &SHF_ALLOC ) || sect->sh_size ==0 ; -} - struct module_sect_attr { struct bin_attribute battr; unsigned long address; --2.17.1
+++ Bixuan Cui [25/05/21 18:50 +0800]:
Quoted 5 lines
Fix build error when disable
CONFIG_SYSFS:kernel/module.c:2805:8: error: implicit declaration of function ‘sect_empty’; did you mean ‘desc_empty’? [-Werror=implicit-function-declaration]
2805 | if (!sect_empty(sechdr) &&sechdr->sh_type==SHT_NOTE&&Fixes 9ee6682aa528 ("module: add printk formats to add module build ID to stacktraces")
Hm, can't find this commit in the next-20210526 tree. Commit 7685f91fed25 ("module: add printk formats to add module build ID to stacktraces") seems to be the correct one.
Quoted 3 lines
Reported-by Hulk Robot <[email protected]>Signed-off-by Bixuan Cui <[email protected]>Signed-off-by Stephen Boyd <[email protected]>
Quoted 9 lines · Jessica Yu
Quoted 5 lines
Fix build error when disable
CONFIG_SYSFS:kernel/module.c:2805:8: error: implicit declaration of function ‘sect_empty’; did you mean ‘desc_empty’? [-Werror=implicit-function-declaration] 2805 | if (!sect_empty(sechdr) &&sechdr->sh_type==SHT_NOTE&&Fixes 9ee6682aa528 ("module: add printk formats to add module build ID to stacktraces")Hm, can't find this commit in the next-20210526 tree. Commit
7685f91fed25("module: add printk formats to add module build ID to stacktraces") seems to be the correct one.
It was my linux-next repository that was abnormal. :-( I re-downloaded it and commit id is 7685f91fed25.
Thanks,
Bixuan Cui