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

[Commits] r20280 - in /fsf/trunk/libc: ./ csu/ ports/ ports/sysdeps/unix/sysv/linux/m68k/ ports/sysdeps/unix/sysv/linux/tile/ sysdeps/...



Author: eglibc
Date: Wed Aug 22 00:02:32 2012
New Revision: 20280

Log:
Import glibc-mainline for 2012-08-22

Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/csu/elf-init.c
    fsf/trunk/libc/csu/libc-start.c
    fsf/trunk/libc/ports/ChangeLog.m68k
    fsf/trunk/libc/ports/ChangeLog.tile
    fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/m68k/kernel-features.h
    fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/tile/kernel-features.h
    fsf/trunk/libc/sysdeps/powerpc/powerpc32/power7/memchr.S
    fsf/trunk/libc/sysdeps/powerpc/powerpc64/power7/memchr.S
    fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/posix_fadvise64.S
    fsf/trunk/libc/sysdeps/unix/sysv/linux/kernel-features.h
    fsf/trunk/libc/sysdeps/unix/sysv/linux/posix_fadvise64.c
    fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/posix_fadvise64.c
    fsf/trunk/libc/sysdeps/unix/sysv/linux/s390/s390-32/posix_fadvise64.c

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Wed Aug 22 00:02:32 2012
@@ -1,3 +1,48 @@
+2012-08-21  Roland McGrath  <roland@xxxxxxxxxxxxx>
+
+	* csu/elf-init.c (__libc_csu_irel): Function removed.
+	* csu/libc-start.c (apply_irel): New function.
+	(LIBC_START_MAIN): Call it instead of __libc_csu_irel.
+
+2012-08-21  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/kernel-features.h
+	(__ASSUME_FADVISE64_64_SYSCALL): Remove.
+	* sysdeps/unix/sysv/linux/i386/posix_fadvise64.S: Do not include
+	<kernel-features.h>.
+	[__NR_fadvise64_64]: Make code unconditional.
+	[!__ASSUME_FADVISE64_64_SYSCALL]: Remove conditional code.
+	[__NR_fadvise64 && (!__ASSUME_FADVISE64_64_SYSCALL ||
+	!__NR_fadvise64_64)]: Likewise.
+	[!(__NR_fadvise64 && (!__ASSUME_FADVISE64_64_SYSCALL ||
+	!__NR_fadvise64_64))]: Likewise.
+	[__NR_fadvise64]: Make code unconditional.
+	[!__NR_fadvise64]: Remove conditional code.
+	* sysdeps/unix/sysv/linux/posix_fadvise64.c: Do not include
+	<kernel-features.h>.
+	(__posix_fadvise64_l64) [__NR_fadvise64_64]: Make code
+	unconditional.
+	(_posix_fadvise64_l64) [!__ASSUME_FADVISE64_64_SYSCALL]: Remove
+	conditional code.
+	* sysdeps/unix/sysv/linux/powerpc/powerpc32/posix_fadvise64.c: Do
+	not include <kernel-features.h>.
+	(__posix_fadvise64_l64) [__NR_fadvise64_64]: Make code
+	unconditional.
+	(_posix_fadvise64_l64) [!__ASSUME_FADVISE64_64_SYSCALL]: Remove
+	conditional code.
+	* sysdeps/unix/sysv/linux/s390/s390-32/posix_fadvise64.c: Do not
+	include <kernel-features.h>.
+	(__posix_fadvise64_l64) [__NR_fadvise64_64]: Make code
+	unconditional.
+	(_posix_fadvise64_l64) [!__ASSUME_FADVISE64_64_SYSCALL]: Remove
+	conditional code.
+
+2012-08-21  Will Schmidt  <will_schmidt@xxxxxxxxxxxx>
+
+	* sysdeps/powerpc/powerpc64/power7/memchr.S: Unrolled short loop and
+	slight instruction rearrangements per scrollpipe analysis.
+	* sysdeps/powerpc/powerpc64/power7/memchr.S: Likewise.
+
 2012-08-20  Roland McGrath  <roland@xxxxxxxxxxxxx>
 
 	* manual/syslog.texi (syslog; vsyslog, closelog):

