Linux: Detect undefined symbols in kernel modules
authorMarc Dionne <marc.c.dionne@gmail.com>
Mon, 28 Jan 2013 01:52:39 +0000 (20:52 -0500)
committerDerrick Brashear <shadow@your-file-system.com>
Thu, 7 Feb 2013 23:27:11 +0000 (15:27 -0800)
Undefined symbols in the kernel modules are not currently detected
at build time.  As a result, buildbot may indicate success while
the resulting kernel modules are unusable.

In the kernel build process, modpost warns about missing symbols
but does not return an error in the case of external modules.
Detect these warnings and cause the libafs build to fail.

Change-Id: I2c428a5ce7e3a0d10178679f789b3d787719c397
Reviewed-on: http://gerrit.openafs.org/8981
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Simon Wilkinson <simonxwilkinson@gmail.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

src/libafs/.gitignore
src/libafs/MakefileProto.LINUX.in

index d87f88a..225e979 100644 (file)
@@ -26,3 +26,4 @@
 /rpc
 /sys
 /rx
+/.makelog
index ff56e5d..7c22992 100644 (file)
@@ -19,6 +19,8 @@ INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 
+AFS_OS_CLEAN = .makelog
+
 # OS specific object files:
 AFS_OS_OBJS = \
        osi_alloc.o \
@@ -373,7 +375,13 @@ ${LIBAFS} ${LIBAFS_MP} ${LIBAFS_EP} ${LIBAFS_BM}: ${LINUX_LIBAFS_NAME}.ko
 .FORCE:
 ${LINUX_LIBAFS_NAME}.ko afspag.ko: .FORCE
        env EXTRA_CFLAGS="${EXTRA_CFLAGS}" @TOP_SRCDIR@/libafs/make_kbuild_makefile.pl ${KDIR} $@ @TOP_OBJDIR@/src/config/Makefile.config Makefile.afs Makefile.common
-       env EXTRA_CFLAGS="${EXTRA_CFLAGS}" $(MAKE) -C ${LINUX_KERNEL_BUILD} M=@TOP_OBJDIR@/src/libafs/${KDIR} modules
+       env EXTRA_CFLAGS="${EXTRA_CFLAGS}" $(MAKE) -C ${LINUX_KERNEL_BUILD} M=@TOP_OBJDIR@/src/libafs/${KDIR} modules 2>&1 | tee .makelog
+       @if [ `grep ^WARNING .makelog | wc -l` -ne 0 ]; then \
+               echo Error: Undefined symbols in modules ; \
+               rm .makelog \
+               exit 1 ; \
+       fi
+       rm .makelog
 
 <all -linux26 -linux_26 -umlinux26>
 ${LIBAFS}: $(AFSAOBJS) $(AFSNONFSOBJS)