Commit 1a998be6 authored by Masahiro Yamada's avatar Masahiro Yamada

kbuild: check module name conflict for external modules as well

If there are multiple modules with the same name in the same external
module tree, there is ambiguity about which one will be loaded, and
very likely something odd is happening.
Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
parent 3ac42b21
...@@ -1459,10 +1459,6 @@ endif ...@@ -1459,10 +1459,6 @@ endif
PHONY += modules PHONY += modules
modules: $(if $(KBUILD_BUILTIN),vmlinux) modules_check modules_prepare modules: $(if $(KBUILD_BUILTIN),vmlinux) modules_check modules_prepare
PHONY += modules_check
modules_check: modules.order
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/modules-check.sh $<
cmd_modules_order = $(AWK) '!x[$$0]++' $(real-prereqs) > $@ cmd_modules_order = $(AWK) '!x[$$0]++' $(real-prereqs) > $@
modules.order: $(subdir-modorder) FORCE modules.order: $(subdir-modorder) FORCE
...@@ -1775,9 +1771,13 @@ PHONY += modules modules_install ...@@ -1775,9 +1771,13 @@ PHONY += modules modules_install
ifdef CONFIG_MODULES ifdef CONFIG_MODULES
modules: $(MODORDER) modules: modules_check
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
PHONY += modules_check
modules_check: $(MODORDER)
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/modules-check.sh $<
quiet_cmd_depmod = DEPMOD $(MODLIB) quiet_cmd_depmod = DEPMOD $(MODLIB)
cmd_depmod = $(CONFIG_SHELL) $(srctree)/scripts/depmod.sh $(DEPMOD) \ cmd_depmod = $(CONFIG_SHELL) $(srctree)/scripts/depmod.sh $(DEPMOD) \
$(KERNELRELEASE) $(KERNELRELEASE)
......
...@@ -13,10 +13,10 @@ exit_code=0 ...@@ -13,10 +13,10 @@ exit_code=0
# Check uniqueness of module names # Check uniqueness of module names
check_same_name_modules() check_same_name_modules()
{ {
for m in $(sed 's:.*/::' $1 | sort | uniq -d) for m in $(sed 's:.*/::' "$1" | sort | uniq -d)
do do
echo "error: the following would cause module name conflict:" >&2 echo "error: the following would cause module name conflict:" >&2
sed -n "/\/$m/s:^: :p" modules.order >&2 sed -n "/\/$m/s:^: :p" "$1" >&2
exit_code=1 exit_code=1
done done
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment