Re: [PATCH] modpost: fix static EXPORT_SYMBOL warnings for UML build

From: Johannes Berg
Date: Tue Sep 24 2019 - 08:15:22 EST


On Tue, 2019-09-24 at 21:07 +0900, Masahiro Yamada wrote:
> Johannes Berg reports lots of modpost warnings on ARCH=um builds:
>
> WARNING: "rename" [vmlinux] is a static EXPORT_SYMBOL
> [snip]
> WARNING: "__stack_smash_handler" [vmlinux] is a static EXPORT_SYMBOL
>
> When you run "make", the modpost is run twice; before linking vmlinux,
> and before building modules. All the warnings above are from the second
> modpost.
>
> The offending symbols are defined not in vmlinux, but in the C library.
> The first modpost is run against the relocatable vmlinux.o, and those
> warnings are nicely suppressed because the SH_UNDEF entries from the
> symbol table clear the ->is_static flag.
>
> The second modpost is run against the executable vmlinux (+ modules),
> where those symbols have been resolved, but the definitions do not
> exist.
>
> This commit fixes it in a straight forward way. Suppress the static
> EXPORT_SYMBOL warnings from "vmlinux".

Yep, that fixes it.

Tested-by: Johannes Berg <johannes@xxxxxxxxxxxxxxxx>

Thanks!

johannes