Modified: fsf/trunk/libc/csu/elf-init.c
==============================================================================
--- fsf/trunk/libc/csu/elf-init.c (original)
+++ fsf/trunk/libc/csu/elf-init.c Wed Aug 22 00:02:32 2012
@@ -1,6 +1,5 @@
 /* Startup support for ELF initializers/finalizers in the main executable.
-   Copyright (C) 2002,2003,2004,2005,2009,2011
-	Free Software Foundation, Inc.
+   Copyright (C) 2002-2012 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
@@ -36,20 +35,6 @@
 
 #include <stddef.h>
 
-#if defined USE_MULTIARCH && !defined LIBC_NONSHARED
-# include <link.h>
-# include <dl-irel.h>
-
-# ifdef ELF_MACHINE_IRELA
-extern const ElfW(Rela) __rela_iplt_start [];
-extern const ElfW(Rela) __rela_iplt_end [];
-# endif
-
-# ifdef ELF_MACHINE_IREL
-extern const ElfW(Rel) __rel_iplt_start [];
-extern const ElfW(Rel) __rel_iplt_end [];
-# endif
-#endif	/* LIBC_NONSHARED */
 
 /* These magic symbols are provided by the linker.  */
 extern void (*__preinit_array_start []) (int, char **, char **)
@@ -72,33 +57,7 @@
 /* These functions are passed to __libc_start_main by the startup code.
    These get statically linked into each program.  For dynamically linked
    programs, this module will come from libc_nonshared.a and differs from
-   the libc.a module in that it doesn't call the preinit array and performs
-   explicit IREL{,A} relocations.  */
-
-
-#ifndef LIBC_NONSHARED
-void
-__libc_csu_irel (void)
-{
-# ifdef USE_MULTIARCH
-#  ifdef ELF_MACHINE_IRELA
-  {
-    const size_t size = __rela_iplt_end - __rela_iplt_start;
-    for (size_t i = 0; i < size; i++)
-      elf_irela (&__rela_iplt_start [i]);
-  }
-#  endif
-
-#  ifdef ELF_MACHINE_IREL
-  {
-    const size_t size = __rel_iplt_end - __rel_iplt_start;
-    for (size_t i = 0; i < size; i++)
-      elf_irel (&__rel_iplt_start [i]);
-  }
-#  endif
-# endif
-}
-#endif
+   the libc.a module in that it doesn't call the preinit array.  */
 
 
 void

Modified: fsf/trunk/libc/csu/libc-start.c
==============================================================================
--- fsf/trunk/libc/csu/libc-start.c (original)
+++ fsf/trunk/libc/csu/libc-start.c Wed Aug 22 00:02:32 2012
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2006, 2007, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2012 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
@@ -43,6 +43,38 @@
 #ifdef HAVE_PTR_NTHREADS
 /* We need atomic operations.  */
 # include <atomic.h>
+#endif
+
+
+#ifndef SHARED
+# include <link.h>
+# include <dl-irel.h>
+
+# ifdef ELF_MACHINE_IRELA
+#  define IREL_T	ElfW(Rela)
+#  define IPLT_START	__rela_iplt_start
+#  define IPLT_END	__rela_iplt_end
+#  define IREL		elf_irela
+# elif defined ELF_MACHINE_IREL
+#  define IREL_T	ElfW(Rel)
+#  define IPLT_START	__rel_iplt_start
+#  define IPLT_END	__rel_iplt_end
+#  define IREL		elf_irel
+# endif
+
+/* We use weak references for these so that we'll still work with a linker
+   that doesn't define them.  Such a linker doesn't support IFUNC at all
+   and so uses won't work, but a statically-linked program that doesn't
+   use any IFUNC symbols won't have a problem.  */
+extern const IREL_T IPLT_START[] __attribute__ ((weak));
+extern const IREL_T IPLT_END[] __attribute__ ((weak));
+
+static void
+apply_irel (void)
+{
+  for (const IREL_T *ipltent = IPLT_START; ipltent < IPLT_END; ++ipltent)
+    IREL (ipltent);
+}
 #endif
 
 
@@ -136,8 +168,8 @@
     }
 # endif
 
