mostpost: don't warn about symbols from another file
PATCH 1/1 mostpost: don't warn about symbols from another file
On architectures such as ARM that have a list of symbols exported from assembler in a separate C file, we get a lot of new warnings:
WARNING: "__ashrdi3" [vmlinux] is a static (unknown)
WARNING: "__lshrdi3" [vmlinux] is a static (unknown)
WARNING: "__aeabi_llsr" [vmlinux] is a static (unknown)
WARNING: "__aeabi_lasr" [vmlinux] is a static (unknown)
WARNING: "__aeabi_uidivmod" [vmlinux] is a static (unknown)
WARNING: "__udivsi3" [vmlinux] is a static (unknown)
WARNING: "_change_bit" [vmlinux] is a static (unknown)
WARNING: "__aeabi_idiv" [vmlinux] is a static (unknown)
WARNING: "__umodsi3" [vmlinux] is a static (unknown)
WARNING: "__aeabi_uidiv" [vmlinux] is a static (unknown)
WARNING: "__aeabi_idivmod" [vmlinux] is a static (unknown)
WARNING: "__muldi3" [vmlinux] is a static (unknown)
WARNING: "__aeabi_ulcmp" [vmlinux] is a static (unknown)
WARNING: "__raw_writesb" [vmlinux] is a static (unknown)
WARNING: "__raw_readsb" [vmlinux] is a static (unknown)
...
This is not helpful, as these are clearly not static symbols at all. Suppress the warning in a case like this.
--- scripts/mod/modpost.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/mod/modpost.c +1 -1
@@ -2543,7 +2543,7 @@ int main(int argc, char **argv)struct symbol *s = symbolhash[n];while (s) { -if (s->is_static) +if (s->is_static && s->export != export_unknown)warn ("\"%s\" [%s] is a static %s\n" , s->name, s->module->name,export_str (s->export));
Signature · 1 line
2.20.0
Hi,
Quoted 20 lines · Arnd Bergmann
On architectures such as ARM that have a list of symbols exported from assembler in a separate C file, we get a lot of new warnings:
WARNING: "
__ashrdi3" [vmlinux] is a static (unknown)
WARNING: "__lshrdi3" [vmlinux] is a static (unknown)
WARNING: "__aeabi_llsr" [vmlinux] is a static (unknown)
WARNING: "__aeabi_lasr" [vmlinux] is a static (unknown)
WARNING: "__aeabi_uidivmod" [vmlinux] is a static (unknown)
WARNING: "__udivsi3" [vmlinux] is a static (unknown)
WARNING: "_change_bit" [vmlinux] is a static (unknown)
WARNING: "__aeabi_idiv" [vmlinux] is a static (unknown)
WARNING: "__umodsi3" [vmlinux] is a static (unknown)
WARNING: "__aeabi_uidiv" [vmlinux] is a static (unknown)
WARNING: "__aeabi_idivmod" [vmlinux] is a static (unknown)
WARNING: "__muldi3" [vmlinux] is a static (unknown)
WARNING: "__aeabi_ulcmp" [vmlinux] is a static (unknown)
WARNING: "__raw_writesb" [vmlinux] is a static (unknown)
WARNING: "__raw_readsb" [vmlinux] is a static (unknown)
...
Quoted 3 lines
This is not helpful, as these are clearly not static symbols at all. Suppress the warning in a case like this.
It looks very similar to this discussion https://lkml.org/lkml/2019/7/30/112
Could you please write the steps to reproduce the warnings? Now, I'm trying to build linux-next (host Ubuntu 19.04 x86_64) with:
$ make ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- But I can't get these warnings.
I would like to check the type of this asm symbols. It seems like they are STT_NOTYPE. In this case the fix could also involve ELF_ST_TYPE check.
Thanks,
Denis
Quoted 20 lines
Fixes 15bfc2348d54 ("modpost: check for static EXPORT_SYMBOL* functions")Signed-off-by Arnd Bergmann <[email protected]>--- scripts/mod/modpost.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)scripts/mod/modpost.c +1
-1@@ -2543,7 +2543,7 @@ int main(int argc, char **argv)struct symbol *s = symbolhash[n];while (s) { -if (s->is_static) +if (s->is_static && s->export != export_unknown)warn ("\"%s\" [%s] is a static %s\n" , s->name, s->module->name,export_str (s->export));
Quoted 27 lines · Denis Efremov
Hi,
Quoted 20 lines · Arnd Bergmann
On architectures such as ARM that have a list of symbols exported from assembler in a separate C file, we get a lot of new warnings:
WARNING: "
__ashrdi3" [vmlinux] is a static (unknown)
WARNING: "__lshrdi3" [vmlinux] is a static (unknown)
WARNING: "__aeabi_llsr" [vmlinux] is a static (unknown)
WARNING: "__aeabi_lasr" [vmlinux] is a static (unknown)
WARNING: "__aeabi_uidivmod" [vmlinux] is a static (unknown)
WARNING: "__udivsi3" [vmlinux] is a static (unknown)
WARNING: "_change_bit" [vmlinux] is a static (unknown)
WARNING: "__aeabi_idiv" [vmlinux] is a static (unknown)
WARNING: "__umodsi3" [vmlinux] is a static (unknown)
WARNING: "__aeabi_uidiv" [vmlinux] is a static (unknown)
WARNING: "__aeabi_idivmod" [vmlinux] is a static (unknown)
WARNING: "__muldi3" [vmlinux] is a static (unknown)
WARNING: "__aeabi_ulcmp" [vmlinux] is a static (unknown)
WARNING: "__raw_writesb" [vmlinux] is a static (unknown)
WARNING: "__raw_readsb" [vmlinux] is a static (unknown)
...Quoted 3 lines
This is not helpful, as these are clearly not static symbols at all. Suppress the warning in a case like this.
Quoted 6 lines
It looks very similar to this discussion https://lkml.org/lkml/2019/7/30/112
Could you please write the steps to reproduce the warnings? Now, I'm trying to build linux-next (host Ubuntu 19.04
x86_64) with:$ make ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- But I can't get these warnings.
Tried defconfig, allyesconfig.
Quoted 4 lines
I would like to check the type of this asm symbols. It seems like they are
STT_NOTYPE. In this case the fix could also involveELF_ST_TYPEcheck.
Ah, I forgot that we don't check the type at all, so this is not the case. But still, I would like to test what if the remove binding check at all?
scripts/mod/modpost.c +0 -2
@@ -1987,14 +1987,12 @@ static void read_symbols(const char *modname)for (sym = info.symtab_start; sym < info.symtab_stop; sym++) {unsigned char bind =ELF_ST_BIND (sym->st_info); -if (bind ==STB_GLOBAL || bind ==STB_WEAK ) {struct symbol *s =find_symbol (remove_dot (info.strtab + sym->st_name));if (s) s->is_static =0 ; - } }if (!is_vmlinux (modname) || vmlinux_section_warnings)
Thanks,
Denis
Quoted 21 lines
Quoted 21 lines
Fixes 15bfc2348d54 ("modpost: check for static EXPORT_SYMBOL* functions")Signed-off-by Arnd Bergmann <[email protected]>--- scripts/mod/modpost.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)scripts/mod/modpost.c +1
-1@@ -2543,7 +2543,7 @@ int main(int argc, char **argv)struct symbol *s = symbolhash[n];while (s) { -if (s->is_static) +if (s->is_static && s->export != export_unknown)warn ("\"%s\" [%s] is a static %s\n" , s->name, s->module->name,export_str (s->export));
Quoted 7 lines · Denis Efremov
Quoted 6 lines · Denis Efremov
Quoted 3 lines
This is not helpful, as these are clearly not static symbols at all. Suppress the warning in a case like this.
It looks very similar to this discussion https://lkml.org/lkml/2019/7/30/112
Quoted 7 lines
Quoted 5 lines
Could you please write the steps to reproduce the warnings?
Now, I'm trying to build linux-next (host Ubuntu 19.04
x86_64) with:$ make ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- But I can't get these warnings.Tried defconfig, allyesconfig.
I only have one randconfig build that caused these, see
http://paste.ubuntu.com/p/D6w8RNS7MG/ for the .config
I was building linux-next with the clang-9 toolchain from http://apt.llvm.org,
but that should not matter here.
Quoted 15 lines
Quoted 3 lines
I would like to check the type of this asm symbols. It seems like they are
STT_NOTYPE. In this case the fix could also involveELF_ST_TYPEcheck.Ah, I forgot that we don't check the type at all, so this is not the case. But still, I would like to test what if the remove binding check at all?
scripts/mod/modpost.c +0
-1@@ -1987,14 +1987,12 @@ static void read_symbols(const char *modname)for (sym = info.symtab_start; sym < info.symtab_stop; sym++) {unsigned char bind =ELF_ST_BIND (sym->st_info); -if (bind ==STB_GLOBAL || bind ==STB_WEAK ) {
scripts/mod/modpost.c static void read_symbols(const char *modname) · line 1998
Quoted 10 lines
scripts/mod/modpost.c +0
-1struct symbol *s =find_symbol (remove_dot (info.strtab + sym->st_name));if (s) s->is_static =0 ; - } }if (!is_vmlinux (modname) || vmlinux_section_warnings)
Unfortunately, I still get the same warnings, plus one about modpost.c:
scripts/mod/modpost.c:1988:17: warning: unused variable ‘bind’ [-Wunused-variable]
WARNING: "__ashrdi3" [vmlinux] is a static (unknown)
WARNING: "__lshrdi3" [vmlinux] is a static (unknown)
WARNING: "__aeabi_llsr" [vmlinux] is a static (unknown)
WARNING: "__aeabi_lasr" [vmlinux] is a static (unknown)
WARNING: "__aeabi_uidivmod" [vmlinux] is a static (unknown)
WARNING: "__udivsi3" [vmlinux] is a static (unknown)
WARNING: "_change_bit" [vmlinux] is a static (unknown)
WARNING: "__aeabi_idiv" [vmlinux] is a static (unknown)
WARNING: "__umodsi3" [vmlinux] is a static (unknown)
WARNING: "__aeabi_uidiv" [vmlinux] is a static (unknown)
WARNING: "__aeabi_idivmod" [vmlinux] is a static (unknown)
WARNING: "__muldi3" [vmlinux] is a static (unknown)
WARNING: "__aeabi_ulcmp" [vmlinux] is a static (unknown)
WARNING: "__raw_writesb" [vmlinux] is a static (unknown)
WARNING: "__raw_readsb" [vmlinux] is a static (unknown)
WARNING: "__ucmpdi2" [vmlinux] is a static (unknown)
WARNING: "__aeabi_lmul" [vmlinux] is a static (unknown)
WARNING: "__divsi3" [vmlinux] is a static (unknown)
WARNING: "__modsi3" [vmlinux] is a static (unknown)
WARNING: "_test_and_change_bit" [vmlinux] is a static (unknown)
WARNING: "__bswapdi2" [vmlinux] is a static (unknown)
WARNING: "__bswapsi2" [vmlinux] is a static (unknown)
WARNING: "__ashldi3" [vmlinux] is a static (unknown)
WARNING: "__aeabi_llsl" [vmlinux] is a static (unknown)
WARNING: "__ashrdi3" [vmlinux] is a static (unknown)
WARNING: "__lshrdi3" [vmlinux] is a static (unknown)
WARNING: "__aeabi_llsr" [vmlinux] is a static (unknown)
WARNING: "__aeabi_lasr" [vmlinux] is a static (unknown)
WARNING: "__aeabi_uidivmod" [vmlinux] is a static (unknown)
WARNING: "__udivsi3" [vmlinux] is a static (unknown)
WARNING: "_change_bit" [vmlinux] is a static (unknown)
WARNING: "__aeabi_idiv" [vmlinux] is a static (unknown)
WARNING: "__umodsi3" [vmlinux] is a static (unknown)
WARNING: "__aeabi_uidiv" [vmlinux] is a static (unknown)
WARNING: "__aeabi_idivmod" [vmlinux] is a static (unknown)
WARNING: "__muldi3" [vmlinux] is a static (unknown)
WARNING: "__aeabi_ulcmp" [vmlinux] is a static (unknown)
WARNING: "__raw_writesb" [vmlinux] is a static (unknown)
WARNING: "__raw_readsb" [vmlinux] is a static (unknown)
WARNING: "__ucmpdi2" [vmlinux] is a static (unknown)
WARNING: "__aeabi_lmul" [vmlinux] is a static (unknown)
WARNING: "__divsi3" [vmlinux] is a static (unknown)
WARNING: "__modsi3" [vmlinux] is a static (unknown)
WARNING: "_test_and_change_bit" [vmlinux] is a static (unknown)
WARNING: "__bswapdi2" [vmlinux] is a static (unknown)
WARNING: "__bswapsi2" [vmlinux] is a static (unknown)
WARNING: "__ashldi3" [vmlinux] is a static (unknown)
WARNING: "__aeabi_llsl" [vmlinux] is a static (unknown)
Arnd
Quoted 17 lines · Arnd Bergmann
On architectures such as ARM that have a list of symbols exported from assembler in a separate C file, we get a lot of new warnings:
WARNING: "
__ashrdi3" [vmlinux] is a static (unknown) WARNING:
"__lshrdi3" [vmlinux] is a static (unknown) WARNING: "__aeabi_llsr" [vmlinux] is a static (unknown) WARNING: "__aeabi_lasr" [vmlinux] is a static (unknown) WARNING: "__aeabi_uidivmod" [vmlinux] is a static (unknown) WARNING: "__udivsi3" [vmlinux] is a static (unknown)
WARNING: "_change_bit" [vmlinux] is a static (unknown) WARNING:
"__aeabi_idiv" [vmlinux] is a static (unknown) WARNING: "__umodsi3" [vmlinux] is a static (unknown) WARNING: "__aeabi_uidiv" [vmlinux] is a static (unknown) WARNING: "__aeabi_idivmod" [vmlinux] is a static (unknown) WARNING: "__muldi3" [vmlinux] is a static (unknown)
WARNING: "__aeabi_ulcmp" [vmlinux] is a static (unknown) WARNING:
"__raw_writesb" [vmlinux] is a static (unknown) WARNING:
"__raw_readsb" [vmlinux] is a static (unknown) ...
Quoted 5 lines
This is not helpful, as these are clearly not static symbols at all. Suppress the warning in a case like this.
Fixes 15bfc2348d54 ("modpost: check for static EXPORT_SYMBOL*functions") Signed-off-by: Arnd Bergmann <[email protected]>
What I could add here is that all these symbols are:
$ nm vmlinux | grep '__ashrdi3\|__lshrdi3\|__aeabi_llsr\|...' cd63c845 A __crc___aeabi_lasr 76cf47f6 A __crc___aeabi_llsl 8a4fa83b A __crc___aeabi_llsr 44643b93 A __crc___aeabi_lmul f564412a A __crc___aeabi_ulcmp 40f07981 A __crc___ashldi3 edd9106d A __crc___ashrdi3 389ecf9e A __crc___bswapdi2 f1ea6f1c A __crc___bswapsi2 14d4a9c5 A __crc__change_bit ff67b37f A __crc___lshrdi3 800e4ffa A __crc___muldi3 f7163ec9 A __crc___raw_readsb f0ed2ef4 A __crc___raw_writesb ffb94ef0 A __crc__test_and_change_bit 7cc035a7 A __crc___ucmpdi2
There is no ksymtab, kstrtab for them and there is no the exact symbols, only crc.
Thus they get to the symbolhash table fromhandle_modversions() -> sym_update_crc().
Since there is no the exact symbols, e.g. like
nm vmlinux | grep __kmalloc2d6fcc06 A __crc___kmallocc01c922d T __kmalloc <---c0749192 r __kstrtab___kmallocc073c7c4 r __ksymtab___kmalloc
we can't check them in this cycle:
// check for static EXPORT_SYMBOL_* functions && global vars for (sym = info.symtab_start; sym < info.symtab_stop; sym++) {
and they are automatically marked as static.
That's all so far, I don't know is it correct to have only __crc* or not for a symbol.
Just a sidenote:arch/arm/kernel/armksyms.c states that these are
/*
* libgcc functions - functions that are used internally by the
* compiler...
Thanks,
Denis
Quoted 12 lines
---
scripts/mod/modpost.c| 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)scripts/mod/modpost.c index renamed from scripts/mod/modpost.c +0
-0
76c221dd9b2b..4265dd924933100644 ---a/scripts/mod/modpost.c+++b/scripts/mod/modpost.c@@ -2543,7 +2543,7 @@ intmain(int argc, char **argv)struct symbol *s = symbolhash[n];while (s) { - if (
s->is_static) + if (s->is_static&&s->export
!=export_unknown)warn("\"%s\" [%s] is a static %s\n", s->name, s->module->name, export_str(s->export));
Quoted 21 lines · Arnd Bergmann
On architectures such as ARM that have a list of symbols exported from assembler in a separate C file, we get a lot of new warnings:
WARNING: "
__ashrdi3" [vmlinux] is a static (unknown)
WARNING: "__lshrdi3" [vmlinux] is a static (unknown)
WARNING: "__aeabi_llsr" [vmlinux] is a static (unknown)
WARNING: "__aeabi_lasr" [vmlinux] is a static (unknown)
WARNING: "__aeabi_uidivmod" [vmlinux] is a static (unknown)
WARNING: "__udivsi3" [vmlinux] is a static (unknown)
WARNING: "_change_bit" [vmlinux] is a static (unknown)
WARNING: "__aeabi_idiv" [vmlinux] is a static (unknown)
WARNING: "__umodsi3" [vmlinux] is a static (unknown)
WARNING: "__aeabi_uidiv" [vmlinux] is a static (unknown)
WARNING: "__aeabi_idivmod" [vmlinux] is a static (unknown)
WARNING: "__muldi3" [vmlinux] is a static (unknown)
WARNING: "__aeabi_ulcmp" [vmlinux] is a static (unknown)
WARNING: "__raw_writesb" [vmlinux] is a static (unknown)
WARNING: "__raw_readsb" [vmlinux] is a static (unknown)
...
Quoted 5 lines
This is not helpful, as these are clearly not static symbols at all. Suppress the warning in a case like this.
Fixes 15bfc2348d54 ("modpost: check for static EXPORT_SYMBOL* functions")Signed-off-by Arnd Bergmann <[email protected]>
This patch is not root-causing the problem,
rather it is hiding it.
I posted a real fix:
https://patchwork.kernel.org/patch/11137689/
Quoted 20 lines
--- scripts/mod/modpost.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)scripts/mod/modpost.c +1
-2@@ -2543,7 +2543,7 @@ int main(int argc, char **argv)struct symbol *s = symbolhash[n];while (s) { -if (s->is_static) +if (s->is_static && s->export != export_unknown)warn ("\"%s\" [%s] is a static %s\n" , s->name, s->module->name,export_str (s->export)); --2.20.0
Signature · 2 lines
Best Regards Masahiro Yamada