This is the mail archive of the libc-ports@sources.redhat.com mailing list for the libc-ports project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix mips N32 build


On Fri, Mar 28, 2008 at 10:11:41PM -0400, Daniel Jacobowitz wrote:
> On Sat, Mar 29, 2008 at 12:24:57AM +0100, Aurelien Jarno wrote:
> > The patch below is needed for a mips N32 build of the glibc.
> > 
> > 2008-03-15  Aurelien Jarno  <aurelien@aurel32.net>
> > 
> > 	* sysdeps/unix/sysv/linux/mips/mips64/n32/ftruncate64.c: Drop ftruncate
> > 	declaration.
> > 
> > 2008-01-24  Aurelien Jarno  <aurelien@aurel32.net>
> > 
> > 	* sysdeps/unix/sysv/linux/mips/mips64/n32/truncate64.c: Drop truncate
> > 	declaration.
> > 	(truncate64): Fix arguments and call to truncate.
> 
> Doesn't this make them simply aliases for the normal functions?  I
> would be surprised if ftruncate and ftruncate64 on n32 have the same
> type for the second argument.
> 
> If the second argument is only an off_t this risks the compiler
> dropping the top half.
> 

As discussed on IRC, I agree with this analysis.  Please find below a
new version which defines the 64-bit version of the function as an alias
of the main one in syscalls.list.


2008-04-02  Aurelien Jarno  <aurelien@aurel32.net>

	* sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list: Add 
	truncate and ftruncate systems calls.
	* sysdeps/unix/sysv/linux/mips/mips64/n32/ftruncate64.c: Make an
	empty file.
	* sysdeps/unix/sysv/linux/mips/mips64/n32/truncate64.c: Ditto.

Index: sysdeps/unix/sysv/linux/mips/mips64/n32/ftruncate64.c
===================================================================
RCS file: /cvs/glibc/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/ftruncate64.c,v
retrieving revision 1.1
diff -u -d -p -r1.1 ftruncate64.c
--- sysdeps/unix/sysv/linux/mips/mips64/n32/ftruncate64.c	5 Apr 2003 19:57:35 -0000	1.1
+++ sysdeps/unix/sysv/linux/mips/mips64/n32/ftruncate64.c	2 Apr 2008 08:54:11 -0000
@@ -1,28 +1 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/types.h>
-
-#include <sysdep.h>
-
-extern int ftruncate (int fd, off64_t length);
-
-int __ftruncate64 (int fd, off64_t length) {
-  return ftruncate (fd, length);
-}
-weak_alias (__ftruncate64, ftruncate64)
+/* Empty.  */
Index: sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list
===================================================================
RCS file: /cvs/glibc/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list,v
retrieving revision 1.1
diff -u -d -p -r1.1 syscalls.list
--- sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list	23 May 2007 17:26:13 -0000	1.1
+++ sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list	2 Apr 2008 08:54:11 -0000
@@ -3,3 +3,5 @@
 readahead	-	readahead	i:iii	__readahead	readahead
 sync_file_range	-	sync_file_range	i:iiii	sync_file_range
 posix_fadvise	-	fadvise64	i:iiii	posix_fadvise
+ftruncate	-	ftruncate	i:ii	__ftruncate	ftruncate ftruncate64 __ftruncate64
+truncate	-	truncate	i:si	truncate	truncate64
Index: sysdeps/unix/sysv/linux/mips/mips64/n32/truncate64.c
===================================================================
RCS file: /cvs/glibc/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/truncate64.c,v
retrieving revision 1.1
diff -u -d -p -r1.1 truncate64.c
--- sysdeps/unix/sysv/linux/mips/mips64/n32/truncate64.c	5 Apr 2003 19:57:35 -0000	1.1
+++ sysdeps/unix/sysv/linux/mips/mips64/n32/truncate64.c	2 Apr 2008 08:54:11 -0000
@@ -1,30 +1 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/types.h>
-
-#include <sysdep.h>
-#include <bp-checks.h>
-
-extern int truncate (const char *__unbounded path, int dummy,
-		     off64_t length);
-
-int truncate64 (const char *__unbounded path, int dummy,
-		off64_t length) {
-  return truncate (path, dummy, length);
-}
+/* Empty.  */

-- 
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   aurel32@debian.org         | aurelien@aurel32.net
   `-    people.debian.org/~aurel32 | www.aurel32.net


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]