2002-03-16 08:04:18

by Miles Lane

[permalink] [raw]
Subject: 2.5.7-pre2 -- kernel.o(.data+0x300): undefined reference to `sys_nfsservctl'

arch/i386/kernel/kernel.o: In function `sys_call_table':
arch/i386/kernel/kernel.o(.data+0x300): undefined reference to
`sys_nfsservctl'

CONFIG_PACKET=m
# CONFIG_PACKET_MMAP is not set
CONFIG_NETLINK_DEV=y
# CONFIG_NETFILTER is not set
# CONFIG_FILTER is not set
CONFIG_UNIX=y
CONFIG_INET=y
# CONFIG_IP_MULTICAST is not set
# CONFIG_IP_ADVANCED_ROUTER is not set
# CONFIG_IP_PNP is not set
# CONFIG_NET_IPIP is not set
# CONFIG_NET_IPGRE is not set
# CONFIG_ARPD is not set
# CONFIG_INET_ECN is not set
CONFIG_SYN_COOKIES=y
# CONFIG_IPV6 is not set
# CONFIG_KHTTPD is not set
# CONFIG_ATM is not set
# CONFIG_VLAN_8021Q is not set
# CONFIG_IPX is not set
CONFIG_ATALK=y
# CONFIG_DECNET is not set
# CONFIG_BRIDGE is not set
# CONFIG_X25 is not set
# CONFIG_LAPB is not set
# CONFIG_LLC is not set
# CONFIG_NET_DIVERT is not set
# CONFIG_ECONET is not set
# CONFIG_WAN_ROUTER is not set
# CONFIG_NET_FASTROUTE is not set
# CONFIG_NET_HW_FLOWCONTROL is not set

#
# Network File Systems
#
# CONFIG_CODA_FS is not set
# CONFIG_INTERMEZZO_FS is not set
# CONFIG_NFS_FS is not set
# CONFIG_NFS_V3 is not set
# CONFIG_ROOT_NFS is not set
# CONFIG_NFSD is not set
# CONFIG_NFSD_V3 is not set
# CONFIG_NFSD_TCP is not set
# CONFIG_SUNRPC is not set
# CONFIG_LOCKD is not set
# CONFIG_SMB_FS is not set
# CONFIG_NCP_FS is not set
# CONFIG_NCPFS_PACKET_SIGNING is not set
# CONFIG_NCPFS_IOCTL_LOCKING is not set
# CONFIG_NCPFS_STRONG is not set
# CONFIG_NCPFS_NFS_NS is not set
# CONFIG_NCPFS_OS2_NS is not set
# CONFIG_NCPFS_SMALLDOS is not set
# CONFIG_NCPFS_NLS is not set
# CONFIG_NCPFS_EXTRAS is not set
CONFIG_ZISOFS_FS=y


2002-03-16 08:54:15

by Alexander Viro

[permalink] [raw]
Subject: Re: 2.5.7-pre2 -- kernel.o(.data+0x300): undefined reference to `sys_nfsservctl'



On 16 Mar 2002, Miles Lane wrote:

> arch/i386/kernel/kernel.o: In function `sys_call_table':
> arch/i386/kernel/kernel.o(.data+0x300): undefined reference to
> `sys_nfsservctl'

Fix: add a weak alias sys_nfsservctl -> sys_ni_syscall in kernel/sys.c.
While we are at it, the same can be done with sys_quotactl() - I suspect
that fs/noqout.c can be killed.

diff -urN C7-pre2/fs/noquot.c C7-pre2-current/fs/noquot.c
--- C7-pre2/fs/noquot.c Fri May 12 14:21:20 2000
+++ C7-pre2-current/fs/noquot.c Sat Mar 16 03:45:27 2002
@@ -2,14 +2,5 @@
* compiled into the kernel.
*/

-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/errno.h>
-
int nr_dquots, nr_free_dquots;
int max_dquots;
-
-asmlinkage long sys_quotactl(int cmd, const char *special, int id, caddr_t addr)
-{
- return(-ENOSYS);
-}
diff -urN C7-pre2/kernel/sys.c C7-pre2-current/kernel/sys.c
--- C7-pre2/kernel/sys.c Fri Mar 15 22:22:40 2002
+++ C7-pre2-current/kernel/sys.c Sat Mar 16 03:43:14 2002
@@ -173,6 +173,11 @@
return -ENOSYS;
}

