This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Undefined references to 'memcpy' when compiling Linux Kernel
- To: linux-kernel at vger dot rutgers dot edu
- Subject: Re: Undefined references to 'memcpy' when compiling Linux Kernel
- From: Byron Stanoszek <gandalf at winds dot org>
- Date: Fri, 16 Jun 2000 14:00:27 -0400 (EDT)
- cc: alan at lxorguk dot ukuu dot org dot uk, gcc at gcc dot gnu dot org
The attached patch will fix the memcpy errors while compiling with gcc 2.96.
I still feel that the compiler is in error here, such that it should
optimize struct assignments using its built-in 'memcpy' function just as it
does for all other memcpy() substitutions. GCC 2.95.2 seems to do this just
fine.
--
Byron Stanoszek Ph: (330) 644-3059
Systems Programmer Fax: (330) 644-8110
Commercial Timesharing Inc. Email: bstanoszek@comtime.com
--- linux/fs/nfs/inode.c Fri Jun 16 13:47:14 2000
+++ linux/fs/nfs/inode.c Fri Jun 16 13:47:03 2000
@@ -705,7 +705,7 @@
(long long)fattr->fileid);
/* Install the file handle in the dentry */
- *((struct nfs_fh *) dentry->d_fsdata) = *fhandle;
+ memcpy(dentry->d_fsdata, fhandle, sizeof(struct nfs_fh));
#ifdef CONFIG_NFS_SNAPSHOT
/*
--- linux/fs/lockd/svcsubs.c Fri Jun 16 13:50:52 2000
+++ linux/fs/lockd/svcsubs.c Fri Jun 16 13:50:47 2000
@@ -79,7 +79,7 @@
goto out_unlock;
memset(file, 0, sizeof(*file));
- file->f_handle = *f;
+ memcpy(&file->f_handle, f, sizeof(struct nfs_fh));
file->f_hash = hash;
init_MUTEX(&file->f_sema);
--- linux/fs/lockd/clntproc.c Fri Jun 16 13:49:47 2000
+++ linux/fs/lockd/clntproc.c Fri Jun 16 13:48:50 2000
@@ -50,7 +50,7 @@
memset(argp, 0, sizeof(*argp));
nlmclnt_next_cookie(&argp->cookie);
argp->state = nsm_local_state;
- lock->fh = *NFS_FH(fl->fl_file->f_dentry);
+ memcpy(&lock->fh, NFS_FH(fl->fl_file->f_dentry), sizeof(struct nfs_fh));
lock->caller = system_utsname.nodename;
lock->oh.data = req->a_owner;
lock->oh.len = sprintf(req->a_owner, "%d@%s",