2005-01-18 19:35:57

by Andreas Gruenbacher

[permalink] [raw]
Subject: [kbuild 1/5] Warn when building external modules without modversions

This adds a warning when building external modules (M= or SUBDIRS=
syntax) and there is no Module.symvers in the object tree. A missing
Module.symvers is a clear sign that the kernel tree itself was never
compiled. The resulting modules will work, but no symbol version
information will be attached to kernel symbols the module uses (because
that information comes from Module.symvers), and so the module will be
more unsafe.

The test works with CONFIG_MODVERSIONS enabled or disabled.

Signed-off-by: Andreas Gruenbacher <[email protected]>

Index: linux-2.6.11-rc1-bk6/Makefile
===================================================================
--- linux-2.6.11-rc1-bk6.orig/Makefile
+++ linux-2.6.11-rc1-bk6/Makefile
@@ -1093,9 +1093,17 @@ KBUILD_MODULES := 1
crmodverdir:
$(Q)mkdir -p $(MODVERDIR)

+.PHONY: $(objtree)/Module.symvers
+$(objtree)/Module.symvers:
+ @test -e $(objtree)/Module.symvers || ( \
+ echo; \
+ echo "WARNING: Symbol version dump $(objtree)/Module.symvers is " \
+ "missing; modules will have no modversions."; \
+ echo )
+
module-dirs := $(addprefix _module_,$(KBUILD_EXTMOD))
.PHONY: $(module-dirs) modules
-$(module-dirs): crmodverdir
+$(module-dirs): crmodverdir $(objtree)/Module.symvers
$(Q)$(MAKE) $(build)=$(patsubst _module_%,%,$@)

modules: $(module-dirs)

--
Andreas Gruenbacher <[email protected]>
SUSE Labs, SUSE LINUX PRODUCTS GMBH