This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: [patch] MIPS/Linux: Clean up cpp ABI dependencies
On Mon, 8 Nov 2004, Eric Christopher wrote:
> > I really don't see why adding _ABIO32 to <sgidefs.h> is going to help.
>
> I agree with this. Though, fwiw, I agree with Maciej that glibc should
> be using ABI* internally. It'll get us away from including sgidefs in
> glibc code. It's not like we need to worry about other compilers there.
Unfortunately, after a closer look I've noticed these _ABI* macros get
actually defined only if they are going to be used for the value of
_MIPS_SIM, that is one at a time. So after removing my addition of them
from <sgidefs.h> conditionals that refer to them suddenly stop working.
So let's just scrap my proposal as it does not make sense anymore.
Then the problem with <sgidefs.h> not being included from some files that
refer to _MIPS_SIM is back, so here's a new version that addresses this
issue as well as a few others that are within the scope. It's been built
successfully and the testsuite has been executed with no new failures for
mips-linux and mipsel-linux hosts.
2004-11-10 Maciej W. Rozycki <macro@mips.com>
* sysdeps/mips/dl-machine.h: Include <sgidefs.h>.
* sysdeps/mips/elf/start.S: Likewise.
* sysdeps/mips/mips64/__longjmp.c: Likewise.
* sysdeps/mips/mips64/bsd-_setjmp.S: Likewise.
* sysdeps/mips/mips64/bsd-setjmp.S: Likewise.
* sysdeps/mips/mips64/setjmp.S: Likewise.
* sysdeps/mips/mips64/setjmp_aux.c: Likewise.
* sysdeps/mips/sys/regdef.h: Likewise.
* sysdeps/mips/sys/ucontext.h: Likewise.
* sysdeps/unix/mips/sysdep.h: Likewise.
* sysdeps/unix/sysv/linux/mips/pwrite64.c: Likewise.
* sysdeps/mips/sgidefs.h: Remove an outdated comment.
* sysdeps/mips/sys/asm.h: Likewise.
* sysdeps/mips/sys/asm.h: Don't pretend to support 64-bit pointers
with the o32 ABI.
* sysdeps/unix/sysv/linux/kernel-features.h: Use standard names
for ABI macros. Include <sgidefs.h>.
* sysdeps/unix/sysv/linux/mips/kernel_sigaction.h: Don't include
<sgidefs.h>.
* sysdeps/unix/sysv/linux/mips/kernel_sigaction.h: Add missing
copyright information.
* sysdeps/unix/sysv/linux/mips/kernel_stat.h: Likewise.
* sysdeps/unix/sysv/linux/mips/pread.c: Fix a _MIPS_SIM
conditional.
* sysdeps/unix/sysv/linux/mips/pwrite.c: Likewise.
* sysdeps/unix/sysv/linux/mips/ptrace.c: Fix formatting.
Please apply.
Maciej
glibc-2.3.3-20041018-mips-abi-9.patch
diff -up --recursive --new-file glibc-2.3.3-20041018.macro/sysdeps/mips/dl-machine.h glibc-2.3.3-20041018/sysdeps/mips/dl-machine.h
--- glibc-2.3.3-20041018.macro/sysdeps/mips/dl-machine.h Sat Oct 16 02:25:31 2004
+++ glibc-2.3.3-20041018/sysdeps/mips/dl-machine.h Wed Nov 10 11:12:51 2004
@@ -32,6 +32,7 @@
#error ENTRY_POINT needs to be defined for MIPS.
#endif
+#include <sgidefs.h>
#include <sys/asm.h>
/* The offset of gp from GOT might be system-dependent. It's set by
diff -up --recursive --new-file glibc-2.3.3-20041018.macro/sysdeps/mips/elf/start.S glibc-2.3.3-20041018/sysdeps/mips/elf/start.S
--- glibc-2.3.3-20041018.macro/sysdeps/mips/elf/start.S Tue Aug 17 01:26:44 2004
+++ glibc-2.3.3-20041018/sysdeps/mips/elf/start.S Wed Nov 10 11:13:20 2004
@@ -1,5 +1,5 @@
/* Startup code compliant to the ELF Mips ABI.
- Copyright (C) 1995, 1997, 2000, 2001, 2002, 2003
+ Copyright (C) 1995, 1997, 2000, 2001, 2002, 2003, 2004
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -37,6 +37,7 @@
#define __ASSEMBLY__ 1
#include <entry.h>
+#include <sgidefs.h>
#include <sys/asm.h>
#ifndef ENTRY_POINT
diff -up --recursive --new-file glibc-2.3.3-20041018.macro/sysdeps/mips/mips64/__longjmp.c glibc-2.3.3-20041018/sysdeps/mips/mips64/__longjmp.c
--- glibc-2.3.3-20041018.macro/sysdeps/mips/mips64/__longjmp.c Wed Jul 21 01:26:34 2004
+++ glibc-2.3.3-20041018/sysdeps/mips/mips64/__longjmp.c Wed Nov 10 11:13:38 2004
@@ -19,6 +19,7 @@
02111-1307 USA. */
#include <setjmp.h>
+#include <sgidefs.h>
#include <stdlib.h>
#undef __longjmp
diff -up --recursive --new-file glibc-2.3.3-20041018.macro/sysdeps/mips/mips64/bsd-_setjmp.S glibc-2.3.3-20041018/sysdeps/mips/mips64/bsd-_setjmp.S
--- glibc-2.3.3-20041018.macro/sysdeps/mips/mips64/bsd-_setjmp.S Sat May 31 02:26:03 2003
+++ glibc-2.3.3-20041018/sysdeps/mips/mips64/bsd-_setjmp.S Wed Nov 10 11:14:50 2004
@@ -1,5 +1,6 @@
/* BSD `_setjmp' entry point to `sigsetjmp (..., 0)'. MIPS64 version.
- Copyright (C) 1996, 1997, 2000, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 2000, 2002, 2003, 2004
+ 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
@@ -21,6 +22,7 @@
We cannot do it in C because it must be a tail-call, so frame-unwinding
in setjmp doesn't clobber the state restored by longjmp. */
+#include <sgidefs.h>
#include <sysdep.h>
#include <sys/asm.h>
diff -up --recursive --new-file glibc-2.3.3-20041018.macro/sysdeps/mips/mips64/bsd-setjmp.S glibc-2.3.3-20041018/sysdeps/mips/mips64/bsd-setjmp.S
--- glibc-2.3.3-20041018.macro/sysdeps/mips/mips64/bsd-setjmp.S Tue Mar 18 03:25:56 2003
+++ glibc-2.3.3-20041018/sysdeps/mips/mips64/bsd-setjmp.S Wed Nov 10 11:14:43 2004
@@ -1,5 +1,5 @@
/* BSD `setjmp' entry point to `sigsetjmp (..., 1)'. MIPS64 version.
- Copyright (C) 1996, 1997, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 2002, 2003, 2004 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
@@ -21,6 +21,7 @@
We cannot do it in C because it must be a tail-call, so frame-unwinding
in setjmp doesn't clobber the state restored by longjmp. */
+#include <sgidefs.h>
#include <sysdep.h>
#include <sys/asm.h>
diff -up --recursive --new-file glibc-2.3.3-20041018.macro/sysdeps/mips/mips64/setjmp.S glibc-2.3.3-20041018/sysdeps/mips/mips64/setjmp.S
--- glibc-2.3.3-20041018.macro/sysdeps/mips/mips64/setjmp.S Fri Mar 21 03:26:01 2003
+++ glibc-2.3.3-20041018/sysdeps/mips/mips64/setjmp.S Wed Nov 10 11:15:04 2004
@@ -1,4 +1,5 @@
-/* Copyright (C) 1996, 1997, 2000, 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 2000, 2002, 2003, 2004
+ 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
@@ -16,6 +17,7 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <sgidefs.h>
#include <sysdep.h>
#include <sys/asm.h>
diff -up --recursive --new-file glibc-2.3.3-20041018.macro/sysdeps/mips/mips64/setjmp_aux.c glibc-2.3.3-20041018/sysdeps/mips/mips64/setjmp_aux.c
--- glibc-2.3.3-20041018.macro/sysdeps/mips/mips64/setjmp_aux.c Wed Jul 21 01:26:35 2004
+++ glibc-2.3.3-20041018/sysdeps/mips/mips64/setjmp_aux.c Wed Nov 10 11:15:14 2004
@@ -17,6 +17,7 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <sgidefs.h>
#include <setjmp.h>
/* This function is only called via the assembly language routine
diff -up --recursive --new-file glibc-2.3.3-20041018.macro/sysdeps/mips/sgidefs.h glibc-2.3.3-20041018/sysdeps/mips/sgidefs.h
--- glibc-2.3.3-20041018.macro/sysdeps/mips/sgidefs.h Wed Mar 26 03:25:59 2003
+++ glibc-2.3.3-20041018/sysdeps/mips/sgidefs.h Tue Nov 9 11:23:41 2004
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 1998, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998, 2003, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ralf Baechle <ralf@gnu.org>.
@@ -33,11 +33,6 @@
/*
* Subprogram calling convention
- *
- * At the moment only _MIPS_SIM_ABI32 is in use. This will change rsn.
- * Until GCC 2.8.0 is released don't rely on this definitions because the
- * 64bit code is essentially using the 32bit interface model just with
- * 64bit registers.
*/
#define _MIPS_SIM_ABI32 1
#define _MIPS_SIM_NABI32 2
diff -up --recursive --new-file glibc-2.3.3-20041018.macro/sysdeps/mips/sys/asm.h glibc-2.3.3-20041018/sysdeps/mips/sys/asm.h
--- glibc-2.3.3-20041018.macro/sysdeps/mips/sys/asm.h Wed Mar 26 03:26:04 2003
+++ glibc-2.3.3-20041018/sysdeps/mips/sys/asm.h Wed Nov 10 11:40:30 2004
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ralf Baechle <ralf@gnu.org>.
@@ -33,9 +33,6 @@
/*
* Macros to handle different pointer/register sizes for 32/64-bit code
- *
- * 64 bit address space isn't used yet, so we may use the R3000 32 bit
- * defines for now.
*/
#if (_MIPS_SIM == _MIPS_SIM_ABI32) || (_MIPS_SIM == _MIPS_SIM_NABI32)
# define PTR .word
@@ -389,7 +386,7 @@ symbol = value
/*
* How to add/sub/load/store/shift pointers.
*/
-#if (_MIPS_SIM == _MIPS_SIM_ABI32 && _MIPS_SZPTR == 32)
+#if _MIPS_SIM == _MIPS_SIM_ABI32
# define PTR_ADD add
# define PTR_ADDI addi
# define PTR_ADDU addu
@@ -433,8 +430,7 @@ symbol = value
# define PTR_SCALESHIFT 2
#endif
-#if (_MIPS_SIM == _MIPS_SIM_ABI32 && _MIPS_SZPTR == 64 /* o64??? */) \
- || _MIPS_SIM == _MIPS_SIM_ABI64
+#if _MIPS_SIM == _MIPS_SIM_ABI64
# define PTR_ADD dadd
# define PTR_ADDI daddi
# define PTR_ADDU daddu
diff -up --recursive --new-file glibc-2.3.3-20041018.macro/sysdeps/mips/sys/regdef.h glibc-2.3.3-20041018/sysdeps/mips/sys/regdef.h
--- glibc-2.3.3-20041018.macro/sysdeps/mips/sys/regdef.h Thu Apr 10 02:26:07 2003
+++ glibc-2.3.3-20041018/sysdeps/mips/sys/regdef.h Tue Nov 9 11:26:00 2004
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ralf Baechle <ralf@gnu.org>.
@@ -20,6 +20,8 @@
#ifndef _SYS_REGDEF_H
#define _SYS_REGDEF_H
+#include <sgidefs.h>
+
/*
* Symbolic register names for 32 bit ABI
*/
diff -up --recursive --new-file glibc-2.3.3-20041018.macro/sysdeps/mips/sys/ucontext.h glibc-2.3.3-20041018/sysdeps/mips/sys/ucontext.h
--- glibc-2.3.3-20041018.macro/sysdeps/mips/sys/ucontext.h Tue Mar 18 03:25:56 2003
+++ glibc-2.3.3-20041018/sysdeps/mips/sys/ucontext.h Tue Nov 9 11:26:33 2004
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999, 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 1999, 2002, 2003, 2004 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
@@ -22,6 +22,7 @@
#define _SYS_UCONTEXT_H 1
#include <features.h>
+#include <sgidefs.h>
#include <signal.h>
/* Type for general register. */
diff -up --recursive --new-file glibc-2.3.3-20041018.macro/sysdeps/unix/mips/sysdep.h glibc-2.3.3-20041018/sysdeps/unix/mips/sysdep.h
--- glibc-2.3.3-20041018.macro/sysdeps/unix/mips/sysdep.h Wed Sep 10 02:26:07 2003
+++ glibc-2.3.3-20041018/sysdeps/unix/mips/sysdep.h Wed Nov 10 11:15:56 2004
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1995, 1997, 1999, 2000, 2002, 2003
+/* Copyright (C) 1992, 1995, 1997, 1999, 2000, 2002, 2003, 2004
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Brendan Kehoe (brendan@zen.org).
@@ -18,6 +18,7 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <sgidefs.h>
#include <sysdeps/unix/sysdep.h>
#ifdef __ASSEMBLER__
diff -up --recursive --new-file glibc-2.3.3-20041018.macro/sysdeps/unix/sysv/linux/kernel-features.h glibc-2.3.3-20041018/sysdeps/unix/sysv/linux/kernel-features.h
--- glibc-2.3.3-20041018.macro/sysdeps/unix/sysv/linux/kernel-features.h Sat Sep 11 01:26:41 2004
+++ glibc-2.3.3-20041018/sysdeps/unix/sysv/linux/kernel-features.h Wed Nov 10 11:02:45 2004
@@ -21,6 +21,10 @@
/* This file must not contain any C code. At least it must be protected
to allow using the file also in assembler files. */
+#if defined __mips__
+# include <sgidefs.h>
+#endif
+
#ifndef __LINUX_KERNEL_VERSION
/* We assume the worst; all kernels should be supported. */
# define __LINUX_KERNEL_VERSION 0
@@ -277,7 +281,7 @@
# define __ASSUME_TIMEVAL64 1
#endif
-#if defined __mips__ && defined _ABIN32 && _MIPS_SIM == _ABIN32
+#if defined __mips__ && _MIPS_SIM == _MIPS_SIM_ABI32
# define __ASSUME_FCNTL64 1
#endif
diff -up --recursive --new-file glibc-2.3.3-20041018.macro/sysdeps/unix/sysv/linux/mips/kernel_sigaction.h glibc-2.3.3-20041018/sysdeps/unix/sysv/linux/mips/kernel_sigaction.h
--- glibc-2.3.3-20041018.macro/sysdeps/unix/sysv/linux/mips/kernel_sigaction.h Wed Mar 26 03:26:06 2003
+++ glibc-2.3.3-20041018/sysdeps/unix/sysv/linux/mips/kernel_sigaction.h Tue Nov 9 12:59:07 2004
@@ -1,6 +1,21 @@
-/* This is the sigaction structure from the Linux 2.1.24 kernel. */
+/* This is the sigaction structure from the Linux 2.1.24 kernel.
+ Copyright (C) 1997, 1998, 2000, 2003, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
-#include <sgidefs.h>
+ 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. */
#define HAVE_SA_RESTORER
diff -up --recursive --new-file glibc-2.3.3-20041018.macro/sysdeps/unix/sysv/linux/mips/kernel_stat.h glibc-2.3.3-20041018/sysdeps/unix/sysv/linux/mips/kernel_stat.h
--- glibc-2.3.3-20041018.macro/sysdeps/unix/sysv/linux/mips/kernel_stat.h Wed Jul 21 01:26:42 2004
+++ glibc-2.3.3-20041018/sysdeps/unix/sysv/linux/mips/kernel_stat.h Wed Nov 10 11:04:34 2004
@@ -1,8 +1,27 @@
+/* Definition of `struct stat' used in the kernel.
+ Copyright (C) 1997, 2000, 2003, 2004 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 <sgidefs.h>
+
/* As tempting as it is to define XSTAT_IS_XSTAT64 for n64, the
userland data structures are not identical, because of different
padding. */
-/* Definition of `struct stat' used in the kernel. */
#if _MIPS_SIM != _MIPS_SIM_ABI32
struct kernel_stat
{
diff -up --recursive --new-file glibc-2.3.3-20041018.macro/sysdeps/unix/sysv/linux/mips/pread.c glibc-2.3.3-20041018/sysdeps/unix/sysv/linux/mips/pread.c
--- glibc-2.3.3-20041018.macro/sysdeps/unix/sysv/linux/mips/pread.c Fri Aug 27 01:26:49 2004
+++ glibc-2.3.3-20041018/sysdeps/unix/sysv/linux/mips/pread.c Wed Nov 10 11:06:53 2004
@@ -80,7 +80,7 @@ __libc_pread (fd, buf, count, offset)
int oldtype = LIBC_CANCEL_ASYNC ();
/* First try the syscall. */
-#if _MIPS_SIM == _MIPS_SIM_NABI32 || _MIPS_SIM_ABI64
+#if _MIPS_SIM == _MIPS_SIM_NABI32 || _MIPS_SIM == _MIPS_SIM_ABI64
result = INLINE_SYSCALL (pread, 4, fd, CHECK_N (buf, count), count, offset);
#else
result = INLINE_SYSCALL (pread, 6, fd, CHECK_N (buf, count), count, 0,
diff -up --recursive --new-file glibc-2.3.3-20041018.macro/sysdeps/unix/sysv/linux/mips/ptrace.c glibc-2.3.3-20041018/sysdeps/unix/sysv/linux/mips/ptrace.c
--- glibc-2.3.3-20041018.macro/sysdeps/unix/sysv/linux/mips/ptrace.c Wed Jul 21 01:26:43 2004
+++ glibc-2.3.3-20041018/sysdeps/unix/sysv/linux/mips/ptrace.c Wed Nov 10 11:08:01 2004
@@ -28,7 +28,7 @@
#include <bp-checks.h>
#include <sgidefs.h>
-#if _MIPS_SIM == _MIPS_SIM_NABI32
+#if _MIPS_SIM == _MIPS_SIM_NABI32
__extension__ typedef long long int reg_type;
#else
typedef long int reg_type;
diff -up --recursive --new-file glibc-2.3.3-20041018.macro/sysdeps/unix/sysv/linux/mips/pwrite.c glibc-2.3.3-20041018/sysdeps/unix/sysv/linux/mips/pwrite.c
--- glibc-2.3.3-20041018.macro/sysdeps/unix/sysv/linux/mips/pwrite.c Fri Aug 27 01:26:49 2004
+++ glibc-2.3.3-20041018/sysdeps/unix/sysv/linux/mips/pwrite.c Wed Nov 10 12:56:47 2004
@@ -55,7 +55,7 @@ __libc_pwrite (fd, buf, count, offset)
{
ssize_t result;
-#if _MIPS_SIM == _MIPS_SIM_ABI64
+#if _MIPS_SIM != _MIPS_SIM_ABI64
assert (sizeof (offset) == 4);
#endif
diff -up --recursive --new-file glibc-2.3.3-20041018.macro/sysdeps/unix/sysv/linux/mips/pwrite64.c glibc-2.3.3-20041018/sysdeps/unix/sysv/linux/mips/pwrite64.c
--- glibc-2.3.3-20041018.macro/sysdeps/unix/sysv/linux/mips/pwrite64.c Wed Jul 21 01:26:43 2004
+++ glibc-2.3.3-20041018/sysdeps/unix/sysv/linux/mips/pwrite64.c Wed Nov 10 11:18:40 2004
@@ -27,6 +27,9 @@
#include <bp-checks.h>
#include <kernel-features.h>
+#ifndef NO_SGIDEFS_H
+#include <sgidefs.h>
+#endif
#ifdef __NR_pwrite64 /* Newer kernels renamed but it's the same. */
# ifdef __NR_pwrite