[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commits] r7815 - in /fsf/trunk/ports: ./ sysdeps/arm/ sysdeps/arm/elf/ sysdeps/unix/sysv/linux/arm/ sysdeps/unix/sysv/linux/arm/nptl/...



Author: eglibc
Date: Wed Jan 28 00:03:57 2009
New Revision: 7815

Log:
Import glibc-ports-mainline for 2009-01-28

Added:
    fsf/trunk/ports/sysdeps/unix/sysv/linux/mips/dl-static.c
    fsf/trunk/ports/sysdeps/unix/sysv/linux/mips/ldsodefs.h
Modified:
    fsf/trunk/ports/ChangeLog.arm
    fsf/trunk/ports/ChangeLog.mips
    fsf/trunk/ports/sysdeps/arm/elf/start.S
    fsf/trunk/ports/sysdeps/arm/memset.S
    fsf/trunk/ports/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h
    fsf/trunk/ports/sysdeps/unix/sysv/linux/arm/sysdep.h
    fsf/trunk/ports/sysdeps/unix/sysv/linux/mips/Makefile
    fsf/trunk/ports/sysdeps/unix/sysv/linux/mips/Versions

Modified: fsf/trunk/ports/ChangeLog.arm
==============================================================================
--- fsf/trunk/ports/ChangeLog.arm (original)
+++ fsf/trunk/ports/ChangeLog.arm Wed Jan 28 00:03:57 2009
@@ -1,3 +1,22 @@
+2009-01-27  Min Zhang  <mzhang@xxxxxxxxxx>
+
+	* sysdeps/arm/memset.S (memset): Use stm instead of two
+	str instructions.
+
+2009-01-27  Kirill A. Shutemov <kirill@xxxxxxxxxxxxx>
+
+	* sysdeps/arm/elf/start.S (_start): Use position-independent code
+	if SHARED.  Clear lr.
+
+2009-01-27  Ryosei Takagi  <ryosei@xxxxxxxxxxxxx>
+
+        * sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h
+	(lll_futex_wake_unlock, lll_futex_requeue): Return zero if success.
+
+2009-01-27  Daniel Jacobowitz  <dan@xxxxxxxxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/arm/sysdep.h: Include <tls.h>.
+
 2009-01-12  Mike Frysinger  <vapier@xxxxxxxxxx>
 
 	* sysdeps/arm/fpu/setjmp.S: Add hidden_def (__sigsetjmp).