-  /* Performe IREL{,A} relocations.  */
-  __libc_csu_irel ();
+  /* Perform IREL{,A} relocations.  */
+  apply_irel ();
 
   /* Initialize the thread library at least a bit since the libgcc
      functions are using thread functions if these are available and

Modified: fsf/trunk/libc/ports/ChangeLog.m68k
==============================================================================
--- fsf/trunk/libc/ports/ChangeLog.m68k (original)
+++ fsf/trunk/libc/ports/ChangeLog.m68k Wed Aug 22 00:02:32 2012
@@ -1,3 +1,8 @@
+2012-08-21  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/m68k/kernel-features.h
+	(__ASSUME_FADVISE64_64_SYSCALL): Remove.
+
 2012-08-20  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
 
 	* sysdeps/unix/sysv/linux/m68k/kernel-features.h

Modified: fsf/trunk/libc/ports/ChangeLog.tile
==============================================================================
--- fsf/trunk/libc/ports/ChangeLog.tile (original)
+++ fsf/trunk/libc/ports/ChangeLog.tile Wed Aug 22 00:02:32 2012
@@ -1,3 +1,8 @@
+2012-08-21  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/tile/kernel-features.h
+	(__ASSUME_FADVISE64_64_SYSCALL): Remove.
+
 2012-08-20  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
 
 	* sysdeps/unix/sysv/linux/tile/kernel-features.h

Modified: fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/m68k/kernel-features.h
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/m68k/kernel-features.h (original)
+++ fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/m68k/kernel-features.h Wed Aug 22 00:02:32 2012
@@ -22,7 +22,6 @@
 
 /* Many syscalls were added in 2.6.10 for m68k.  */
 #define __ASSUME_UTIMES	1
-#define __ASSUME_FADVISE64_64_SYSCALL	1
 
 #include_next <kernel-features.h>
 

Modified: fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/tile/kernel-features.h
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/tile/kernel-features.h (original)
+++ fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/tile/kernel-features.h Wed Aug 22 00:02:32 2012
@@ -20,7 +20,6 @@
 /* TILE glibc support starts with 2.6.36, guaranteeing many kernel features. */
 #define __ASSUME_STAT64_SYSCALL		1
 #define __ASSUME_UTIMES			1
-#define __ASSUME_FADVISE64_64_SYSCALL	1
 #define __ASSUME_O_CLOEXEC		1
 #define __ASSUME_SOCK_CLOEXEC		1
 #define __ASSUME_IN_NONBLOCK		1

Modified: fsf/trunk/libc/sysdeps/powerpc/powerpc32/power7/memchr.S
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc32/power7/memchr.S (original)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc32/power7/memchr.S Wed Aug 22 00:02:32 2012
@@ -1,5 +1,5 @@
 /* Optimized memchr implementation for PowerPC32/POWER7 using cmpb insn.
-   Copyright (C) 2010 Free Software Foundation, Inc.
+   Copyright (C) 2010-2012 Free Software Foundation, Inc.
    Contributed by Luis Machado <luisgpm@xxxxxxxxxx>.
    This file is part of the GNU C Library.
 
@@ -33,19 +33,23 @@
 	cmplwi	r5,16
 	ble	L(small_range)
 
-	cmplw	cr7,r3,r7     /* Is the address equal or less than r3?  If
-				 it's equal or less, it means size is either 0
-				 or a negative number.  */
+	cmplw	cr7,r3,r7     /* Compare the starting address (r3) with the
+				 ending address (r7).  If (r3 >= r7), the size
+				 passed in is zero or negative.  */
 	ble	cr7,L(proceed)
 
-	li	r7,-1	      /* Make r11 the biggest if r4 <= 0.  */
+	li	r7,-1	      /* Artificially set our ending address (r7)
+				 such that we will exit early. */
 L(proceed):
 	rlwinm	r6,r3,3,27,28 /* Calculate padding.  */
+	cmpli	cr6,r6,0      /* cr6 == Do we have padding?  */
 	lwz	r12,0(r8)     /* Load word from memory.  */
 	cmpb	r10,r12,r4    /* Check for BYTE's in WORD1.  */
+	beq	cr6,L(proceed_no_padding)
 	slw	r10,r10,r6
 	srw	r10,r10,r6
-	cmplwi	cr7,r10,0     /* If r10 == 0, no BYTE's have been found.  */
+L(proceed_no_padding):
+	cmplwi	cr7,r10,0     /* If r10 == 0, no BYTEs have been found.  */
 	bne	cr7,L(done)
 
 	/* Are we done already?  */
@@ -73,7 +77,7 @@
 L(loop_setup):
 	sub	r5,r7,r9
 	srwi	r6,r5,3	      /* Number of loop iterations.  */
-	mtctr	r6	      /* Setup the counter.  */
+	mtctr	r6            /* Setup the counter.  */
 	b	L(loop)
 	/* Main loop to look for BYTE backwards in the string.  Since
 	   it's a small loop (< 8 instructions), align it to 32-bytes.  */
@@ -82,7 +86,6 @@
 	/* Load two words, compare and merge in a
 	   single register for speed.  This is an attempt
 	   to speed up the byte-checking process for bigger strings.  */
-
 	lwz	r12,4(r8)
 	lwzu	r11,8(r8)
 	cmpb	r10,r12,r4
