You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

1044 lines
37 KiB

# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: package/.../glibc/glibc-ports-2.5-mips-fixes.patch
# Copyright (C) 2008 The OpenSDE Project
#
# More information can be found in the files COPYING and README.
#
# This patch file is dual-licensed. It is available under the license the
# patched project is licensed under, as long as it is an OpenSource license
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
# of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
# --- SDE-COPYRIGHT-NOTE-END ---
From ccf9e0913a871453068a6ff573bd453970ec9505 Mon Sep 17 00:00:00 2001
From: drow <drow>
Date: Fri, 5 Jan 2007 02:21:53 +0000
Subject: * sysdeps/unix/sysv/linux/mips/bits/msq.h (struct msqid_ds): Update
to match the kernel.
diff --git ./ports/ChangeLog.mips ./ports/ChangeLog.mips
index 0c9fb72..b1a467c 100644
--- ./ports/ChangeLog.mips
+++ ./ports/ChangeLog.mips
@@ -1,3 +1,8 @@
+2007-01-04 Thiemo Seufer <ths@networkno.de>
+
+ * sysdeps/unix/sysv/linux/mips/bits/msq.h (struct msqid_ds): Update
+ to match the kernel.
+
2006-09-22 Richard Sandiford <richard@codesourcery.com>
* sysdeps/unix/sysv/linux/mips/xstatconv.c: Remove STAT_IS_KERNEL_STAT
diff --git ./ports/sysdeps/unix/sysv/linux/mips/bits/msq.h ./ports/sysdeps/unix/sysv/linux/mips/bits/msq.h
index c2c1dd2..5d72fc1 100644
--- ./ports/sysdeps/unix/sysv/linux/mips/bits/msq.h
+++ ./ports/sysdeps/unix/sysv/linux/mips/bits/msq.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2007 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
@@ -38,16 +38,34 @@ typedef unsigned long int msglen_t;
struct msqid_ds
{
struct ipc_perm msg_perm; /* structure describing operation permission */
+#if __WORDSIZE == 32 && defined (__MIPSEB__)
+ unsigned long int __unused1;
+#endif
__time_t msg_stime; /* time of last msgsnd command */
+#if __WORDSIZE == 32 && defined (__MIPSEL__)
+ unsigned long int __unused1;
+#endif
+#if __WORDSIZE == 32 && defined (__MIPSEB__)
+ unsigned long int __unused2;
+#endif
__time_t msg_rtime; /* time of last msgrcv command */
+#if __WORDSIZE == 32 && defined (__MIPSEL__)
+ unsigned long int __unused2;
+#endif
+#if __WORDSIZE == 32 && defined (__MIPSEB__)
+ unsigned long int __unused3;
+#endif
__time_t msg_ctime; /* time of last change */
+#if __WORDSIZE == 32 && defined (__MIPSEL__)
+ unsigned long int __unused3;
+#endif
unsigned long int __msg_cbytes; /* current number of bytes on queue */
msgqnum_t msg_qnum; /* number of messages currently on queue */
msglen_t msg_qbytes; /* max number of bytes allowed on queue */
__pid_t msg_lspid; /* pid of last msgsnd() */
__pid_t msg_lrpid; /* pid of last msgrcv() */
- unsigned long int __unused1;
- unsigned long int __unused2;
+ unsigned long int __unused4;
+ unsigned long int __unused5;
};
#ifdef __USE_MISC
--
1.5.4
From cc672d9c71bb67e460040eea7aa6993f8d70a28c Mon Sep 17 00:00:00 2001
From: drow <drow>
Date: Wed, 23 May 2007 17:26:13 +0000
Subject: * sysdeps/unix/sysv/linux/mips/mips32/posix_fadvise.c: New file.
* sysdeps/unix/sysv/linux/mips/mips32/posix_fadvise64.c: New file.
* sysdeps/unix/sysv/linux/mips/mips32/readahead.c: New file.
* sysdeps/unix/sysv/linux/mips/mips32/sync_file_range.c: New file.
* sysdeps/unix/sysv/linux/mips/mips64/n32/posix_fadvise64.c: New file.
* sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list: New file.
diff --git ./ports/ChangeLog.mips ./ports/ChangeLog.mips
index b1a467c..35625d6 100644
--- ./ports/ChangeLog.mips
+++ ./ports/ChangeLog.mips
@@ -1,3 +1,12 @@
+2007-05-23 Atsushi Nemoto <anemo@mba.ocn.ne.jp>
+
+ * sysdeps/unix/sysv/linux/mips/mips32/posix_fadvise.c: New file.
+ * sysdeps/unix/sysv/linux/mips/mips32/posix_fadvise64.c: New file.
+ * sysdeps/unix/sysv/linux/mips/mips32/readahead.c: New file.
+ * sysdeps/unix/sysv/linux/mips/mips32/sync_file_range.c: New file.
+ * sysdeps/unix/sysv/linux/mips/mips64/n32/posix_fadvise64.c: New file.
+ * sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list: New file.
+
2007-01-04 Thiemo Seufer <ths@networkno.de>
* sysdeps/unix/sysv/linux/mips/bits/msq.h (struct msqid_ds): Update
diff --git ./ports/sysdeps/unix/sysv/linux/mips/mips32/posix_fadvise.c ./ports/sysdeps/unix/sysv/linux/mips/mips32/posix_fadvise.c
new file mode 100644
index 0000000..24cbdf2
--- /dev/null
+++ ./ports/sysdeps/unix/sysv/linux/mips/mips32/posix_fadvise.c
@@ -0,0 +1,42 @@
+/* Copyright (C) 2007 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 <errno.h>
+#include <fcntl.h>
+#include <sysdep.h>
+
+/* Advice the system about the expected behaviour of the application with
+ respect to the file associated with FD. */
+
+int
+posix_fadvise (int fd, off_t offset, off_t len, int advise)
+{
+/* MIPS kernel only has NR_fadvise64 which acts as NR_fadvise64_64 */
+#ifdef __NR_fadvise64
+ INTERNAL_SYSCALL_DECL (err);
+ int ret = INTERNAL_SYSCALL (fadvise64, err, 7, fd, 0,
+ __LONG_LONG_PAIR (offset >> 31, offset),
+ __LONG_LONG_PAIR (offset >> 31, len),
+ advise);
+ if (INTERNAL_SYSCALL_ERROR_P (ret, err))
+ return INTERNAL_SYSCALL_ERRNO (ret, err);
+ return 0;
+#else
+ return ENOSYS;
+#endif
+}
diff --git ./ports/sysdeps/unix/sysv/linux/mips/mips32/posix_fadvise64.c ./ports/sysdeps/unix/sysv/linux/mips/mips32/posix_fadvise64.c
new file mode 100644
index 0000000..715d37e
--- /dev/null
+++ ./ports/sysdeps/unix/sysv/linux/mips/mips32/posix_fadvise64.c
@@ -0,0 +1,61 @@
+/* Copyright (C) 2007 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 <errno.h>
+#include <fcntl.h>
+#include <sysdep.h>
+
+/* Advice the system about the expected behaviour of the application with
+ respect to the file associated with FD. */
+
+int
+__posix_fadvise64_l64 (int fd, off64_t offset, off64_t len, int advise)
+{
+/* MIPS kernel only has NR_fadvise64 which acts as NR_fadvise64_64 */
+#ifdef __NR_fadvise64
+ INTERNAL_SYSCALL_DECL (err);
+ int ret = INTERNAL_SYSCALL (fadvise64, err, 7, fd, 0,
+ __LONG_LONG_PAIR ((long) (offset >> 32),
+ (long) offset),
+ __LONG_LONG_PAIR ((long) (len >> 32),
+ (long) len),
+ advise);
+ if (INTERNAL_SYSCALL_ERROR_P (ret, err))
+ return INTERNAL_SYSCALL_ERRNO (ret, err);
+ return 0;
+#else
+ return ENOSYS;
+#endif
+}
+
+#include <shlib-compat.h>
+
+#if SHLIB_COMPAT(libc, GLIBC_2_2, GLIBC_2_3_3)
+
+int
+attribute_compat_text_section
+__posix_fadvise64_l32 (int fd, off64_t offset, size_t len, int advise)
+{
+ return __posix_fadvise64_l64 (fd, offset, len, advise);
+}
+
+versioned_symbol (libc, __posix_fadvise64_l64, posix_fadvise64, GLIBC_2_3_3);
+compat_symbol (libc, __posix_fadvise64_l32, posix_fadvise64, GLIBC_2_2);
+#else
+strong_alias (__posix_fadvise64_l64, posix_fadvise64);
+#endif
diff --git ./ports/sysdeps/unix/sysv/linux/mips/mips32/readahead.c ./ports/sysdeps/unix/sysv/linux/mips/mips32/readahead.c
new file mode 100644
index 0000000..b5b967c
--- /dev/null
+++ ./ports/sysdeps/unix/sysv/linux/mips/mips32/readahead.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/arm/eabi/readahead.c>
diff --git ./ports/sysdeps/unix/sysv/linux/mips/mips32/sync_file_range.c ./ports/sysdeps/unix/sysv/linux/mips/mips32/sync_file_range.c
new file mode 100644
index 0000000..13a21b0
--- /dev/null
+++ ./ports/sysdeps/unix/sysv/linux/mips/mips32/sync_file_range.c
@@ -0,0 +1,47 @@
+/* Selective file content synch'ing.
+ Copyright (C) 2006, 2007 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 <errno.h>
+#include <fcntl.h>
+#include <sys/types.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+
+
+#ifdef __NR_sync_file_range
+int
+sync_file_range (int fd, __off64_t from, __off64_t to, unsigned int flags)
+{
+ return INLINE_SYSCALL (sync_file_range, 7, fd, 0,
+ __LONG_LONG_PAIR ((long) (from >> 32), (long) from),
+ __LONG_LONG_PAIR ((long) (to >> 32), (long) to),
+ flags);
+}
+#else
+int
+sync_file_range (int fd, __off64_t from, __off64_t to, unsigned int flags)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (sync_file_range)
+
+# include <stub-tag.h>
+#endif
diff --git ./ports/sysdeps/unix/sysv/linux/mips/mips64/n32/posix_fadvise64.c ./ports/sysdeps/unix/sysv/linux/mips/mips64/n32/posix_fadvise64.c
new file mode 100644
index 0000000..40bafdb
--- /dev/null
+++ ./ports/sysdeps/unix/sysv/linux/mips/mips64/n32/posix_fadvise64.c
@@ -0,0 +1,56 @@
+/* Copyright (C) 2007 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 <errno.h>
+#include <fcntl.h>
+#include <sysdep.h>
+
+/* Advice the system about the expected behaviour of the application with
+ respect to the file associated with FD. */
+
+int
+__posix_fadvise64_l64 (int fd, off64_t offset, off64_t len, int advise)
+{
+/* MIPS kernel only has NR_fadvise64 which acts as NR_fadvise64_64 */
+#ifdef __NR_fadvise64
+ INTERNAL_SYSCALL_DECL (err);
+ int ret = INTERNAL_SYSCALL (fadvise64, err, 4, fd, offset, len, advise);
+ if (INTERNAL_SYSCALL_ERROR_P (ret, err))
+ return INTERNAL_SYSCALL_ERRNO (ret, err);
+ return 0;
+#else
+ return ENOSYS;
+#endif
+}
+
+#include <shlib-compat.h>
+
+#if SHLIB_COMPAT(libc, GLIBC_2_2, GLIBC_2_3_3)
+
+int
+attribute_compat_text_section
+__posix_fadvise64_l32 (int fd, off64_t offset, size_t len, int advise)
+{
+ return __posix_fadvise64_l64 (fd, offset, len, advise);
+}
+
+versioned_symbol (libc, __posix_fadvise64_l64, posix_fadvise64, GLIBC_2_3_3);
+compat_symbol (libc, __posix_fadvise64_l32, posix_fadvise64, GLIBC_2_2);
+#else
+strong_alias (__posix_fadvise64_l64, posix_fadvise64);
+#endif
diff --git ./ports/sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list ./ports/sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list
new file mode 100644
index 0000000..babdba0
--- /dev/null
+++ ./ports/sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list
@@ -0,0 +1,5 @@
+# File name Caller Syscall name # args Strong name Weak names
+
+readahead - readahead i:iii __readahead readahead
+sync_file_range - sync_file_range i:iiii sync_file_range
+posix_fadvise - fadvise64 i:iiii posix_fadvise
--
1.5.4
From 942056a554fecb97e43a61f7365778e5988c416d Mon Sep 17 00:00:00 2001
From: drow <drow>
Date: Thu, 24 May 2007 16:18:26 +0000
Subject: * sysdeps/unix/sysv/linux/mips/mips32/posix_fadvise.c
(posix_fadvise): Fix high word of len argument.
diff --git ./ports/ChangeLog.mips ./ports/ChangeLog.mips
index 35625d6..bb948fb 100644
--- ./ports/ChangeLog.mips
+++ ./ports/ChangeLog.mips
@@ -1,3 +1,8 @@
+2007-05-24 Atsushi Nemoto <anemo@mba.ocn.ne.jp>
+
+ * sysdeps/unix/sysv/linux/mips/mips32/posix_fadvise.c
+ (posix_fadvise): Fix high word of len argument.
+
2007-05-23 Atsushi Nemoto <anemo@mba.ocn.ne.jp>
* sysdeps/unix/sysv/linux/mips/mips32/posix_fadvise.c: New file.
diff --git ./ports/sysdeps/unix/sysv/linux/mips/mips32/posix_fadvise.c ./ports/sysdeps/unix/sysv/linux/mips/mips32/posix_fadvise.c
index 24cbdf2..04c952d 100644
--- ./ports/sysdeps/unix/sysv/linux/mips/mips32/posix_fadvise.c
+++ ./ports/sysdeps/unix/sysv/linux/mips/mips32/posix_fadvise.c
@@ -31,7 +31,7 @@ posix_fadvise (int fd, off_t offset, off_t len, int advise)
INTERNAL_SYSCALL_DECL (err);
int ret = INTERNAL_SYSCALL (fadvise64, err, 7, fd, 0,
__LONG_LONG_PAIR (offset >> 31, offset),
- __LONG_LONG_PAIR (offset >> 31, len),
+ __LONG_LONG_PAIR (len >> 31, len),
advise);
if (INTERNAL_SYSCALL_ERROR_P (ret, err))
return INTERNAL_SYSCALL_ERRNO (ret, err);
--
1.5.4
From f80a647712310900077e32169687869c0d8c259b Mon Sep 17 00:00:00 2001
From: drow <drow>
Date: Mon, 6 Aug 2007 17:55:35 +0000
Subject: Backport gscope changes to the 2.6 branch, from Aurelien Jarno.
diff --git ./ports/ChangeLog.mips ./ports/ChangeLog.mips
index bb948fb..c714cc6 100644
--- ./ports/ChangeLog.mips
+++ ./ports/ChangeLog.mips
@@ -1,3 +1,12 @@
+2007-08-06 Aurelien Jarno <aurelien@aurel32.net>
+
+ Backport:
+ 2007-06-06 Daniel Jacobowitz <dan@codesourcery.com>
+ * sysdeps/mips/nptl/tls.h (THREAD_GSCOPE_FLAG_UNUSED,
+ THREAD_GSCOPE_FLAG_USED, THREAD_GSCOPE_FLAG_WAIT): Define.
+ (THREAD_GSCOPE_RESET_FLAG, THREAD_GSCOPE_SET_FLAG,
+ THREAD_GSCOPE_WAIT): Define.
+
2007-05-24 Atsushi Nemoto <anemo@mba.ocn.ne.jp>
* sysdeps/unix/sysv/linux/mips/mips32/posix_fadvise.c
diff --git ./ports/sysdeps/mips/nptl/tls.h ./ports/sysdeps/mips/nptl/tls.h
index 1cef161..dbe806a 100644
--- ./ports/sysdeps/mips/nptl/tls.h
+++ ./ports/sysdeps/mips/nptl/tls.h
@@ -1,5 +1,5 @@
/* Definition for thread-local data handling. NPTL/MIPS version.
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2007 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
@@ -156,6 +156,29 @@ typedef struct
different value to mean unset l_tls_offset. */
# define NO_TLS_OFFSET -1
+/* Get and set the global scope generation counter in struct pthread. */
+#define THREAD_GSCOPE_FLAG_UNUSED 0
+#define THREAD_GSCOPE_FLAG_USED 1
+#define THREAD_GSCOPE_FLAG_WAIT 2
+#define THREAD_GSCOPE_RESET_FLAG() \
+ do \
+ { int __res \
+ = atomic_exchange_rel (&THREAD_SELF->header.gscope_flag, \
+ THREAD_GSCOPE_FLAG_UNUSED); \
+ if (__res == THREAD_GSCOPE_FLAG_WAIT) \
+ lll_futex_wake (&THREAD_SELF->header.gscope_flag, 1); \
+ } \
+ while (0)
+#define THREAD_GSCOPE_SET_FLAG() \
+ do \
+ { \
+ THREAD_SELF->header.gscope_flag = THREAD_GSCOPE_FLAG_USED; \
+ atomic_write_barrier (); \
+ } \
+ while (0)
+#define THREAD_GSCOPE_WAIT() \
+ GL(dl_wait_lookup_done) ()
+
#endif /* __ASSEMBLER__ */
#endif /* tls.h */
--
1.5.4
From 1bbbb61befa71f4d75715029692309f0c8259cab Mon Sep 17 00:00:00 2001
From: drow <drow>
Date: Tue, 31 Oct 2006 17:39:13 +0000
Subject: * sysdeps/unix/sysv/linux/mips/nptl/sysdep-cancel.h
(RTLD_SINGLE_THREAD_P): Define.
* sysdeps/unix/sysv/linux/mips/mips64/nptl/sysdep-cancel.h: Likewise.
diff --git ./ports/ChangeLog.mips ./ports/ChangeLog.mips
index c714cc6..1630a24 100644
--- ./ports/ChangeLog.mips
+++ ./ports/ChangeLog.mips
@@ -37,6 +37,12 @@
* sysdeps/unix/sysv/linux/mips/mips32/fxstatat.c: New file.
* sysdeps/unix/sysv/linux/mips/mips64/fxstatat64.c: Likewise.
+2006-10-31 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * sysdeps/unix/sysv/linux/mips/nptl/sysdep-cancel.h
+ (RTLD_SINGLE_THREAD_P): Define.
+ * sysdeps/unix/sysv/linux/mips/mips64/nptl/sysdep-cancel.h: Likewise.
+
2006-09-21 Joseph Myers <joseph@codesourcery.com>
* sysdeps/mips/fpu_control.h: If soft-float, don't use
diff --git ./ports/sysdeps/unix/sysv/linux/mips/mips64/nptl/sysdep-cancel.h ./ports/sysdeps/unix/sysv/linux/mips/mips64/nptl/sysdep-cancel.h
index e184c91..7e9d4bf 100644
--- ./ports/sysdeps/unix/sysv/linux/mips/mips64/nptl/sysdep-cancel.h
+++ ./ports/sysdeps/unix/sysv/linux/mips/mips64/nptl/sysdep-cancel.h
@@ -181,3 +181,9 @@
# define NO_CANCELLATION 1
#endif
+
+#ifndef __ASSEMBLER__
+# define RTLD_SINGLE_THREAD_P \
+ __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
+ header.multiple_threads) == 0, 1)
+#endif
diff --git ./ports/sysdeps/unix/sysv/linux/mips/nptl/sysdep-cancel.h ./ports/sysdeps/unix/sysv/linux/mips/nptl/sysdep-cancel.h
index 02508e2..f2bf2d7 100644
--- ./ports/sysdeps/unix/sysv/linux/mips/nptl/sysdep-cancel.h
+++ ./ports/sysdeps/unix/sysv/linux/mips/nptl/sysdep-cancel.h
@@ -168,3 +168,9 @@
# define NO_CANCELLATION 1
#endif
+
+#ifndef __ASSEMBLER__
+# define RTLD_SINGLE_THREAD_P \
+ __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
+ header.multiple_threads) == 0, 1)
+#endif
--
1.5.4
From f9cdb98e8124401d512223526c342fd7c5a19f87 Mon Sep 17 00:00:00 2001
From: drow <drow>
Date: Mon, 8 Jan 2007 15:26:51 +0000
Subject: * sysdeps/mips/ldsodefs.h: Merge sysdeps/mips/elf/ldsodefs.h. Correct
multiple inclusion guard.
* sysdeps/mips/elf/ldsodefs.h: Delete file.
diff --git ./ports/ChangeLog.mips ./ports/ChangeLog.mips
index 1630a24..fe30b4c 100644
--- ./ports/ChangeLog.mips
+++ ./ports/ChangeLog.mips
@@ -21,6 +21,12 @@
* sysdeps/unix/sysv/linux/mips/mips64/n32/posix_fadvise64.c: New file.
* sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list: New file.
+2007-01-08 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * sysdeps/mips/ldsodefs.h: Merge sysdeps/mips/elf/ldsodefs.h. Correct
+ multiple inclusion guard.
+ * sysdeps/mips/elf/ldsodefs.h: Delete file.
+
2007-01-04 Thiemo Seufer <ths@networkno.de>
* sysdeps/unix/sysv/linux/mips/bits/msq.h (struct msqid_ds): Update
diff --git ./ports/sysdeps/mips/elf/ldsodefs.h ./ports/sysdeps/mips/elf/ldsodefs.h
deleted file mode 100644
index 3868b50..0000000
--- ./ports/sysdeps/mips/elf/ldsodefs.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/* Run-time dynamic linker data structures for loaded ELF shared objects.
- 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 _MIPS_LDSODEFS_H
-#define _MIPS_LDSODEFS_H
-
-/* The MIPS ABI specifies that the dynamic section has to be read-only. */
-
-#define DL_RO_DYN_SECTION 1
-
-#include_next <ldsodefs.h>
-
-/* The 64-bit MIPS ELF ABI uses an unusual reloc format. Each
- relocation entry specifies up to three actual relocations, all at
- the same address. The first relocation which required a symbol
- uses the symbol in the r_sym field. The second relocation which
- requires a symbol uses the symbol in the r_ssym field. If all
- three relocations require a symbol, the third one uses a zero
- value.
-
- We define these structures in internal headers because we're not
- sure we want to make them part of the ABI yet. Eventually, some of
- this may move into elf/elf.h. */
-
-/* An entry in a 64 bit SHT_REL section. */
-
-typedef struct
-{
- Elf32_Word r_sym; /* Symbol index */
- unsigned char r_ssym; /* Special symbol for 2nd relocation */
- unsigned char r_type3; /* 3rd relocation type */
- unsigned char r_type2; /* 2nd relocation type */
- unsigned char r_type1; /* 1st relocation type */
-} _Elf64_Mips_R_Info;
-
-typedef union
-{
- Elf64_Xword r_info_number;
- _Elf64_Mips_R_Info r_info_fields;
-} _Elf64_Mips_R_Info_union;
-
-typedef struct
-{
- Elf64_Addr r_offset; /* Address */
- _Elf64_Mips_R_Info_union r_info; /* Relocation type and symbol index */
-} Elf64_Mips_Rel;
-
-typedef struct
-{
- Elf64_Addr r_offset; /* Address */
- _Elf64_Mips_R_Info_union r_info; /* Relocation type and symbol index */
- Elf64_Sxword r_addend; /* Addend */
-} Elf64_Mips_Rela;
-
-#define ELF64_MIPS_R_SYM(i) \
- ((__extension__ (_Elf64_Mips_R_Info_union)(i)).r_info_fields.r_sym)
-#define ELF64_MIPS_R_TYPE(i) \
- (((_Elf64_Mips_R_Info_union)(i)).r_info_fields.r_type1 \
- | ((Elf32_Word)(__extension__ (_Elf64_Mips_R_Info_union)(i) \
- ).r_info_fields.r_type2 << 8) \
- | ((Elf32_Word)(__extension__ (_Elf64_Mips_R_Info_union)(i) \
- ).r_info_fields.r_type3 << 16) \
- | ((Elf32_Word)(__extension__ (_Elf64_Mips_R_Info_union)(i) \
- ).r_info_fields.r_ssym << 24))
-#define ELF64_MIPS_R_INFO(sym, type) \
- (__extension__ (_Elf64_Mips_R_Info_union) \
- (__extension__ (_Elf64_Mips_R_Info) \
- { (sym), ELF64_MIPS_R_SSYM (type), \
- ELF64_MIPS_R_TYPE3 (type), \
- ELF64_MIPS_R_TYPE2 (type), \
- ELF64_MIPS_R_TYPE1 (type) \
- }).r_info_number)
-/* These macros decompose the value returned by ELF64_MIPS_R_TYPE, and
- compose it back into a value that it can be used as an argument to
- ELF64_MIPS_R_INFO. */
-#define ELF64_MIPS_R_SSYM(i) (((i) >> 24) & 0xff)
-#define ELF64_MIPS_R_TYPE3(i) (((i) >> 16) & 0xff)
-#define ELF64_MIPS_R_TYPE2(i) (((i) >> 8) & 0xff)
-#define ELF64_MIPS_R_TYPE1(i) ((i) & 0xff)
-#define ELF64_MIPS_R_TYPEENC(type1, type2, type3, ssym) \
- ((type1) \
- | ((Elf32_Word)(type2) << 8) \
- | ((Elf32_Word)(type3) << 16) \
- | ((Elf32_Word)(ssym) << 24))
-
-#undef ELF64_R_SYM
-#define ELF64_R_SYM(i) ELF64_MIPS_R_SYM (i)
-#undef ELF64_R_TYPE
-#define ELF64_R_TYPE(i) ELF64_MIPS_R_TYPE (i)
-#undef ELF64_R_INFO
-#define ELF64_R_INFO(sym, type) ELF64_MIPS_R_INFO ((sym), (type))
-
-#endif
diff --git ./ports/sysdeps/mips/ldsodefs.h ./ports/sysdeps/mips/ldsodefs.h
index 876f1c3..5f85eef 100644
--- ./ports/sysdeps/mips/ldsodefs.h
+++ ./ports/sysdeps/mips/ldsodefs.h
@@ -1,5 +1,5 @@
/* Run-time dynamic linker data structures for loaded ELF shared objects.
- Copyright (C) 2006 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2002, 2003, 2006, 2007 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
@@ -17,7 +17,7 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#ifndef __LDSODEFS_H \
+#ifndef _MIPS_LDSODEFS_H
#define _MIPS_LDSODEFS_H 1
#include <elf.h>
@@ -61,6 +61,90 @@ struct La_mips_64_retval;
struct La_mips_64_retval *, \
const char *);
+/* The MIPS ABI specifies that the dynamic section has to be read-only. */
+
+#define DL_RO_DYN_SECTION 1
+
#include_next <ldsodefs.h>
+/* The 64-bit MIPS ELF ABI uses an unusual reloc format. Each
+ relocation entry specifies up to three actual relocations, all at
+ the same address. The first relocation which required a symbol
+ uses the symbol in the r_sym field. The second relocation which
+ requires a symbol uses the symbol in the r_ssym field. If all
+ three relocations require a symbol, the third one uses a zero
+ value.
+
+ We define these structures in internal headers because we're not
+ sure we want to make them part of the ABI yet. Eventually, some of
+ this may move into elf/elf.h. */
+
+/* An entry in a 64 bit SHT_REL section. */
+
+typedef struct
+{
+ Elf32_Word r_sym; /* Symbol index */
+ unsigned char r_ssym; /* Special symbol for 2nd relocation */
+ unsigned char r_type3; /* 3rd relocation type */
+ unsigned char r_type2; /* 2nd relocation type */
+ unsigned char r_type1; /* 1st relocation type */
+} _Elf64_Mips_R_Info;
+
+typedef union
+{
+ Elf64_Xword r_info_number;
+ _Elf64_Mips_R_Info r_info_fields;
+} _Elf64_Mips_R_Info_union;
+
+typedef struct
+{
+ Elf64_Addr r_offset; /* Address */
+ _Elf64_Mips_R_Info_union r_info; /* Relocation type and symbol index */
+} Elf64_Mips_Rel;
+
+typedef struct
+{
+ Elf64_Addr r_offset; /* Address */
+ _Elf64_Mips_R_Info_union r_info; /* Relocation type and symbol index */
+ Elf64_Sxword r_addend; /* Addend */
+} Elf64_Mips_Rela;
+
+#define ELF64_MIPS_R_SYM(i) \
+ ((__extension__ (_Elf64_Mips_R_Info_union)(i)).r_info_fields.r_sym)
+#define ELF64_MIPS_R_TYPE(i) \
+ (((_Elf64_Mips_R_Info_union)(i)).r_info_fields.r_type1 \
+ | ((Elf32_Word)(__extension__ (_Elf64_Mips_R_Info_union)(i) \
+ ).r_info_fields.r_type2 << 8) \
+ | ((Elf32_Word)(__extension__ (_Elf64_Mips_R_Info_union)(i) \
+ ).r_info_fields.r_type3 << 16) \
+ | ((Elf32_Word)(__extension__ (_Elf64_Mips_R_Info_union)(i) \
+ ).r_info_fields.r_ssym << 24))
+#define ELF64_MIPS_R_INFO(sym, type) \
+ (__extension__ (_Elf64_Mips_R_Info_union) \
+ (__extension__ (_Elf64_Mips_R_Info) \
+ { (sym), ELF64_MIPS_R_SSYM (type), \
+ ELF64_MIPS_R_TYPE3 (type), \
+ ELF64_MIPS_R_TYPE2 (type), \
+ ELF64_MIPS_R_TYPE1 (type) \
+ }).r_info_number)
+/* These macros decompose the value returned by ELF64_MIPS_R_TYPE, and
+ compose it back into a value that it can be used as an argument to
+ ELF64_MIPS_R_INFO. */
+#define ELF64_MIPS_R_SSYM(i) (((i) >> 24) & 0xff)
+#define ELF64_MIPS_R_TYPE3(i) (((i) >> 16) & 0xff)
+#define ELF64_MIPS_R_TYPE2(i) (((i) >> 8) & 0xff)
+#define ELF64_MIPS_R_TYPE1(i) ((i) & 0xff)
+#define ELF64_MIPS_R_TYPEENC(type1, type2, type3, ssym) \
+ ((type1) \
+ | ((Elf32_Word)(type2) << 8) \
+ | ((Elf32_Word)(type3) << 16) \
+ | ((Elf32_Word)(ssym) << 24))
+
+#undef ELF64_R_SYM
+#define ELF64_R_SYM(i) ELF64_MIPS_R_SYM (i)
+#undef ELF64_R_TYPE
+#define ELF64_R_TYPE(i) ELF64_MIPS_R_TYPE (i)
+#undef ELF64_R_INFO
+#define ELF64_R_INFO(sym, type) ELF64_MIPS_R_INFO ((sym), (type))
+
#endif
--
1.5.4
From 0a75a520f00a5920c4889846a0e8137b7be7439d Mon Sep 17 00:00:00 2001
From: drow <drow>
Date: Mon, 8 Jan 2007 15:34:49 +0000
Subject: * sysdeps/mips/dl-machine.h (ELF_MACHINE_NO_RELA): Delete.
(elf_machine_reloc): New function, retaining the body of
elf_machine_rel. Take the reloc's r_info field as an argument,
not the reloc itself. Add extra r_addend and inplace_p arguments.
When inplace_p is false, use r_addend as the addend, not the contents
of the relocation field. Hoist the conversion of reloc_addr to
"ELFW(Addr) *". Don't try to apply TLS relocations against
undefined symbols. Add R_MIPS_GLOB_DAT support.
(elf_machine_rel, elf_machine_rela): Use elf_machine_reloc.
(elf_machine_lazy_rel): Change the reloc type from ElfW(Rel)
to ElfW(Rela).
diff --git ./ports/ChangeLog.mips ./ports/ChangeLog.mips
index fe30b4c..7330d95 100644
--- ./ports/ChangeLog.mips
+++ ./ports/ChangeLog.mips
@@ -21,6 +21,20 @@
* sysdeps/unix/sysv/linux/mips/mips64/n32/posix_fadvise64.c: New file.
* sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list: New file.
+2007-01-08 Richard Sandiford <richard@codesourcery.com>
+
+ * sysdeps/mips/dl-machine.h (ELF_MACHINE_NO_RELA): Delete.
+ (elf_machine_reloc): New function, retaining the body of
+ elf_machine_rel. Take the reloc's r_info field as an argument,
+ not the reloc itself. Add extra r_addend and inplace_p arguments.
+ When inplace_p is false, use r_addend as the addend, not the contents
+ of the relocation field. Hoist the conversion of reloc_addr to
+ "ELFW(Addr) *". Don't try to apply TLS relocations against
+ undefined symbols. Add R_MIPS_GLOB_DAT support.
+ (elf_machine_rel, elf_machine_rela): Use elf_machine_reloc.
+ (elf_machine_lazy_rel): Change the reloc type from ElfW(Rel)
+ to ElfW(Rela).
+
2007-01-08 Daniel Jacobowitz <dan@codesourcery.com>
* sysdeps/mips/ldsodefs.h: Merge sysdeps/mips/elf/ldsodefs.h. Correct
diff --git ./ports/sysdeps/mips/dl-machine.h ./ports/sysdeps/mips/dl-machine.h
index b912184..c92a1a3 100644
--- ./ports/sysdeps/mips/dl-machine.h
+++ ./ports/sysdeps/mips/dl-machine.h
@@ -1,5 +1,5 @@
/* Machine-dependent ELF dynamic relocation inline functions. MIPS version.
- Copyright (C) 1996-2001, 2002, 2003, 2004, 2005, 2006
+ Copyright (C) 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Kazumoto Kojima <kkojima@info.kanagawa-u.ac.jp>.
@@ -282,9 +282,6 @@ do { \
".previous"\
);
-/* The MIPS never uses Elfxx_Rela relocations. */
-#define ELF_MACHINE_NO_RELA 1
-
/* Names of the architecture-specific auditing callback functions. */
# if _MIPS_SIM == _ABIO32
# define ARCH_LA_PLTENTER mips_o32_gnu_pltenter
@@ -301,16 +298,18 @@ do { \
#ifdef RESOLVE_MAP
-/* Perform the relocation specified by RELOC and SYM (which is fully resolved).
+/* Perform a relocation described by R_INFO at the location pointed to
+ by RELOC_ADDR. SYM is the relocation symbol specified by R_INFO and
MAP is the object containing the reloc. */
auto inline void
__attribute__ ((always_inline))
-elf_machine_rel (struct link_map *map, const ElfW(Rel) *reloc,
- const ElfW(Sym) *sym, const struct r_found_version *version,
- void *const reloc_addr)
+elf_machine_reloc (struct link_map *map, ElfW(Word) r_info,
+ const ElfW(Sym) *sym, const struct r_found_version *version,
+ void *reloc_addr, ElfW(Addr) r_addend, int inplace_p)
{
- const unsigned long int r_type = ELFW(R_TYPE) (reloc->r_info);
+ const unsigned long int r_type = ELFW(R_TYPE) (r_info);
+ ElfW(Addr) *addr_field = (ElfW(Addr) *) reloc_addr;
#if !defined RTLD_BOOTSTRAP && !defined SHARED
/* This is defined in rtld.c, but nowhere in the static libc.a;
@@ -342,18 +341,28 @@ elf_machine_rel (struct link_map *map, const ElfW(Rel) *reloc,
case R_MIPS_TLS_DTPMOD64:
case R_MIPS_TLS_DTPMOD32:
if (sym_map)
- *(ElfW(Addr) *)reloc_addr = sym_map->l_tls_modid;
+ *addr_field = sym_map->l_tls_modid;
break;
case R_MIPS_TLS_DTPREL64:
case R_MIPS_TLS_DTPREL32:
- *(ElfW(Addr) *)reloc_addr += TLS_DTPREL_VALUE (sym);
+ if (sym)
+ {
+ if (inplace_p)
+ r_addend = *addr_field;
+ *addr_field = r_addend + TLS_DTPREL_VALUE (sym);
+ }
break;
case R_MIPS_TLS_TPREL32:
case R_MIPS_TLS_TPREL64:
- CHECK_STATIC_TLS (map, sym_map);
- *(ElfW(Addr) *)reloc_addr += TLS_TPREL_VALUE (sym_map, sym);
+ if (sym)
+ {
+ CHECK_STATIC_TLS (map, sym_map);
+ if (inplace_p)
+ r_addend = *addr_field;
+ *addr_field = r_addend + TLS_TPREL_VALUE (sym_map, sym);
+ }
break;
}
@@ -367,13 +376,14 @@ elf_machine_rel (struct link_map *map, const ElfW(Rel) *reloc,
case R_MIPS_REL32:
#endif
{
- int symidx = ELFW(R_SYM) (reloc->r_info);
+ int symidx = ELFW(R_SYM) (r_info);
ElfW(Addr) reloc_value;
- /* Support relocations on mis-aligned offsets. Should we ever
- implement RELA, this should be replaced with an assignment
- from reloc->r_addend. */
- __builtin_memcpy (&reloc_value, reloc_addr, sizeof (reloc_value));
+ if (inplace_p)
+ /* Support relocations on mis-aligned offsets. */
+ __builtin_memcpy (&reloc_value, reloc_addr, sizeof (reloc_value));
+ else
+ reloc_value = r_addend;
if (symidx)
{
@@ -424,6 +434,31 @@ elf_machine_rel (struct link_map *map, const ElfW(Rel) *reloc,
__builtin_memcpy (reloc_addr, &reloc_value, sizeof (reloc_value));
}
break;
+#ifndef RTLD_BOOTSTRAP
+#if _MIPS_SIM == _ABI64
+ case (R_MIPS_64 << 8) | R_MIPS_GLOB_DAT:
+#else
+ case R_MIPS_GLOB_DAT:
+#endif
+ {
+ int symidx = ELFW(R_SYM) (r_info);
+ const ElfW(Word) gotsym
+ = (const ElfW(Word)) map->l_info[DT_MIPS (GOTSYM)]->d_un.d_val;
+
+ if (__builtin_expect ((ElfW(Word)) symidx >= gotsym, 1))
+ {
+ const ElfW(Addr) *got
+ = (const ElfW(Addr) *) D_PTR (map, l_info[DT_PLTGOT]);
+ const ElfW(Word) local_gotno
+ = ((const ElfW(Word))
+ map->l_info[DT_MIPS (LOCAL_GOTNO)]->d_un.d_val);
+
+ ElfW(Addr) reloc_value = got[symidx + local_gotno - gotsym];
+ __builtin_memcpy (reloc_addr, &reloc_value, sizeof (reloc_value));
+ }
+ }
+ break;
+#endif
case R_MIPS_NONE: /* Alright, Wilbur. */
break;
#if _MIPS_SIM == _ABI64
@@ -436,7 +471,7 @@ elf_machine_rel (struct link_map *map, const ElfW(Rel) *reloc,
itself. For ABI compliance, we ignore such _64 dummy
relocations. For RELA, this may be simply removed, since
it's totally unnecessary. */
- if (ELFW(R_SYM) (reloc->r_info) == 0)
+ if (ELFW(R_SYM) (r_info) == 0)
break;
/* Fall through. */
#endif
@@ -446,6 +481,18 @@ elf_machine_rel (struct link_map *map, const ElfW(Rel) *reloc,
}
}
+/* Perform the relocation specified by RELOC and SYM (which is fully resolved).
+ MAP is the object containing the reloc. */
+
+auto inline void
+__attribute__ ((always_inline))
+elf_machine_rel (struct link_map *map, const ElfW(Rel) *reloc,
+ const ElfW(Sym) *sym, const struct r_found_version *version,
+ void *const reloc_addr)
+{
+ elf_machine_reloc (map, reloc->r_info, sym, version, reloc_addr, 0, 1);
+}
+
auto inline void
__attribute__((always_inline))
elf_machine_rel_relative (ElfW(Addr) l_addr, const ElfW(Rel) *reloc,
@@ -457,7 +504,7 @@ elf_machine_rel_relative (ElfW(Addr) l_addr, const ElfW(Rel) *reloc,
auto inline void
__attribute__((always_inline))
elf_machine_lazy_rel (struct link_map *map,
- ElfW(Addr) l_addr, const ElfW(Rel) *reloc)
+ ElfW(Addr) l_addr, const ElfW(Rela) *reloc)
{
/* Do nothing. */
}
@@ -468,6 +515,8 @@ elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc,
const ElfW(Sym) *sym, const struct r_found_version *version,
void *const reloc_addr)
{
+ elf_machine_reloc (map, reloc->r_info, sym, version, reloc_addr,
+ reloc->r_addend, 0);
}
auto inline void
--
1.5.4
From 8891d2661b515ec0720ab3e07c99979082826688 Mon Sep 17 00:00:00 2001
From: drow <drow>
Date: Wed, 23 May 2007 16:50:14 +0000
Subject: * sysdeps/mips/dl-machine.h (elf_machine_reloc): Change type of
r_info argument to ElfW(Addr).
diff --git ./ports/ChangeLog.mips ./ports/ChangeLog.mips
index 7330d95..f17432b 100644
--- ./ports/ChangeLog.mips
+++ ./ports/ChangeLog.mips
@@ -21,6 +21,11 @@
* sysdeps/unix/sysv/linux/mips/mips64/n32/posix_fadvise64.c: New file.
* sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list: New file.
+2007-02-27 Richard Sandiford <rsandifo@nildram.co.uk>
+
+ * sysdeps/mips/dl-machine.h (elf_machine_reloc): Change type of
+ r_info argument to ElfW(Addr).
+
2007-01-08 Richard Sandiford <richard@codesourcery.com>
* sysdeps/mips/dl-machine.h (ELF_MACHINE_NO_RELA): Delete.
diff --git ./ports/sysdeps/mips/dl-machine.h ./ports/sysdeps/mips/dl-machine.h
index c92a1a3..1b8d0f3 100644
--- ./ports/sysdeps/mips/dl-machine.h
+++ ./ports/sysdeps/mips/dl-machine.h
@@ -304,7 +304,7 @@ do { \
auto inline void
__attribute__ ((always_inline))
-elf_machine_reloc (struct link_map *map, ElfW(Word) r_info,
+elf_machine_reloc (struct link_map *map, ElfW(Addr) r_info,
const ElfW(Sym) *sym, const struct r_found_version *version,
void *reloc_addr, ElfW(Addr) r_addend, int inplace_p)
{
--
1.5.4