Skip to content

Commit

Permalink
kbuild: do not check name uniqueness of builtin modules
Browse files Browse the repository at this point in the history
I just thought it was a good idea to scan builtin.modules in the name
uniqueness checking, but a couple of false positives were found.

Stephen reported a false positive for ppc64_defconfig:

  warning: same basename if the following are built as modules:
    arch/powerpc/platforms/powermac/nvram.ko
    drivers/char/nvram.ko

The former is never built as a module as you see in
arch/powerpc/platforms/powermac/Makefile:

  # CONFIG_NVRAM is an arch. independent tristate symbol, for pmac32 we really
  # need this to be a bool.  Cheat here and pretend CONFIG_NVRAM=m is really
  # CONFIG_NVRAM=y
  obj-$(CONFIG_NVRAM:m=y)         += nvram.o

Another example of false positive is arm64 defconfig:

  warning: same basename if the following are built as modules:
    arch/arm64/lib/crc32.ko
    lib/crc32.ko

It is true CONFIG_CRC32 is a tristate option but it is always 'y' since
it is select'ed by ARM64. Hence, neither of them is built as a module
for the arm64 build.

From the above, modules.builtin essentially contains false positives.
I do not think it is a big deal as far as kmod is concerned, but false
positive warnings in the kernel build make people upset. It is better
to not check it.

Even without builtin.modules checked, we have enough (and more solid)
test coverage with allmodconfig.

While I touched this part, I replaced the sed code with neater one
provided by Stephen.

Link: https://lkml.org/lkml/2019/5/19/120
Link: https://lkml.org/lkml/2019/5/19/123
Fixes: 3a48a91 ("kbuild: check uniqueness of module names")
Reported-by: Stephen Rothwell <[email protected]>
Signed-off-by: Masahiro Yamada <[email protected]>
Acked-by: Arnd Bergmann <[email protected]>
Reviewed-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
masahir0y committed May 20, 2019
1 parent 055efab commit 4a33d4f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions scripts/modules-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ set -e
# Check uniqueness of module names
check_same_name_modules()
{
for m in $(sed 's:.*/::' modules.order modules.builtin | sort | uniq -d)
for m in $(sed 's:.*/::' modules.order | sort | uniq -d)
do
echo "warning: same basename if the following are built as modules:" >&2
sed "/\/$m/!d;s:^kernel/: :" modules.order modules.builtin >&2
echo "warning: same module names found:" >&2
sed -n "/\/$m/s:^kernel/: :p" modules.order >&2
done
}

Expand Down

0 comments on commit 4a33d4f

Please sign in to comment.