@@ -91,11 +94,11 @@
 	cmplwi	cr7,r5,0
 	bne	cr7,L(found)
 	bdnz	L(loop)
+
 	/* We're here because the counter reached 0, and that means we
-	   didn't have any matches for BYTE in the whole range.  Just
-	   return the original range.  */
-	addi	r9,r8,4
-	cmplw	cr6,r9,r7
+	   didn't have any matches for BYTE in the whole range.  */
+	subi	r11,r7,4
+	cmplw	cr6,r8,r11
 	blt	cr6,L(loop_small)
 	b	L(null)
 
@@ -118,8 +121,7 @@
 	/* r10 has the output of the cmpb instruction, that is, it contains
 	   0xff in the same position as BYTE in the original
 	   word from the string.  Use that to calculate the pointer.
-	   We need to make sure BYTE is *before* the end of the
-	   range.  */
+	   We need to make sure BYTE is *before* the end of the range.  */
 L(done):
 	cntlzw	r0,r10	      /* Count leading zeroes before the match.  */
 	srwi	r0,r0,3	      /* Convert leading zeroes to bytes.  */
@@ -137,13 +139,15 @@
 	.align	4
 L(small_range):
 	cmplwi	r5,0
-	beq	L(null)
-
 	rlwinm	r6,r3,3,27,28 /* Calculate padding.  */
+	beq	L(null)       /* This branch is for the cmplwi r5,0 above */
 	lwz	r12,0(r8)     /* Load word from memory.  */
+	cmplwi	cr6,r6,0      /* cr6 == Do we have padding?  */
 	cmpb	r10,r12,r4    /* Check for BYTE in DWORD1.  */
+	beq	cr6,L(small_no_padding)
 	slw	r10,r10,r6
 	srw	r10,r10,r6
+L(small_no_padding):
 	cmplwi	cr7,r10,0
 	bne	cr7,L(done)
 
@@ -151,18 +155,52 @@
 	addi    r9,r8,4
 	cmplw	r9,r7
 	bge	L(null)
-	b	L(loop_small)
-
-	.p2align  5
-L(loop_small):
-	lwzu	r12,4(r8)
-	cmpb	r10,r12,r4
-	addi	r9,r8,4
-	cmplwi	cr6,r10,0
-	bne	cr6,L(done)
-	cmplw	r9,r7
-	bge	L(null)
-	b	L(loop_small)
+
+L(loop_small):                /* loop_small has been unrolled.  */
+	lwzu	r12,4(r8)
+	cmpb	r10,r12,r4
+	addi	r9,r8,4
+	cmplwi	cr6,r10,0
+	cmplw	r9,r7
+	bne	cr6,L(done)
+	bge	L(null)
+
+	lwzu	r12,4(r8)
+	cmpb	r10,r12,r4
+	addi	r9,r8,4
+	cmplwi	cr6,r10,0
+	cmplw	r9,r7
+	bne	cr6,L(done)
+	bge	L(null)
+
+	lwzu	r12,4(r8)
+	cmpb	r10,r12,r4
+	addi	r9,r8,4
+	cmplwi	cr6,r10,0
+	cmplw	r9,r7
+	bne	cr6,L(done)
+	bge	L(null)
+
+	lwzu	r12,4(r8)
+	cmpb	r10,r12,r4
+	addi	r9,r8,4
+	cmplwi	cr6,r10,0
+	cmplw	r9,r7
+	bne	cr6,L(done)
+	bge	L(null)
+
+	/* For most cases we will never get here.  Under some combinations of
+	   padding + length there is a leftover word that still needs to be
+	   checked.  */
+	lwzu	r12,4(r8)
+	cmpb	r10,r12,r4
+	addi	r9,r8,4
+	cmplwi	cr6,r10,0
+	bne	cr6,L(done)
+
+	/* save a branch and exit directly */
+	li	r3,0
+	blr
 
 END (BP_SYM (__memchr))
 weak_alias (BP_SYM (__memchr), BP_SYM(memchr))

Modified: fsf/trunk/libc/sysdeps/powerpc/powerpc64/power7/memchr.S
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc64/power7/memchr.S (original)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc64/power7/memchr.S Wed Aug 22 00:02:32 2012
@@ -1,5 +1,5 @@
 /* Optimized memchr implementation for PowerPC64/POWER7 using cmpb insn.
-   Copyright (C) 2010 Free Software Foundation, Inc.
+   Copyright (C) 2010-2012 Free Software Foundation, Inc.
    Contributed by Luis Machado <luisgpm@xxxxxxxxxx>.
    This file is part of the GNU C Library.
 
@@ -29,27 +29,32 @@
 	clrrdi  r8,r3,3
 	rlwimi	r4,r4,8,16,23
 	rlwimi	r4,r4,16,0,15
-	insrdi  r4,r4,32,0
 	add	r7,r3,r5      /* Calculate the last acceptable address.  */
 	cmpldi	r5,32