+/* "Conditional" syscalls */
+
+asmlinkage long sys_nfsservctl(void) __attribute__ ((weak, alias ("sys_ni_syscall")));
+asmlinkage long sys_quotactl(void) __attribute__ ((weak, alias ("sys_ni_syscall")));
+
static int proc_sel(struct task_struct *p, int which, int who)
{
if(p->pid)

2002-03-16 10:17:17

by Alexander Viro

[permalink] [raw]
Subject: [PATCH] Re: 2.5.7-pre2 -- kernel.o(.data+0x300): undefined reference to `sys_nfsservctl'



On Sat, 16 Mar 2002, Alexander Viro wrote:

> On 16 Mar 2002, Miles Lane wrote:
>
> > arch/i386/kernel/kernel.o: In function `sys_call_table':
> > arch/i386/kernel/kernel.o(.data+0x300): undefined reference to
> > `sys_nfsservctl'
>
> Fix: add a weak alias sys_nfsservctl -> sys_ni_syscall in kernel/sys.c.
> While we are at it, the same can be done with sys_quotactl() - I suspect
> that fs/noqout.c can be killed.

It can. Linus, what do you think about the following variant?

diff -urN C7-pre2/fs/Makefile C7-pre2-current/fs/Makefile
--- C7-pre2/fs/Makefile Fri Mar 15 22:22:35 2002
+++ C7-pre2-current/fs/Makefile Sat Mar 16 04:24:26 2002
@@ -16,12 +16,6 @@
dcache.o inode.o attr.o bad_inode.o file.o iobuf.o dnotify.o \
filesystems.o namespace.o seq_file.o xattr.o libfs.o

-ifeq ($(CONFIG_QUOTA),y)
-obj-y += dquot.o
-else
-obj-y += noquot.o
-endif
-
ifneq ($(CONFIG_NFSD),n)
ifneq ($(CONFIG_NFSD),)
obj-y += nfsctl.o
@@ -84,6 +78,8 @@
obj-y += binfmt_script.o

obj-$(CONFIG_BINFMT_ELF) += binfmt_elf.o
+
+obj-$(CONFIG_QUOTA) += dquot.o

# persistent filesystems
obj-y += $(join $(subdir-y),$(subdir-y:%=/%.o))
diff -urN C7-pre2/fs/dquot.c C7-pre2-current/fs/dquot.c
--- C7-pre2/fs/dquot.c Tue Feb 19 22:33:03 2002
+++ C7-pre2-current/fs/dquot.c Sat Mar 16 04:45:14 2002
@@ -59,6 +59,7 @@
#include <linux/tty.h>
#include <linux/file.h>
#include <linux/slab.h>
+#include <linux/sysctl.h>
#include <linux/smp_lock.h>
#include <linux/init.h>

@@ -1240,9 +1241,22 @@
return ret;
}

+static ctl_table fs_table[] = {
+ {FS_NRDQUOT, "dquot-nr", &nr_dquots, 2*sizeof(int),
+ 0444, NULL, &proc_dointvec},
+ {},
+};
+
+static ctl_table dquot_table[] = {
+ {CTL_FS, "fs", NULL, 0, 0555, fs_table},
+ {},
+};
+
static int __init dquot_init(void)
{
int i;
+
+ register_sysctl_table(dquot_table, 0);

for (i = 0; i < NR_DQHASH; i++)
INIT_LIST_HEAD(dquot_hash + i);
diff -urN C7-pre2/fs/noquot.c C7-pre2-current/fs/noquot.c
--- C7-pre2/fs/noquot.c Fri May 12 14:21:20 2000
+++ C7-pre2-current/fs/noquot.c Sat Mar 16 04:18:29 2002
@@ -2,14 +2,4 @@
* compiled into the kernel.
*/

-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/errno.h>
-
int nr_dquots, nr_free_dquots;
-int max_dquots;
-
-asmlinkage long sys_quotactl(int cmd, const char *special, int id, caddr_t addr)
-{
- return(-ENOSYS);
-}
diff -urN C7-pre2/include/linux/quota.h C7-pre2-current/include/linux/quota.h
--- C7-pre2/include/linux/quota.h Mon Jan 14 23:13:52 2002
+++ C7-pre2-current/include/linux/quota.h Sat Mar 16 04:23:01 2002
@@ -144,7 +144,6 @@

#ifdef __KERNEL__

-extern int nr_dquots, nr_free_dquots;
extern int dquot_root_squash;

#define NR_DQHASH 43 /* Just an arbitrary number */
diff -urN C7-pre2/kernel/sys.c C7-pre2-current/kernel/sys.c
--- C7-pre2/kernel/sys.c Fri Mar 15 22:22:40 2002
+++ C7-pre2-current/kernel/sys.c Sat Mar 16 03:43:14 2002
@@ -173,6 +173,11 @@
return -ENOSYS;
}

+/* "Conditional" syscalls */
+
+asmlinkage long sys_nfsservctl(void) __attribute__ ((weak, alias ("sys_ni_syscall")));
+asmlinkage long sys_quotactl(void) __attribute__ ((weak, alias ("sys_ni_syscall")));
+
static int proc_sel(struct task_struct *p, int which, int who)
{
if(p->pid)
diff -urN C7-pre2/kernel/sysctl.c C7-pre2-current/kernel/sysctl.c
--- C7-pre2/kernel/sysctl.c Tue Feb 19 22:33:08 2002
+++ C7-pre2-current/kernel/sysctl.c Sat Mar 16 04:22:45 2002
@@ -284,8 +284,6 @@
0444, NULL, &proc_dointvec},
{FS_MAXFILE, "file-max", &files_stat.max_files, sizeof(int),
0644, NULL, &proc_dointvec},
- {FS_NRDQUOT, "dquot-nr", &nr_dquots, 2*sizeof(int),
- 0444, NULL, &proc_dointvec},
{FS_DENTRY, "dentry-state", &dentry_stat, 6*sizeof(int),
0444, NULL, &proc_dointvec},
{FS_OVERFLOWUID, "overflowuid", &fs_overflowuid, sizeof(int), 0644, NULL,

2002-03-16 17:24:13

by Alan

[permalink] [raw]
Subject: Re: [PATCH] Re: 2.5.7-pre2 -- kernel.o(.data+0x300): undefined reference

> +/* "Conditional" syscalls */
> +
> +asmlinkage long sys_nfsservctl(void) __attribute__ ((weak, alias ("sys_ni_syscall")));
> +asmlinkage long sys_quotactl(void) __attribute__ ((weak, alias ("sys_ni_syscall")));
> +

This is what Linus threw out before - when David wanted to use it to remove
all the intermodule crap.

It doesn't work with some architecture binutils

2002-03-16 17:40:23

by Alexander Viro

[permalink] [raw]
Subject: Re: [PATCH] Re: 2.5.7-pre2 -- kernel.o(.data+0x300): undefined reference



On Sat, 16 Mar 2002, Alan Cox wrote:

> > +/* "Conditional" syscalls */
> > +
> > +asmlinkage long sys_nfsservctl(void) __attribute__ ((weak, alias ("sys_ni_syscall")));
> > +asmlinkage long sys_quotactl(void) __attribute__ ((weak, alias ("sys_ni_syscall")));
> > +
>
> This is what Linus threw out before - when David wanted to use it to remove
> all the intermodule crap.
>
> It doesn't work with some architecture binutils

Erm... In this case we are within statatically linked image. In which
situations it doesn't work? AFAICS it's as straightforward use of weak
aliases as it gets...

2002-03-16 17:48:53

by Alan

[permalink] [raw]
Subject: Re: [PATCH] Re: 2.5.7-pre2 -- kernel.o(.data+0x300): undefined

> > This is what Linus threw out before - when David wanted to use it to remove
> > all the intermodule crap.
> >
> > It doesn't work with some architecture binutils
>
> Erm... In this case we are within statatically linked image. In which
> situations it doesn't work? AFAICS it's as straightforward use of weak
> aliases as it gets...

Grepping I don't have the original mails on the subject

2002-03-16 18:17:33

by Linus Torvalds

[permalink] [raw]
Subject: Re: [PATCH] Re: 2.5.7-pre2 -- kernel.o(.data+0x300): undefined reference


On Sat, 16 Mar 2002, Alan Cox wrote:
> > +/* "Conditional" syscalls */
> > +
> > +asmlinkage long sys_nfsservctl(void) __attribute__ ((weak, alias ("sys_ni_syscall")));
> > +asmlinkage long sys_quotactl(void) __attribute__ ((weak, alias ("sys_ni_syscall")));
> > +
>
> This is what Linus threw out before - when David wanted to use it to remove
> all the intermodule crap.
>
> It doesn't work with some architecture binutils

How true is that these days, though? We are at the point where we don't
have to worry about COFF and a.out architectures (as far as the kernel is
concerned, of course - whatever binftm format is loaded in user mode is a
different thing).

On a related tangent - maybe we should just get rid of SYMBOL_NAME etc
crap? I don't think we've been able to compile a a.out kernel in about 5
years or so, and that was the only thing that needed the magic prepended
underscores etc?

Linus

2002-03-16 19:19:28

by Daniel Jacobowitz

[permalink] [raw]
Subject: Re: [PATCH] Re: 2.5.7-pre2 -- kernel.o(.data+0x300): undefined reference

On Sat, Mar 16, 2002 at 05:39:03PM +0000, Alan Cox wrote:
> > +/* "Conditional" syscalls */
> > +
> > +asmlinkage long sys_nfsservctl(void) __attribute__ ((weak, alias ("sys_ni_syscall")));
> > +asmlinkage long sys_quotactl(void) __attribute__ ((weak, alias ("sys_ni_syscall")));
> > +
>
> This is what Linus threw out before - when David wanted to use it to remove
> all the intermodule crap.
>
> It doesn't work with some architecture binutils

As of at least 2.11.2 (fairly certain) and 2.12 (definite) this should
work on every architecture...

--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer

2002-03-18 03:23:49

by David Miller

[permalink] [raw]
Subject: Re: [PATCH] Re: 2.5.7-pre2 -- kernel.o(.data+0x300): undefined reference

From: Linus Torvalds <[email protected]>
Date: Sat, 16 Mar 2002 10:15:33 -0800 (PST)

On Sat, 16 Mar 2002, Alan Cox wrote:
> This is what Linus threw out before - when David wanted to use it
> to remove all the intermodule crap.
>
> It doesn't work with some architecture binutils

How true is that these days, though?

It is still true, you will break the sparc64 link if you put that
stuff in again. It isn't COFF or a.out, it is elf but there are
bugs in the tools. And these are the only tools I happen to trust
for getting reliable kernels built.