2.3.27 duplicate symbols in nfsd as module

Keith Owens (kaos@ocs.com.au)
Fri, 12 Nov 1999 21:00:15 +1100


When nfs is compiled as a module, nfsd and sunrpc are built from
several objects, by

ld -m elf_i386 -r -o nfsd.o nfssvc.o nfsctl.o nfsproc.o nfsfh.o \
vfs.o export.o auth.o lockd.o nfscache.o nfsxdr.o stats.o.

ld -m elf_i386 -r -o sunrpc.o sunrpc_syms.o clnt.o xprt.o sched.o \
auth.o auth_null.o auth_unix.o svc.o svcsock.o svcauth.o \
pmap_clnt.o xdr.o sysctl.o stats.o

In this situation, exactly one of the objects must define
__module_kernel_version, alas both nfsctl and stats define it because
both sources include modules.h (and they both need it). Same problem
with sysctl and stats in sunrpc. Trivial patch.

Index: 27.2/fs/nfsd/stats.c
--- 27.2/fs/nfsd/stats.c Fri, 12 Nov 1999 18:53:00 +1100 keith (linux-2.3/I/b/31_stats.c 1.2 644)
+++ 27.2(w)/fs/nfsd/stats.c Fri, 12 Nov 1999 20:44:30 +1100 keith (linux-2.3/I/b/31_stats.c 1.2 644)
@@ -17,6 +17,7 @@
#include <linux/sched.h>
#include <linux/proc_fs.h>
#include <linux/stat.h>
+#define __NO_VERSION__ /* nfsctl defines module_kernel_version */
#include <linux/module.h>

#include <linux/sunrpc/svc.h>
Index: 27.2/net/sunrpc/sched.c
--- 27.2/net/sunrpc/sched.c Sat, 23 Oct 1999 15:35:04 +1000 keith (linux-2.3/Z/9_sched.c 1.4 644)
+++ 27.2(w)/net/sunrpc/sched.c Fri, 12 Nov 1999 20:52:55 +1100 keith (linux-2.3/Z/9_sched.c 1.4 644)
@@ -9,6 +9,7 @@
* (C) 1999 Dave Airlie, University of Limerick, Ireland <airlied@linux.ie>
*/

+#define __NO_VERSION__ /* sysctl defines module_kernel_version */
#include <linux/module.h>

#define __KERNEL_SYSCALLS__

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/