Modified: fsf/trunk/ports/ChangeLog.mips
==============================================================================
--- fsf/trunk/ports/ChangeLog.mips (original)
+++ fsf/trunk/ports/ChangeLog.mips Wed Jan 28 00:03:57 2009
@@ -1,3 +1,13 @@
+2009-01-27  Maciej W. Rozycki  <macro@xxxxxxxxxxxxxx>
+	    Atsushi Nemoto  <anemo@xxxxxxxxxxxxx>
+
+	PR glibc/1048
+	* sysdeps/unix/sysv/linux/mips/dl-static.c: New file to support
+	variable page size for MIPS.
+	* sysdeps/unix/sysv/linux/mips/ldsodefs.h: Likewise.
+	* sysdeps/unix/sysv/linux/mips/Makefile: Build dl-static in elf.
+	* sysdeps/unix/sysv/linux/mips/Versions: Add _dl_var_init.
+
 2009-01-12  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
 
 	* sysdeps/unix/sysv/linux/mips/bits/resource.h (enum

Modified: fsf/trunk/ports/sysdeps/arm/elf/start.S
==============================================================================
--- fsf/trunk/ports/sysdeps/arm/elf/start.S (original)
+++ fsf/trunk/ports/sysdeps/arm/elf/start.S Wed Jan 28 00:03:57 2009
@@ -1,5 +1,5 @@
 /* Startup code for ARM & ELF
-   Copyright (C) 1995, 1996, 1997, 1998, 2001, 2002, 2005
+   Copyright (C) 1995, 1996, 1997, 1998, 2001, 2002, 2005, 2008
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -67,11 +67,9 @@
        /* Protect against unhandled exceptions.  */
        .fnstart
 #endif
-	/* Fetch address of fini */
-	ldr ip, =__libc_csu_fini
-
-	/* Clear the frame pointer since this is the outermost frame.  */
+	/* Clear the frame pointer and link register since this is the outermost frame. */
 	mov fp, #0
+	mov lr, #0
 
 	/* Pop argc off the stack and save a pointer to argv */
 	ldr a2, [sp], #4
@@ -83,20 +81,52 @@
 	/* Push rtld_fini */
 	str a1, [sp, #-4]!
 
+#ifdef SHARED
+	ldr sl, .L_GOT
+.L_GOT_OFF:
+	add sl, pc, sl
+
+	ldr ip, .L_GOT+4	/* __libc_csu_fini */
+	ldr ip, [sl, ip]
+
+	str ip, [sp, #-4]!	/* Push __libc_csu_fini */
+
+	ldr a4, .L_GOT+8	/* __libc_csu_init */
+	ldr a4, [sl, a4]
+
+	ldr a1, .L_GOT+12	/* main */
+	ldr a1, [sl, a1]
+
+	/* __libc_start_main (main, argc, argv, init, fini, rtld_fini, stack_end) */
+	/* Let the libc call main and exit with its return code.  */
+	bl __libc_start_main(PLT)
+#else
+	/* Fetch address of __libc_csu_fini */
+	ldr ip, =__libc_csu_fini
+
+	/* Push __libc_csu_fini */
+	str ip, [sp, #-4]!
+
 	/* Set up the other arguments in registers */
 	ldr a1, =main
 	ldr a4, =__libc_csu_init
 
-	/* Push fini */
-	str ip, [sp, #-4]!
-
 	/* __libc_start_main (main, argc, argv, init, fini, rtld_fini, stack_end) */
-
 	/* Let the libc call main and exit with its return code.  */
 	bl __libc_start_main
+#endif
 
 	/* should never get here....*/
 	bl abort
+
+#ifdef SHARED
+.L_GOT:
+	.word _GLOBAL_OFFSET_TABLE_-(.L_GOT_OFF+8)
+	.word __libc_csu_fini(GOT)
+	.word __libc_csu_init(GOT)
+	.word main(GOT)
+#endif
+
 
 #if !defined(__USING_SJLJ_EXCEPTIONS__)
        .cantunwind

Modified: fsf/trunk/ports/sysdeps/arm/memset.S
==============================================================================
--- fsf/trunk/ports/sysdeps/arm/memset.S (original)
+++ fsf/trunk/ports/sysdeps/arm/memset.S Wed Jan 28 00:03:57 2009
@@ -35,20 +35,17 @@
 	and	r1, r1, #255	@ clear any sign bits
 	orr	r1, r1, r1, lsl $8
 	orr	r1, r1, r1, lsl $16
+	mov	ip, r1
 
 1:
 	subs	r2, r2, #8
-	strcs	r1, [r3], #4	@ store up to 32 bytes per loop iteration
-	strcs	r1, [r3], #4
+	stmcsia	r3!, {r1, ip}	@ store up to 32 bytes per loop iteration
 	subcss	r2, r2, #8
-	strcs	r1, [r3], #4
-	strcs	r1, [r3], #4
+	stmcsia	r3!, {r1, ip}
 	subcss	r2, r2, #8
-	strcs	r1, [r3], #4
-	strcs	r1, [r3], #4
+	stmcsia	r3!, {r1, ip}
 	subcss	r2, r2, #8
-	strcs	r1, [r3], #4
-	strcs	r1, [r3], #4
+	stmcsia	r3!, {r1, ip}
 	bcs	1b
 
 	and	r2, r2, #7

Modified: fsf/trunk/ports/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h
==============================================================================
--- fsf/trunk/ports/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h (original)
+++ fsf/trunk/ports/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h Wed Jan 28 00:03:57 2009
@@ -114,7 +114,7 @@
     __ret = INTERNAL_SYSCALL (futex, __err, 6, (futexp),		      \
 			      __lll_private_flag (FUTEX_CMP_REQUEUE, private),\
 			      (nr_wake), (nr_move), (mutex), (val));	      \
-    __ret;								      \
+    INTERNAL_SYSCALL_ERROR_P (__ret, __err);				      \
   })
 
 
@@ -127,7 +127,7 @@
 			      __lll_private_flag (FUTEX_WAKE_OP, private),    \
 			      (nr_wake), (nr_wake2), (futexp2),		      \
 			      FUTEX_OP_CLEAR_WAKE_IF_GT_ONE);		      \
-    __ret;								      \
+    INTERNAL_SYSCALL_ERROR_P (__ret, __err);				      \
   })
 
 

Modified: fsf/trunk/ports/sysdeps/unix/sysv/linux/arm/sysdep.h
==============================================================================
--- fsf/trunk/ports/sysdeps/unix/sysv/linux/arm/sysdep.h (original)
+++ fsf/trunk/ports/sysdeps/unix/sysv/linux/arm/sysdep.h Wed Jan 28 00:03:57 2009
@@ -27,6 +27,8 @@
 
 /* Defines RTLD_PRIVATE_ERRNO and USE_DL_SYSINFO.  */
 #include <dl-sysdep.h>