+	insrdi  r4,r4,32,0
 	ble	L(small_range)
 
-	cmpld	cr7,r3,r7     /* Is the address equal or less than r3?  If
-				 it's equal or less, it means size is either 0
-				 or a negative number.  */
+	cmpld	cr7,r3,r7     /* Compare the starting address (r3) with the
+				 ending address (r7).  If (r3 >= r7),
+				 the size passed in was zero or negative.  */
 	ble	cr7,L(proceed)
 
-	li	r7,-1	      /* Make r11 the biggest if r4 <= 0.  */
+	li	r7,-1         /* Artificially set our ending address (r7)
+				 such that we will exit early.  */
+
 L(proceed):
 	rlwinm	r6,r3,3,26,28 /* Calculate padding.  */
+	cmpldi	cr6,r6,0      /* cr6 == Do we have padding?  */
 	ld	r12,0(r8)     /* Load doubleword from memory.  */
-	cmpb	r10,r12,r4    /* Check for BYTE's in DWORD1.  */
+	cmpb	r10,r12,r4    /* Check for BYTEs in DWORD1.  */
+	beq	cr6,L(proceed_no_padding)
 	sld	r10,r10,r6
 	srd	r10,r10,r6
-	cmpldi	cr7,r10,0     /* If r10 == 0, no BYTE's's have been found.  */
+L(proceed_no_padding):
+	cmpldi	cr7,r10,0     /* Does r10 indicate we got a hit?  */
 	bne	cr7,L(done)
 
-	/* Are we done already?  */
+	/* See if we are at the last acceptable address yet.  */
 	addi	r9,r8,8
 	cmpld	cr6,r9,r7
 	bge	cr6,L(null)
@@ -74,7 +79,7 @@
 L(loop_setup):
 	sub	r5,r7,r9
 	srdi	r6,r5,4	      /* Number of loop iterations.  */
-	mtctr	r6	      /* Setup the counter.  */
+	mtctr	r6            /* Setup the counter.  */
 	b	L(loop)
 	/* Main loop to look for BYTE backwards in the string.  Since
 	   it's a small loop (< 8 instructions), align it to 32-bytes.  */
@@ -83,7 +88,6 @@
 	/* Load two doublewords, compare and merge in a
 	   single register for speed.  This is an attempt
 	   to speed up the byte-checking process for bigger strings.  */
-
 	ld	r12,8(r8)
 	ldu	r11,16(r8)
 	cmpb	r10,r12,r4
@@ -92,11 +96,11 @@
 	cmpldi	cr7,r5,0
 	bne	cr7,L(found)
 	bdnz	L(loop)
+
 	/* We're here because the counter reached 0, and that means we
-	   didn't have any matches for BYTE in the whole range.  Just return
-	   the original range.  */
-	addi	r9,r8,8
-	cmpld	cr6,r9,r7
+	   didn't have any matches for BYTE in the whole range.  */
+	subi	r11,r7,8
+	cmpld	cr6,r8,r11
 	blt	cr6,L(loop_small)
 	b	L(null)
 
@@ -119,8 +123,7 @@
 	/* r10 has the output of the cmpb instruction, that is, it contains
 	   0xff in the same position as BYTE in the original
 	   doubleword from the string.  Use that to calculate the pointer.
-	   We need to make sure BYTE is *before* the end of the
-	   range.  */
+	   We need to make sure BYTE is *before* the end of the range.  */
 L(done):
 	cntlzd	r0,r10	      /* Count leading zeroes before the match.  */
 	srdi	r0,r0,3	      /* Convert leading zeroes to bytes.  */
@@ -138,13 +141,16 @@
 	.align	4
 L(small_range):
 	cmpldi	r5,0
-	beq	L(null)
-
 	rlwinm	r6,r3,3,26,28 /* Calculate padding.  */
+	beq	L(null)       /* This branch is for the cmpldi r5,0 above.  */
 	ld	r12,0(r8)     /* Load word from memory.  */
+	cmpldi	cr6,r6,0      /* cr6 == Do we have padding?  */
 	cmpb	r10,r12,r4    /* Check for BYTE in DWORD1.  */
