Re: [PATCH] mostpost: don't warn about symbols from another file

From: Denis Efremov
Date: Sat Sep 07 2019 - 17:08:40 EST




On 06.09.2019 18:10, Arnd Bergmann wrote:
> 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.
>
> Fixes: 15bfc2348d54 ("modpost: check for static EXPORT_SYMBOL*
> functions") Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>

Tested-by: Denis Efremov <efremov@xxxxxxxxx>

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 from
handle_modversions() -> sym_update_crc().

Since there is no the exact symbols, e.g. like
nm vmlinux | grep __kmalloc
2d6fcc06 A __crc___kmalloc
c01c922d T __kmalloc <---
c0749192 r __kstrtab___kmalloc
c073c7c4 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

> --- scripts/mod/modpost.c | 2 +- 1 file changed, 1 insertion(+), 1
> deletion(-)
>
> diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index
> 76c221dd9b2b..4265dd924933 100644 --- a/scripts/mod/modpost.c +++
> b/scripts/mod/modpost.c @@ -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));
>