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

From: Arnd Bergmann
Date: Sat Sep 07 2019 - 09:07:28 EST


On Sat, Sep 7, 2019 at 7:28 AM Denis Efremov <efremov@xxxxxxxxx> wrote:
> On 07.09.2019 01:39, Denis Efremov wrote:
> >> 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.
>
> 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.

> > 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.
> >
>
> 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?
> diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
> index 76c221dd9b2b..97dbcebf2338 100644
> --- a/scripts/mod/modpost.c
> +++ b/scripts/mod/modpost.c
> @@ -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)

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