+			      /* If no padding, skip the shifts.  */
+	beq	cr6,L(small_no_padding)
 	sld	r10,r10,r6
 	srd	r10,r10,r6
+L(small_no_padding):
 	cmpldi	cr7,r10,0
 	bne	cr7,L(done)
 
@@ -152,18 +158,49 @@
 	addi    r9,r8,8
 	cmpld	r9,r7
 	bge	L(null)
-	b	L(loop_small)
-
-	.p2align  5
-L(loop_small):
-	ldu	r12,8(r8)
-	cmpb	r10,r12,r4
-	addi	r9,r8,8
-	cmpldi	cr6,r10,0
+	/* If we're not done, drop through into loop_small.  */
+
+L(loop_small):                /* loop_small has been unrolled.  */
+	ldu	r12,8(r8)
+	cmpb	r10,r12,r4
+	addi	r9,r8,8
+	cmpldi	cr6,r10,0
+	cmpld	r9,r7
+	bne	cr6,L(done)   /* Found something.  */
+	bge	L(null)       /* Hit end of string (length).  */
+
+	ldu	r12,8(r8)
+	cmpb	r10,r12,r4
+	addi	r9,r8,8
+	cmpldi	cr6,r10,0
+	cmpld	r9,r7
+	bne	cr6,L(done)   /* Found something.  */
+	bge	L(null)
+
+	ldu	r12,8(r8)
+	subi	r11,r7,8
+	cmpb	r10,r12,r4
+	cmpldi	cr6,r10,0
+	ori	r2,r2,0       /* Force a dispatch group.  */
 	bne	cr6,L(done)
