summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2005-10-23 01:27:01 +0000
committerRoland McGrath <roland@gnu.org>2005-10-23 01:27:01 +0000
commit067f926e19b0f048f04727f57d7036ec4a64c050 (patch)
tree3ef68c5c73b308198f994dca043dda10c45dc1ff
parentbf8d53331945a83c95dd046c4811b706a5868be5 (diff)
Updated to fedora-glibc-2_3-20051023T0123cvs/fedora-glibc-2_3_5-0_fc3_8
-rw-r--r--ChangeLog73
-rw-r--r--NEWS22
-rw-r--r--README.template3
-rw-r--r--fedora/branch.mk4
-rw-r--r--hurd/intr-msg.c22
-rw-r--r--posix/Makefile2
-rw-r--r--posix/execvp.c10
-rw-r--r--posix/tst-execvp4.c35
-rw-r--r--sysdeps/alpha/divqu.S2
-rw-r--r--sysdeps/alpha/remqu.S2
-rw-r--r--sysdeps/mach/hurd/dl-sysdep.h8
-rw-r--r--sysdeps/mach/hurd/getpeername.c14
-rw-r--r--sysdeps/mach/hurd/i386/init-first.c25
-rw-r--r--sysdeps/mach/hurd/ioctl.c9
-rw-r--r--sysdeps/unix/sysv/linux/mips/Makefile110
-rwxr-xr-xsysdeps/unix/sysv/linux/mips/configure4
-rw-r--r--sysdeps/unix/sysv/linux/mips/configure.in4
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips32/kern64/sysdep.h36
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h4
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h4
20 files changed, 288 insertions, 105 deletions
diff --git a/ChangeLog b/ChangeLog
index 7bcd7a7b4c..06c104f910 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,49 @@
+2005-10-22 Roland McGrath <roland@redhat.com>
+
+ * README.template: Remove GCC 4 note.
+ * NEWS: Add 2.3.6 items.
+
+2005-10-22 Roland McGrath <roland@frob.com>
+
+ [BZ #1254]
+ * sysdeps/mach/hurd/getpeername.c (__getpeername): Fix last change.
+ From Samuel Thibault <samuel.thibault@ens-lyon.org>.
+
+2005-10-17 Thomas Schwinge <tschwinge@gnu.org>
+
+ [BZ #1252]
+ * hurd/intr-msg.c (_hurd_intr_rpc_mach_msg): Don't use ?: as lvalue.
+ * sysdeps/mach/hurd/ioctl.c (__ioctl): Likewise.
+
+2005-08-23 GOTO Masanori <gotom@debian.or.jp>
+
+ [BZ #1498]
+ * sysdeps/alpha/remqu.S: Return the correct result when the same
+ dividend and divisor are provided, and they're negative numbers.
+ * sysdeps/alpha/divqu.S: Likewise.
+
+2005-10-16 Roland McGrath <roland@frob.com>
+
+ [BZ #1254]
+ * sysdeps/mach/hurd/getpeername.c (__getpeername): Respect *LEN
+ byte limit when setting ADDR->sa_family.
+ Reported by Samuel Thibault <samuel.thibault@ens-lyon.org>.
+
+ [BZ #1253]
+ * sysdeps/mach/hurd/dl-sysdep.h
+ [SHARED] (DL_ARGV_NOT_RELRO): New macro.
+
+ [BZ #1253]
+ * sysdeps/mach/hurd/i386/init-first.c (init): Make cast kosher.
+ (_hurd_stack_setup): Don't declare with arguments and ellipsis.
+ Use __builtin_frame_address and __builtin_return_address.
+ (_dl_init_first): Likewise.
+
+ [BZ #1249]
+ * sysdeps/mach/hurd/i386/init-first.c (_cthread_init_routine): Declare
+ as weak extern.
+ (init): Check for it being undefined.
+
2005-08-05 Alfred M. Szmidt <ams@gnu.org>
[BZ #1252]
@@ -83,6 +129,18 @@
* sysdeps/powerpc/fpu/libm-test-ulps: Adjust expected y1, y1f, yn,
ynf results.
+2005-07-24 Ulrich Drepper <drepper@redhat.com>
+
+ [BZ #1125]
+ * posix/Makefile (tests): Add tst-execvp4.
+ * posix/tst-execvp4.c: New file.
+
+2005-07-24 Jakub Jelinek <jakub@redhat.com>
+
+ [BZ #1125]
+ * posix/execvp.c (execvp): Change path_malloc to
+ char *, free that pointer on failure.
+
2005-07-20 Ulrich Drepper <drepper@redhat.com>
[BZ #1138]
@@ -962,6 +1020,21 @@
* malloc/arena.c: #include <stdbool.h> outside of [SHARED &&
USE_TLS && !USE___THREAD].
+2004-11-11 Richard Sandiford <rsandifo@redhat.com>
+
+ [BZ #758]
+ * sysdeps/unix/sysv/linux/mips/configure.in (asm-unistd.h): Only
+ preprocess <asm/unistd.h> if it defines ABI-prefixed syscall names
+ like __NR_N32_open. Just include <asm/unistd.h> otherwise.
+ * sysdeps/unix/sysv/linux/mips/configure: Regenerate.
+ * sysdeps/unix/sysv/linux/mips/mips32/kern64/sysdep.h: Delete
+ * sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h (SYS_ify): Use the
+ standard __NR prefix.
+ * sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h (SYS_ify): Likewise.
+ * sysdeps/unix/sysv/linux/mips/Makefile (syscall-%.h): Rework so that
+ the output file is compatible with both pre-2.6 and 2.6 kernel headers.
+ Extract separate syscall lists for each ABI.
+
2005-02-23 Ulrich Drepper <drepper@redhat.com>
[BZ #719]
diff --git a/NEWS b/NEWS
index b66392c127..7db8a26c7c 100644
--- a/NEWS
+++ b/NEWS
@@ -1,10 +1,27 @@
-GNU C Library NEWS -- history of user-visible changes. 2005-04-05
+GNU C Library NEWS -- history of user-visible changes. 2005-10-22
Copyright (C) 1992-2002,2003,2004,2005 Free Software Foundation, Inc.
See the end for copying conditions.
Please send GNU C library bug reports via <http://sources.redhat.com/bugzilla/>
using `glibc' in the "product" field.
+Version 2.3.6
+
+* The following bugs are resolved with this release:
+
+ 38, 253, 549, 622, 653, 721, 758, 851, 877, 915, 934, 955, 961,
+ 1016, 1037, 1076, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086,
+ 1087, 1088, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098,
+ 1099, 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109,
+ 1110, 1111, 1112, 1113, 1125, 1137, 1138, 1249, 1250, 1251, 1252,
+ 1253, 1254, 1350, 1358, 1394, 1438, 1498
+
+ Visit <http://sources.redhat.com/bugzilla/> for the details of each bug.
+
+* As of this release, GCC 4 can be used to compile the C Library.
+
+* Timezone data updated to 2005m version.
+
Version 2.3.5
* The following bugs are resolved with this release:
@@ -1495,7 +1512,8 @@ Version 1.04
----------------------------------------------------------------------
Copyright information:
-Copyright (C) 1992-1999,2000,2001,2002 Free Software Foundation, Inc.
+Copyright (C) 1992-1999,2000,2001,2002,2003,2004,2005
+ Free Software Foundation, Inc.
Permission is granted to anyone to make or distribute verbatim copies
of this document as received, in any medium, provided that the
diff --git a/README.template b/README.template
index 5751d6a7e3..d501d718df 100644
--- a/README.template
+++ b/README.template
@@ -2,9 +2,6 @@ This directory contains the version VERSION release of the GNU C Library.
Many bugs have been fixed since the last release.
Some bugs surely remain.
-Please note that version VERSION cannot be built with GCC 4!
-The next release will be compatible with the newer compiler.
-
As of this release, the GNU C library is known to run on the following
configurations:
diff --git a/fedora/branch.mk b/fedora/branch.mk
index 63cadb108d..ff8558fa35 100644
--- a/fedora/branch.mk
+++ b/fedora/branch.mk
@@ -3,5 +3,5 @@ glibc-branch := fedora-2_3
glibc-base := glibc-2_3-branch
DIST_BRANCH := FC-3
COLLECTION := dist-fc3-updates-candidate
-fedora-2_3-sync-date := 2005-10-17 05:18 UTC
-fedora-2_3-sync-tag := fedora-glibc-2_3-20051017T0518
+fedora-2_3-sync-date := 2005-10-23 01:23 UTC
+fedora-2_3-sync-tag := fedora-glibc-2_3-20051023T0123
diff --git a/hurd/intr-msg.c b/hurd/intr-msg.c
index e75fca81fb..0ca6af3580 100644
--- a/hurd/intr-msg.c
+++ b/hurd/intr-msg.c
@@ -1,5 +1,6 @@
/* Replacement for mach_msg used in interruptible Hurd RPCs.
- Copyright (C) 1995,96,97,98,99,2000,01,02 Free Software Foundation, Inc.
+ Copyright (C) 1995,96,97,98,99,2000,2001,2002,2005
+ 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
@@ -201,9 +202,10 @@ _hurd_intr_rpc_mach_msg (mach_msg_header_t *msg,
case MACH_MSG_TYPE_MOVE_SEND:
for (i = 0; i < number; i++)
__mach_port_deallocate (__mach_task_self (), *ports++);
- (ty->msgtl_header.msgt_longform
- ? ty->msgtl_name : ty->msgtl_header.msgt_name)
- = MACH_MSG_TYPE_COPY_SEND;
+ if (ty->msgtl_header.msgt_longform)
+ ty->msgtl_name = MACH_MSG_TYPE_COPY_SEND;
+ else
+ ty->msgtl_header.msgt_name = MACH_MSG_TYPE_COPY_SEND;
break;
case MACH_MSG_TYPE_COPY_SEND:
case MACH_MSG_TYPE_MOVE_RECEIVE:
@@ -223,29 +225,29 @@ _hurd_intr_rpc_mach_msg (mach_msg_header_t *msg,
name = ty->msgtl_name;
size = ty->msgtl_size;
number = ty->msgtl_number;
- (char *) ty += sizeof (mach_msg_type_long_t);
+ ty = (void *) ty + sizeof (mach_msg_type_long_t);
}
else
{
name = ty->msgtl_header.msgt_name;
size = ty->msgtl_header.msgt_size;
number = ty->msgtl_header.msgt_number;
- (char *) ty += sizeof (mach_msg_type_t);
+ ty = (void *) ty + sizeof (mach_msg_type_t);
}
if (ty->msgtl_header.msgt_inline)
{
clean_ports ((void *) ty, 0);
/* calculate length of data in bytes, rounding up */
- (char *) ty += (((((number * size) + 7) >> 3)
- + sizeof (mach_msg_type_t) - 1)
- &~ (sizeof (mach_msg_type_t) - 1));
+ ty = (void *) ty + (((((number * size) + 7) >> 3)
+ + sizeof (mach_msg_type_t) - 1)
+ &~ (sizeof (mach_msg_type_t) - 1));
}
else
{
clean_ports (*(void **) ty,
ty->msgtl_header.msgt_deallocate);
- ++(void **) ty;
+ ty = (void *) ty + sizeof (void *);
}
}
#else /* Untyped Mach IPC flavor. */
diff --git a/posix/Makefile b/posix/Makefile
index e62d4751fd..0c3eacf39d 100644
--- a/posix/Makefile
+++ b/posix/Makefile
@@ -87,7 +87,7 @@ tests := tstgetopt testfnm runtests runptests \
tst-execvp1 tst-execvp2 tst-execlp1 tst-execlp2 \
tst-execv1 tst-execv2 tst-execl1 tst-execl2 \
tst-execve1 tst-execve2 tst-execle1 tst-execle2 \
- tst-execvp3
+ tst-execvp3 tst-execvp4
xtests := bug-ga2
ifeq (yes,$(build-shared))
test-srcs := globtest
diff --git a/posix/execvp.c b/posix/execvp.c
index 6f4e4b8566..8421bd048f 100644
--- a/posix/execvp.c
+++ b/posix/execvp.c
@@ -88,7 +88,7 @@ execvp (file, argv)
else
{
char *path = getenv ("PATH");
- bool path_malloc = false;
+ char *path_malloc = NULL;
if (path == NULL)
{
/* There is no `PATH' in the environment.
@@ -100,7 +100,7 @@ execvp (file, argv)
return -1;
path[0] = ':';
(void) confstr (_CS_PATH, path + 1, len);
- path_malloc = true;
+ path_malloc = path;
}
size_t len = strlen (file) + 1;
@@ -108,8 +108,7 @@ execvp (file, argv)
char *name = malloc (pathlen + len + 1);
if (name == NULL)
{
- if (path_malloc)
- free (path);
+ free (path_malloc);
return -1;
}
/* Copy the file name at the top. */
@@ -190,8 +189,7 @@ execvp (file, argv)
free (script_argv);
free (name - pathlen);
- if (path_malloc)
- free (path);
+ free (path_malloc);
}
/* Return the error from the last attempt (probably ENOENT). */
diff --git a/posix/tst-execvp4.c b/posix/tst-execvp4.c
new file mode 100644
index 0000000000..531fab227b
--- /dev/null
+++ b/posix/tst-execvp4.c
@@ -0,0 +1,35 @@
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/stat.h>
+
+static int
+do_test (void)
+{
+ char buf[40] = "/usr/bin/does-not-exist";
+ size_t stemlen = strlen (buf);
+ struct stat64 st;
+ int cnt = 0;
+ while (stat64 (buf, &st) != -1 || errno != ENOENT
+ || stat64 (buf + 4, &st) != -1 || errno != ENOENT)
+ {
+ if (cnt++ == 100)
+ {
+ puts ("cannot find a unique file name");
+ return 0;
+ }
+
+ strcpy (buf + stemlen, ".XXXXXX");
+ mktemp (buf);
+ }
+
+ unsetenv ("PATH");
+ char *argv[] = { buf + 9, NULL };
+ execvp (argv[0], argv);
+ return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/sysdeps/alpha/divqu.S b/sysdeps/alpha/divqu.S
index fc00fa133c..03e29aa5e6 100644
--- a/sysdeps/alpha/divqu.S
+++ b/sysdeps/alpha/divqu.S
@@ -240,7 +240,7 @@ $y_is_neg:
/* If we get here, Y is so big that bit 63 is set. The results
from the divide will be completely wrong. Fortunately, the
quotient must be either 0 or 1, so just compute it directly. */
- cmpult Y, X, RV
+ cmpule Y, X, RV
excb
mt_fpcr $f3
ldt $f0, 0(sp)
diff --git a/sysdeps/alpha/remqu.S b/sysdeps/alpha/remqu.S
index bfa78dff57..d3383f2ed5 100644
--- a/sysdeps/alpha/remqu.S
+++ b/sysdeps/alpha/remqu.S
@@ -246,7 +246,7 @@ $y_is_neg:
from the divide will be completely wrong. Fortunately, the
quotient must be either 0 or 1, so the remainder must be X
or X-Y, so just compute it directly. */
- cmpult Y, X, AT
+ cmpule Y, X, AT
subq X, Y, RV
ldt $f0, 0(sp)
cmoveq AT, X, RV
diff --git a/sysdeps/mach/hurd/dl-sysdep.h b/sysdeps/mach/hurd/dl-sysdep.h
index 2dc9b0a910..4b21b779ef 100644
--- a/sysdeps/mach/hurd/dl-sysdep.h
+++ b/sysdeps/mach/hurd/dl-sysdep.h
@@ -1,5 +1,5 @@
/* System-specific settings for dynamic linker code. Hurd version.
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 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
@@ -23,3 +23,9 @@
(open, mmap, etc). */
#define RTLD_PRIVATE_ERRNO 0
+
+#ifdef SHARED
+/* _dl_argv cannot be attribute_relro, because the stack-switching
+ libc initializer for using cthreads might write into it. */
+# define DL_ARGV_NOT_RELRO 1
+#endif
diff --git a/sysdeps/mach/hurd/getpeername.c b/sysdeps/mach/hurd/getpeername.c
index 2e4f9f6a9d..325b6fd75d 100644
--- a/sysdeps/mach/hurd/getpeername.c
+++ b/sysdeps/mach/hurd/getpeername.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1994, 1997, 1999, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1992,1994,1997,1999,2000,2005 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
@@ -47,14 +47,22 @@ __getpeername (int fd, __SOCKADDR_ARG addrarg, socklen_t *len)
if (*len > buflen)
*len = buflen;
-
+
if (buf != (char *) addr)
{
memcpy (addr, buf, *len);
__vm_deallocate (__mach_task_self (), (vm_address_t) buf, buflen);
}
- addr->sa_family = type;
+ const sa_family_t family = type;
+ if (*len > offsetof (struct sockaddr, sa_family))
+ {
+ if (*len < (char *) (&addr->sa_family + 1) - (char *) addr)
+ memcpy (&addr->sa_family, &family,
+ *len - offsetof (struct sockaddr, sa_family));
+ else
+ addr->sa_family = family;
+ }
return 0;
}
diff --git a/sysdeps/mach/hurd/i386/init-first.c b/sysdeps/mach/hurd/i386/init-first.c
index caa232026d..f9a7a58deb 100644
--- a/sysdeps/mach/hurd/i386/init-first.c
+++ b/sysdeps/mach/hurd/i386/init-first.c
@@ -1,5 +1,6 @@
/* Initialization code run first thing by the ELF startup code. For i386/Hurd.
- Copyright (C) 1995,96,97,98,99,2000,01,02,03,04 Free Software Foundation, Inc.
+ Copyright (C) 1995,96,97,98,99,2000,01,02,03,04,05
+ 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
@@ -54,7 +55,7 @@ extern int __libc_argc attribute_hidden;
extern char **__libc_argv attribute_hidden;
extern char **_dl_argv;
-void *(*_cthread_init_routine) (void); /* Returns new SP to use. */
+extern void *(*_cthread_init_routine) (void) __attribute__ ((weak));
void (*_cthread_exit_routine) (int status) __attribute__ ((__noreturn__));
/* Things that want to be run before _hurd_init or much anything else.
@@ -203,7 +204,7 @@ init (int *data)
code as the return address, and the argument data immediately above
that on the stack. */
- if (_cthread_init_routine)
+ if (&_cthread_init_routine && _cthread_init_routine)
{
/* Initialize cthreads, which will allocate us a new stack to run on. */
int *newsp = (*_cthread_init_routine) ();
@@ -271,7 +272,7 @@ init (int *data)
/* The argument data is just above the stack frame we will unwind by
returning. Mutate our own return address to run the code below. */
usercode = data[-1];
- ((void **) data)[-1] = call_init1;
+ data[-1] = (int) &call_init1;
/* Force USERCODE into %eax and &init1 into %ecx, which are not
restored by function return. */
asm volatile ("# a %0 c %1" : : "a" (usercode), "c" (&init1));
@@ -319,11 +320,11 @@ first_init (void)
stack set up just as the user will see it, so it can switch stacks. */
void
-_dl_init_first (int argc, ...)
+_dl_init_first (void)
{
first_init ();
- init (&argc);
+ init ((int *) __builtin_frame_address (0) + 2);
}
#endif
@@ -350,21 +351,23 @@ strong_alias (posixland_init, __libc_init_first);
This poorly-named function is called by static-start.S,
which should not exist at all. */
void
-_hurd_stack_setup (volatile int argc, ...)
+_hurd_stack_setup (void)
{
+ intptr_t caller = (intptr_t) __builtin_return_address (0);
+
void doinit (intptr_t *data)
{
/* This function gets called with the argument data at TOS. */
- void doinit1 (volatile int argc, ...)
+ void doinit1 (void)
{
- init ((int *) &argc);
+ init ((int *) __builtin_frame_address (0) + 2);
}
/* Push the user return address after the argument data, and then
jump to `doinit1' (above), so it is as if __libc_init_first's
caller had called `doinit1' with the argument data already on the
stack. */
- *--data = (&argc)[-1];
+ *--data = caller;
asm volatile ("movl %0, %%esp\n" /* Switch to new outermost stack. */
"movl $0, %%ebp\n" /* Clear outermost frame pointer. */
"jmp *%1" : : "r" (data), "r" (&doinit1) : "sp");
@@ -373,7 +376,7 @@ _hurd_stack_setup (volatile int argc, ...)
first_init ();
- _hurd_startup ((void **) &argc, &doinit);
+ _hurd_startup ((void **) __builtin_frame_address (0) + 2, &doinit);
}
#endif
diff --git a/sysdeps/mach/hurd/ioctl.c b/sysdeps/mach/hurd/ioctl.c
index 3d590d5845..6a540241a4 100644
--- a/sysdeps/mach/hurd/ioctl.c
+++ b/sysdeps/mach/hurd/ioctl.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1992,93,94,95,96,97,99,2000,02 Free Software Foundation, Inc.
+/* Copyright (C) 1992,93,94,95,96,97,99,2000,2002,2005
+ 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
@@ -136,9 +137,11 @@ __ioctl (int fd, unsigned long int request, ...)
Rather than pointing to the value, ARG is the value itself. */
#ifdef MACH_MSG_TYPE_BIT
*t++ = io2mach_type (1, _IOTS (integer_t));
- *((integer_t *) t)++ = (integer_t) arg;
+ *(integer_t *) t = (integer_t) arg;
+ t = (void *) t + sizeof (integer_t);
#else
- *((integer_t *) p)++ = (integer_t) arg;
+ *(integer_t *) p = (integer_t) arg;
+ p = (void *) p + sizeof (integer_t);
#endif
}
diff --git a/sysdeps/unix/sysv/linux/mips/Makefile b/sysdeps/unix/sysv/linux/mips/Makefile
index d5e4f6b72d..b53745dbc4 100644
--- a/sysdeps/unix/sysv/linux/mips/Makefile
+++ b/sysdeps/unix/sysv/linux/mips/Makefile
@@ -9,11 +9,73 @@ sysdep_headers += sys/cachectl.h sys/sysmips.h sys/tas.h
no_syscall_list_h = 1
-# Generate the list of SYS_* macros for the system calls (__NR_* macros).
-# We generate not only SYS_<syscall>, pointing at SYS_<abi>_<syscall> if
-# it exists, but also define SYS_<abi>_<syscall> for all ABIs.
+# A callable macro that expands to a shell command. Preprocess file $(1)
+# using ABI option $(2) and see which macros it defines. Print FOO for each
+# macro of the form __NR$(3)_FOO, filtering out ABI-specific __NR macros
+# that have a prefix other than $(3).
+mips_list_syscalls = $(filter-out -m%,$(CC)) -E -x c $(+includes) \
+ $(sysincludes) -D_LIBC -dM -mabi=$(2) $(1) | \
+ sed -n 's@^\#define __NR$(3)_\([^ ]*\) .*@\1@p' | \
+ sed -e '/^[ON]32_/d' -e '/^N64_/d' -e '/^64_/d' | \
+ LC_ALL=C sort
+
+# Generate a list of SYS_* macros from the linux __NR macros.
+#
+# Before version 2.6, linux had separate 32-bit and 64-bit MIPS ports,
+# each with its own set of headers. The ports were merged for 2.6 and
+# this merged port defines the syscalls in a slightly different way.
+# There are therefore three sets of headers that we need to consider:
+#
+# (1) Headers from the separate 32-bit MIPS port. They just define
+# a single list of __NR macros.
+#
+# (2) Headers from the separate 64-bit MIPS port. They unconditionally
+# define syscalls for all three ABIs, with o32 syscalls prefixed
+# by __NR_O32, n32 syscalls prefixed by __NR_N32 and n64 syscalls
+# prefixed by plain __NR.
+#
+# (3) Headers from the combined port. They use the _MIPS_SIM macro to
+# define the right set of syscalls for the current ABI. The syscalls
+# themselves have no special ABI prefix, but the headers also define:
+#
+# __NR_O32_Linux{,_syscalls}
+# __NR_N32_Linux{,_syscalls}
+# __NR_64_Linux{,_syscalls}
+#
+# In case (1) we just want a simple list of SYS_* macros. In cases (2)
+# and (3) we want a file that will work for all three ABIs, regardless
+# of which ABI we are currently using. We also want the file to work
+# if the user later moves from (2) to (3). Thus the file we create
+# for (2) and (3) has the form:
+#
+# #if _MIPS_SIM == _MIPS_SIM_NABI32
+# # ifdef __NR_N32_open
+# # define SYS_n32syscall1 __NR_N32_n32syscall1
+# # ...
+# # else
+# # define SYS_n32syscall1 __NR_n32syscall1
+# # ...
+# # endif
+# #elif _MIPS_SIM == _MIPS_SIM_ABI64
+# # define SYS_n64syscall1 __NR_n64syscall1
+# # ...
+# #else
+# # ifdef __NR_O32_open
+# # define SYS_o32syscall1 __NR_O32_o32syscall1
+# # ...
+# # else
+# # define SYS_o32syscall1 __NR_o32syscall1
+# # ...
+# # endif
+# #endif
+#
+# Here, __NR_N32_open and __NR_O32_open are used to detect case (2)
+# over case (3). The n64 SYS_* macros can always use the normal
+# ABI-less names.
$(objpfx)syscall-%.h $(objpfx)syscall-%.d: ../sysdeps/unix/sysv/linux/mips/sys/syscall.h
$(make-target-directory)
+ $(CC) -E -x c $(+includes) $(sysincludes) -D_LIBC $< -MD -MP \
+ -MF $(@:.h=.d)-t -MT '$(@:.d=.h) $(@:.h=.d)' > /dev/null
{ \
echo '/* Generated at libc build time from kernel syscall list. */';\
echo ''; \
@@ -22,28 +84,38 @@ $(objpfx)syscall-%.h $(objpfx)syscall-%.d: ../sysdeps/unix/sysv/linux/mips/sys/s
echo '#endif'; \
echo ''; \
echo '#include <sgidefs.h>'; \
- rm -f $(@:.d=.h).newt; \
- $(CC) -E -MD -MP -MF $(@:.h=.d)-t -MT '$(@:.d=.h) $(@:.h=.d)' \
- -x c $(+includes) $(sysincludes) $< -D_LIBC -dM | \
- sed -n 's@^#define __NR_\([^ ]*\) .*$$@#define SYS_\1 __NR_\1@p' \
- > $(@:.d=.h).newt; \
- if grep SYS_O32_ $(@:.d=.h).newt > /dev/null; then \
+ rm -f $(@:.d=.h).new32 $(@:.d=.h).newn32 $(@:.d=.h).new64; \
+ $(call mips_list_syscalls,$<,n32,_N32) > $(@:.d=.h).newn32; \
+ if test -s $(@:.d=.h).newn32; then \
+ if grep open $(@:.d=.h).newn32 > /dev/null; then \
+ $(call mips_list_syscalls,$<,32,_O32) > $(@:.d=.h).new32; \
+ $(call mips_list_syscalls,$<,64,) > $(@:.d=.h).new64; \
+ else \
+ $(call mips_list_syscalls,$<,32,) > $(@:.d=.h).new32; \
+ $(call mips_list_syscalls,$<,n32,) > $(@:.d=.h).newn32; \
+ $(call mips_list_syscalls,$<,64,) > $(@:.d=.h).new64; \
+ fi; \
echo '#if _MIPS_SIM == _ABIN32'; \
- sed -n 's/^\(#define SYS_\)N32_/\1/p' < $(@:.d=.h).newt | \
- LC_ALL=C sort; \
+ echo '# ifdef __NR_N32_open'; \
+ sed 's@\(.*\)@# define SYS_\1 __NR_N32_\1@' < $(@:.d=.h).newn32; \
+ echo '# else'; \
+ sed 's@\(.*\)@# define SYS_\1 __NR_\1@' < $(@:.d=.h).newn32; \
+ echo '# endif'; \
echo '#elif _MIPS_SIM == _ABI64'; \
- sed -n 's/^\(#define SYS_\)N64_/\1/p' < $(@:.d=.h).newt | \
- LC_ALL=C sort; \
+ sed 's@\(.*\)@# define SYS_\1 __NR_\1@' < $(@:.d=.h).new64; \
echo '#else'; \
- sed -n 's/^\(#define SYS_\)O32_/\1/p' < $(@:.d=.h).newt | \
- LC_ALL=C sort; \
+ echo '# ifdef __NR_O32_open'; \
+ sed 's@\(.*\)@# define SYS_\1 __NR_O32_\1@' < $(@:.d=.h).new32; \
+ echo '# else'; \
+ sed 's@\(.*\)@# define SYS_\1 __NR_\1@' < $(@:.d=.h).new32; \
+ echo '# endif'; \
echo '#endif'; \
- sed -n '/^#define SYS_\([ON]32\|N64\)_/p' < $(@:.d=.h).newt | \
- LC_ALL=C sort +1.8; \
else \
- cat $(@:.d=.h).newt; \
+ $(CC) -E -x c $(+includes) $(sysincludes) -D_LIBC -dM $< | \
+ sed -n 's@^\#define __NR_\([^ ]*\) .*@\#define SYS_\1 __NR_\1@p' | \
+ LC_ALL=C sort; \
fi; \
- rm $(@:.d=.h).newt; \
+ rm -f $(@:.d=.h).new32 $(@:.d=.h).newn32 $(@:.d=.h).new64; \
} > $(@:.d=.h).new
mv -f $(@:.d=.h).new $(@:.d=.h)
ifneq (,$(objpfx))
diff --git a/sysdeps/unix/sysv/linux/mips/configure b/sysdeps/unix/sysv/linux/mips/configure
index c081795aa1..4d9568f001 100755
--- a/sysdeps/unix/sysv/linux/mips/configure
+++ b/sysdeps/unix/sysv/linux/mips/configure
@@ -18,7 +18,7 @@ mips*64*)
{ echo "$as_me:$LINENO: WARNING: *** asm/unistd.h not found, it will not be pre-processed" >&5
echo "$as_me: WARNING: *** asm/unistd.h not found, it will not be pre-processed" >&2;}
echo '#include <asm/unistd.h>' > asm-unistd.h
- else
+ elif grep __NR_N32_open "$asm_unistd_h" > /dev/null; then
# The point of this preprocessing is to turn __NR_<syscall> into
# __NR_N64_<syscall>, as well as to define __NR_<syscall> to
# __NR_<abi>_<syscall>, if __NR_<abi>_<syscall> is defined
@@ -68,6 +68,8 @@ BEGIN { print "#include <sgidefs.h>"; }
{
print;
}'
+ else
+ echo '#include <asm/unistd.h>' > asm-unistd.h
fi ;;
mips*)
rm -f asm-unistd.h
diff --git a/sysdeps/unix/sysv/linux/mips/configure.in b/sysdeps/unix/sysv/linux/mips/configure.in
index 67d965dfda..e2e5d16c55 100644
--- a/sysdeps/unix/sysv/linux/mips/configure.in
+++ b/sysdeps/unix/sysv/linux/mips/configure.in
@@ -18,7 +18,7 @@ mips*64*)
if test ! -f "$asm_unistd_h"; then
AC_MSG_WARN([*** asm/unistd.h not found, it will not be pre-processed])
echo '#include <asm/unistd.h>' > asm-unistd.h
- else
+ elif grep __NR_N32_open "$asm_unistd_h" > /dev/null; then
# The point of this preprocessing is to turn __NR_<syscall> into
# __NR_N64_<syscall>, as well as to define __NR_<syscall> to
# __NR_<abi>_<syscall>, if __NR_<abi>_<syscall> is defined
@@ -68,6 +68,8 @@ BEGIN { print "#include <sgidefs.h>"; }
{
print;
}'
+ else
+ echo '#include <asm/unistd.h>' > asm-unistd.h
fi ;;
mips*)
rm -f asm-unistd.h
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/kern64/sysdep.h b/sysdeps/unix/sysv/linux/mips/mips32/kern64/sysdep.h
index b0316b657b..e69de29bb2 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/kern64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/mips/mips32/kern64/sysdep.h
@@ -1,36 +0,0 @@
-/* Copyright (C) 2000, 2002, 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. */
-
-#ifndef _LINUX_MIPS_MIPS32_KERN64_SYSDEP_H
-#define _LINUX_MIPS_MIPS32_KERN64_SYSDEP_H 1
-
-/* There is some commonality. */
-#include <sysdeps/unix/sysv/linux/mips/mips32/sysdep.h>
-
-/* For Linux we can use the system call table in the header file
- /usr/include/asm/unistd.h
- of the kernel. But these symbols do not follow the SYS_* syntax
- so we have to redefine the `SYS_ify' macro here. */
-#undef SYS_ify
-#ifdef __STDC__
-# define SYS_ify(syscall_name) __NR_O32_##syscall_name
-#else
-# define SYS_ify(syscall_name) __NR_O32_/**/syscall_name
-#endif
-
-#endif /* linux/mips/mips32/kern64/sysdep.h */
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h b/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h
index be343aabca..e316ef44ce 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h
@@ -28,9 +28,9 @@
so we have to redefine the `SYS_ify' macro here. */
#undef SYS_ify
#ifdef __STDC__
-# define SYS_ify(syscall_name) __NR_N32_##syscall_name
+# define SYS_ify(syscall_name) __NR_##syscall_name
#else
-# define SYS_ify(syscall_name) __NR_N32_/**/syscall_name
+# define SYS_ify(syscall_name) __NR_/**/syscall_name
#endif
#ifdef __ASSEMBLER__
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h b/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h
index f30a465081..824a92752b 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h
@@ -28,9 +28,9 @@
so we have to redefine the `SYS_ify' macro here. */
#undef SYS_ify
#ifdef __STDC__
-# define SYS_ify(syscall_name) __NR_N64_##syscall_name
+# define SYS_ify(syscall_name) __NR_##syscall_name
#else
-# define SYS_ify(syscall_name) __NR_N64_/**/syscall_name
+# define SYS_ify(syscall_name) __NR_/**/syscall_name
#endif
#ifdef __ASSEMBLER__