summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile1
-rwxr-xr-xscripts/modules-check.sh16
2 files changed, 17 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index e5414f78e123..1232a1454d5c 100644
--- a/Makefile
+++ b/Makefile
@@ -1288,6 +1288,7 @@ modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) modules.builtin
$(Q)$(AWK) '!x[$$0]++' $(vmlinux-dirs:%=$(objtree)/%/modules.order) > $(objtree)/modules.order
@$(kecho) ' Building modules, stage 2.';
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
+ $(Q)$(CONFIG_SHELL) $(srctree)/scripts/modules-check.sh
modules.builtin: $(vmlinux-dirs:%=%/modules.builtin)
$(Q)$(AWK) '!x[$$0]++' $^ > $(objtree)/modules.builtin
diff --git a/scripts/modules-check.sh b/scripts/modules-check.sh
new file mode 100755
index 000000000000..2f659530e1ec
--- /dev/null
+++ b/scripts/modules-check.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+
+set -e
+
+# Check uniqueness of module names
+check_same_name_modules()
+{
+ for m in $(sed 's:.*/::' modules.order modules.builtin | 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
+ done
+}
+
+check_same_name_modules