-	cmpld	r9,r7
-	bge	L(null)
-	b	L(loop_small)
+
+	cmpld	r8,r11        /* At end of range?  */
+	bge	L(null)
+
+	/* For most cases we will never get here.  Under some combinations of
+	   padding + length there is a leftover double that still needs to be
+	   checked.  */
+	ldu	r12,8(r8)
+	cmpb	r10,r12,r4
+	addi	r9,r8,8
+	cmpldi	cr6,r10,0
+	cmpld	r9,r7
+	bne	cr6,L(done)   /* Found something.  */
+
+	/* Save a branch and exit directly.  */
+	li	r3,0
+	blr
+
 
 END (BP_SYM (__memchr))
 weak_alias (BP_SYM (__memchr), BP_SYM(memchr))

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/posix_fadvise64.S
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/posix_fadvise64.S (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/posix_fadvise64.S Wed Aug 22 00:02:32 2012
@@ -1,5 +1,4 @@
-/* Copyright (C) 1995-2000,2002,2003,2004,2005,2006
-	Free Software Foundation, Inc.
+/* Copyright (C) 1995-2012 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
@@ -20,8 +19,6 @@
 #include <bp-sym.h>
 #include <bp-asm.h>
 
-#include <kernel-features.h>
-
 #define EINVAL	22
 #define ENOSYS	38
 #define EOVERFLOW 75
@@ -37,8 +34,6 @@
 
 	.text
 ENTRY (BP_SYM (__posix_fadvise64_l64))
-
-#ifdef __NR_fadvise64_64
 
 	/* Save registers.  */
 	pushl	%ebp
@@ -78,11 +73,6 @@
 	cfi_adjust_cfa_offset (-4)
 	cfi_restore (ebp)
 
-#ifndef __ASSUME_FADVISE64_64_SYSCALL
-	cmpl	$-ENOSYS, %eax
-	je	1f
-#endif
-
 	/* The function returns zero, or the error number.  So all we
 	   have to do is negate the value passed back from the kernel.  */
 	/* If 0 > %eax > -4096 there was an error.  */
@@ -90,72 +80,15 @@
 
 	/* Successful; return the syscall's value.  */
 	ret
-#endif
-
-#if defined __NR_fadvise64 \
-    && (!defined __ASSUME_FADVISE64_64_SYSCALL || !defined __NR_fadvise64_64)
-1:	/* Save registers.  */
-	pushl	%ebx
-	cfi_adjust_cfa_offset (4)
-	pushl	%esi
-	cfi_adjust_cfa_offset (4)
-	pushl	%edi
-	cfi_adjust_cfa_offset (4)
-
-	/* Overflow check.  */
-	cmpl	$0, LENHI(%esp)
-	movl	$-EOVERFLOW, %eax
-	jne	L(overflow)
-
-	movl	FD(%esp), %ebx
-	cfi_rel_offset (ebx, 8)
-	movl	OFFLO(%esp), %ecx
-	movl	OFFHI(%esp), %edx
-	movl	LENLO(%esp), %esi
-	cfi_rel_offset (esi, 4)
-	movl	FLAGS(%esp), %edi
-	cfi_rel_offset (edi, 0)
-
-	movl	$SYS_ify(fadvise64), %eax
-	ENTER_KERNEL
-
-	/* Restore registers.  */
-L(overflow):
-	popl	%edi
-	cfi_adjust_cfa_offset (-4)
-	cfi_restore (edi)
-	popl	%esi
-	cfi_adjust_cfa_offset (-4)
-	cfi_restore (esi)
-	popl	%ebx
-	cfi_adjust_cfa_offset (-4)
-	cfi_restore (ebx)
-
-	/* If 0 > %eax > -4096 there was an error.  */
-	negl	%eax
-
-	/* Successful; return the syscall's value.  */
-	ret
-#else
-	movl	$ENOSYS, %eax
-	ret
-#endif
 
 END (BP_SYM (__posix_fadvise64_l64))
 
-#ifdef __NR_fadvise64
 	.section	.text.compat, "ax"
 ENTRY (__posix_fadvise64_l32)
 	DO_CALL (fadvise64, 5)
 	negl %eax
 	ret
 PSEUDO_END_ERRVAL (__posix_fadvise64_l32)
-#else
-ENTRY (BP_SYM (__posix_fadvise64_l32))
-	movl	$ENOSYS, %eax
-	ret
-END (BP_SYM (__posix_fadvise64_l32))
-#endif
 
 default_symbol_version (__posix_fadvise64_l64, posix_fadvise64, GLIBC_2.3.3)
 symbol_version (__posix_fadvise64_l32, posix_fadvise64, GLIBC_2.2)

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/kernel-features.h
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/kernel-features.h (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/kernel-features.h Wed Aug 22 00:02:32 2012
@@ -98,14 +98,6 @@
 # define __ASSUME_UTIMES	1
 #endif
 
-/* The fixed version of the posix_fadvise64 syscall appeared in
-   2.6.0-test3.  At least for x86 and sparc.  Powerpc support appeared
-   in 2.6.2, but for 32-bit userspace only.  */
-#if (defined __i386__ || defined __sparc__			\
-     || (defined __powerpc__ && !defined __powerpc64__))
-# define __ASSUME_FADVISE64_64_SYSCALL	1
-#endif
-
 /* On sparc64 stat64/lstat64/fstat64 syscalls were introduced in 2.6.12.  */
 #if defined __sparc__ && defined __arch64__
 # define __ASSUME_STAT64_SYSCALL	1

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/posix_fadvise64.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/posix_fadvise64.c (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/posix_fadvise64.c Wed Aug 22 00:02:32 2012
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2003-2012 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
@@ -18,7 +18,6 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <sysdep.h>
-#include <kernel-features.h>
 
 int __posix_fadvise64_l64 (int fd, off64_t offset, off64_t len, int advise);
 int __posix_fadvise64_l32 (int fd, off64_t offset, size_t len, int advise);
@@ -29,7 +28,6 @@
 int
 __posix_fadvise64_l64 (int fd, off64_t offset, off64_t len, int advise)
 {
-#ifdef __NR_fadvise64_64
   INTERNAL_SYSCALL_DECL (err);
   int ret = INTERNAL_SYSCALL (fadvise64_64, err, 6, fd,
 			      __LONG_LONG_PAIR ((long) (offset >> 32),
@@ -39,28 +37,7 @@
 			      advise);
   if (!INTERNAL_SYSCALL_ERROR_P (ret, err))
     return 0;
-# ifndef __ASSUME_FADVISE64_64_SYSCALL
-  if (INTERNAL_SYSCALL_ERRNO (ret, err) != ENOSYS)
-# endif
-   return INTERNAL_SYSCALL_ERRNO (ret, err);
-#endif
-#ifndef __ASSUME_FADVISE64_64_SYSCALL
-# ifdef __NR_fadvise64
-  if (len != (off_t) len)
-    return EOVERFLOW;
-
-  INTERNAL_SYSCALL_DECL (err2);
-  int ret2 = INTERNAL_SYSCALL (fadvise64, err2, 5, fd,
-			       __LONG_LONG_PAIR ((long) (offset >> 32),
-						 (long) offset),
-			       (off_t) len, advise);
-  if (!INTERNAL_SYSCALL_ERROR_P (ret2, err2))
-    return 0;
-  return INTERNAL_SYSCALL_ERRNO (ret2, err2);
-# else
-  return ENOSYS;
-# endif
-#endif
+  return INTERNAL_SYSCALL_ERRNO (ret, err);
 }
 
 #include <shlib-compat.h>

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/posix_fadvise64.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/posix_fadvise64.c (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/posix_fadvise64.c Wed Aug 22 00:02:32 2012
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2003-2012 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
@@ -18,7 +18,6 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <sysdep.h>
-#include <kernel-features.h>
 
 int __posix_fadvise64_l64 (int fd, off64_t offset, off64_t len, int advise);
 int __posix_fadvise64_l32 (int fd, off64_t offset, size_t len, int advise);
@@ -29,34 +28,13 @@
 int
 __posix_fadvise64_l64 (int fd, off64_t offset, off64_t len, int advise)
 {
-#ifdef __NR_fadvise64_64
   INTERNAL_SYSCALL_DECL (err);
   int ret = INTERNAL_SYSCALL (fadvise64_64, err, 6, fd, advise,
 			      __LONG_LONG_PAIR ((long)(offset >> 32), (long)offset),
 			      __LONG_LONG_PAIR ((long)(len >> 32), (long)len));
   if (!INTERNAL_SYSCALL_ERROR_P (ret, err))
     return 0;
-# ifndef __ASSUME_FADVISE64_64_SYSCALL
-  if (INTERNAL_SYSCALL_ERRNO (ret, err) != ENOSYS)
-# endif
-   return INTERNAL_SYSCALL_ERRNO (ret, err);
-#endif
-#ifndef __ASSUME_FADVISE64_64_SYSCALL
-# ifdef __NR_fadvise64
-  if (len != (off_t) len)
-    return EOVERFLOW;
-
-  INTERNAL_SYSCALL_DECL (err2);
-  int ret2 = INTERNAL_SYSCALL (fadvise64, err2, 6, fd, 0,
-			       __LONG_LONG_PAIR ((long)(offset >> 32), (long)offset),
-			       (off_t) len, advise);
-  if (!INTERNAL_SYSCALL_ERROR_P (ret2, err2))
-    return 0;
-  return INTERNAL_SYSCALL_ERRNO (ret2, err2);
-# else
-  return ENOSYS;
-# endif
-#endif
+  return INTERNAL_SYSCALL_ERRNO (ret, err);
 }
 
 #include <shlib-compat.h>

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/s390/s390-32/posix_fadvise64.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/s390/s390-32/posix_fadvise64.c (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/s390/s390-32/posix_fadvise64.c Wed Aug 22 00:02:32 2012
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2003-2012 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
@@ -18,7 +18,6 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <sysdep.h>
-#include <kernel-features.h>
 
 int __posix_fadvise64_l64 (int fd, off64_t offset, off64_t len, int advise);
 int __posix_fadvise64_l32 (int fd, off64_t offset, size_t len, int advise);
@@ -37,7 +36,6 @@
 int
 __posix_fadvise64_l64 (int fd, off64_t offset, off64_t len, int advise)
 {
-#ifdef __NR_fadvise64_64
   struct fadvise64_64_layout parameters;
   INTERNAL_SYSCALL_DECL (err);
   
@@ -48,28 +46,7 @@
   int ret = INTERNAL_SYSCALL (fadvise64_64, err, 1, &parameters);
   if (!INTERNAL_SYSCALL_ERROR_P (ret, err))
     return 0;
-# ifndef __ASSUME_FADVISE64_64_SYSCALL
-  if (INTERNAL_SYSCALL_ERRNO (ret, err) != ENOSYS)
-# endif
-   return INTERNAL_SYSCALL_ERRNO (ret, err);
-#endif
-#ifndef __ASSUME_FADVISE64_64_SYSCALL
-# ifdef __NR_fadvise64
-  if (len != (off_t) len)
-    return EOVERFLOW;
-
-  INTERNAL_SYSCALL_DECL (err2);
-  int ret2 = INTERNAL_SYSCALL (fadvise64, err2, 5, fd,
-			       __LONG_LONG_PAIR ((long) (offset >> 32),
-						 (long) offset),
-			       (off_t) len, advise);
-  if (!INTERNAL_SYSCALL_ERROR_P (ret2, err2))
-    return 0;
-  return INTERNAL_SYSCALL_ERRNO (ret2, err2);
-# else
-  return ENOSYS;
-# endif
-#endif
+  return INTERNAL_SYSCALL_ERRNO (ret, err);
 }
 
 #include <shlib-compat.h>

_______________________________________________
Commits mailing list
Commits@xxxxxxxxxx
http://eglibc.org/cgi-bin/mailman/listinfo/commits