+
+#include <tls.h>
 
 /* For Linux we can use the system call table in the header file
 	/usr/include/asm/unistd.h

Modified: fsf/trunk/ports/sysdeps/unix/sysv/linux/mips/Makefile
==============================================================================
Binary files - no diff available.

Modified: fsf/trunk/ports/sysdeps/unix/sysv/linux/mips/Versions
==============================================================================
--- fsf/trunk/ports/sysdeps/unix/sysv/linux/mips/Versions (original)
+++ fsf/trunk/ports/sysdeps/unix/sysv/linux/mips/Versions Wed Jan 28 00:03:57 2009
@@ -1,3 +1,9 @@
+ld {
+  GLIBC_PRIVATE {
+    # used for loading by static libraries
+    _dl_var_init;
+  }
+}
 libc {
   # The comment lines with "#errlist-compat" are magic; see errlist-compat.awk.
   # When you get an error from errlist-compat.awk, you need to add a new

Added: fsf/trunk/ports/sysdeps/unix/sysv/linux/mips/dl-static.c
==============================================================================
--- fsf/trunk/ports/sysdeps/unix/sysv/linux/mips/dl-static.c (added)
+++ fsf/trunk/ports/sysdeps/unix/sysv/linux/mips/dl-static.c Wed Jan 28 00:03:57 2009
@@ -1,0 +1,92 @@
+/* Variable initialization.  MIPS version.
+   Copyright (C) 2001, 2002, 2003, 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
+   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 <ldsodefs.h>
+
+#ifdef SHARED
+
+void
+_dl_var_init (void *array[])
+{
+  /* It has to match "variables" below. */
+  enum
+    {
+      DL_PAGESIZE = 0
+    };
+
+  GLRO(dl_pagesize) = *((size_t *) array[DL_PAGESIZE]);
+}
+
+#else
+#include <bits/libc-lock.h>
+
+__libc_lock_define_initialized_recursive (static, _dl_static_lock)
+
+static void *variables[] =
+{
+  &GLRO(dl_pagesize)
+};
+
+static void
+_dl_unprotect_relro (struct link_map *l)
+{
+  ElfW(Addr) start = ((l->l_addr + l->l_relro_addr)
+		      & ~(GLRO(dl_pagesize) - 1));
+  ElfW(Addr) end = ((l->l_addr + l->l_relro_addr + l->l_relro_size)
+		    & ~(GLRO(dl_pagesize) - 1));
+
+  if (start != end)
+    __mprotect ((void *) start, end - start, PROT_READ | PROT_WRITE);
+}
+
+void
+_dl_static_init (struct link_map *l)
+{
+  struct link_map *rtld_map = l;
+  struct r_scope_elem **scope;
+  const ElfW(Sym) *ref = NULL;
+  lookup_t loadbase;
+  void (*f) (void *[]);
+  size_t i;
+
+  __libc_lock_lock_recursive (_dl_static_lock);
+
+  loadbase = _dl_lookup_symbol_x ("_dl_var_init", l, &ref, l->l_local_scope,
+				  NULL, 0, 1, NULL);
+  
+  for (scope = l->l_local_scope; *scope != NULL; scope++)
+    for (i = 0; i < (*scope)->r_nlist; i++)
+      if ((*scope)->r_list[i] == loadbase)
+	{
+	  rtld_map = (*scope)->r_list[i];
+	  break;
+	}
+
+  if (ref != NULL)
+    {
+      f = (void (*) (void *[])) DL_SYMBOL_ADDRESS (loadbase, ref);
+      _dl_unprotect_relro (rtld_map);
+      f (variables);
+      _dl_protect_relro (rtld_map);
+    }
+
+  __libc_lock_unlock_recursive (_dl_static_lock);
+}
+
+#endif

Added: fsf/trunk/ports/sysdeps/unix/sysv/linux/mips/ldsodefs.h
==============================================================================
--- fsf/trunk/ports/sysdeps/unix/sysv/linux/mips/ldsodefs.h (added)
+++ fsf/trunk/ports/sysdeps/unix/sysv/linux/mips/ldsodefs.h Wed Jan 28 00:03:57 2009
@@ -1,0 +1,33 @@
+/* Run-time dynamic linker data structures for loaded ELF shared objects. MIPS.
+   Copyright (C) 2001, 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	_LDSODEFS_H
+
+/* Get the real definitions.  */
+#include_next <ldsodefs.h>
+
+/* Now define our stuff.  */
+
+/* We need special support to initialize DSO loaded for statically linked
+   binaries.  */
+extern void _dl_static_init (struct link_map *map);
+#undef DL_STATIC_INIT
+#define DL_STATIC_INIT(map) _dl_static_init (map)
+
+#endif /* ldsodefs.h */