arrfab / rpms / glibc

Forked from rpms/glibc 5 years ago
Clone

Blame SOURCES/glibc-rh1163509-5.patch

147e83
This patch removes the following remaining architecture specific
147e83
pthread_once implementations:
147e83
147e83
- alpha, hppa, sh: Not used in RHEL.
147e83
147e83
- s390: Was first moved, then renamed upstream by the following commits:
147e83
147e83
  commit 52ae23b4bfa09fa1f42e3f659aaa057d1176d06b
147e83
  Author: Roland McGrath <roland@hack.frob.com>
147e83
  Date:   Thu Jun 26 09:31:11 2014 -0700
147e83
147e83
      Move remaining S390 code out of nptl/.
147e83
147e83
  commit bc89c0fc70ba952f78fc27fc261ec209be0a6732
147e83
  Author: Torvald Riegel <triegel@redhat.com>
147e83
  Date:   Mon Dec 8 18:32:14 2014 +0100
147e83
147e83
      Remove custom pthread_once implementation on s390.
147e83
147e83
- powerpc: Was removed upstream by the following commit:
147e83
147e83
  commit 75ffb047f6ee2a545da8cf69dba9a979ca6271ce
147e83
  Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com>
147e83
  Date:   Sun Apr 13 18:13:42 2014 -0500
147e83
147e83
      PowerPC: Sync pthread_once with default implementation
147e83
147e83
diff --git a/nptl/sysdeps/unix/sysv/linux/powerpc/pthread_once.c b/nptl/sysdeps/unix/sysv/linux/powerpc/pthread_once.c
147e83
deleted file mode 100644
147e83
index 52ab53f0a912d107..0000000000000000
147e83
--- a/nptl/sysdeps/unix/sysv/linux/powerpc/pthread_once.c
147e83
+++ /dev/null
147e83
@@ -1,110 +0,0 @@
147e83
-/* Copyright (C) 2003-2012 Free Software Foundation, Inc.
147e83
-   This file is part of the GNU C Library.
147e83
-   Contributed by Paul Mackerras <paulus@au.ibm.com>, 2003.
147e83
-
147e83
-   The GNU C Library is free software; you can redistribute it and/or
147e83
-   modify it under the terms of the GNU Lesser General Public
147e83
-   License as published by the Free Software Foundation; either
147e83
-   version 2.1 of the License, or (at your option) any later version.
147e83
-
147e83
-   The GNU C Library is distributed in the hope that it will be useful,
147e83
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
147e83
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
147e83
-   Lesser General Public License for more details.
147e83
-
147e83
-   You should have received a copy of the GNU Lesser General Public
147e83
-   License along with the GNU C Library; if not, see
147e83
-   <http://www.gnu.org/licenses/>.  */
147e83
-
147e83
-#include "pthreadP.h"
147e83
-#include <lowlevellock.h>
147e83
-
147e83
-
147e83
-unsigned long int __fork_generation attribute_hidden;
147e83
-
147e83
-
147e83
-static void
147e83
-clear_once_control (void *arg)
147e83
-{
147e83
-  pthread_once_t *once_control = (pthread_once_t *) arg;
147e83
-
147e83
-  __asm __volatile (__lll_rel_instr);
147e83
-  *once_control = 0;
147e83
-  lll_futex_wake (once_control, INT_MAX, LLL_PRIVATE);
147e83
-}
147e83
-
147e83
-
147e83
-int
147e83
-__pthread_once (pthread_once_t *once_control, void (*init_routine) (void))
147e83
-{
147e83
-  for (;;)
147e83
-    {
147e83
-      int oldval;
147e83
-      int newval;
147e83
-      int tmp;
147e83
-
147e83
-      /* Pseudo code:
147e83
-	 newval = __fork_generation | 1;
147e83
-	 oldval = *once_control;
147e83
-	 if ((oldval & 2) == 0)
147e83
-	   *once_control = newval;
147e83
-	 Do this atomically with an acquire barrier.
147e83
-      */
147e83
-      newval = __fork_generation | 1;
147e83
-      __asm __volatile ("1:	lwarx	%0,0,%3" MUTEX_HINT_ACQ "\n"
147e83
-			"	andi.	%1,%0,2\n"
147e83
-			"	bne	2f\n"
147e83
-			"	stwcx.	%4,0,%3\n"
147e83
-			"	bne	1b\n"
147e83
-			"2:	" __lll_acq_instr
147e83
-			: "=&r" (oldval), "=&r" (tmp), "=m" (*once_control)
147e83
-			: "r" (once_control), "r" (newval), "m" (*once_control)
147e83
-			: "cr0");
147e83
-
147e83
-      /* Check if the initializer has already been done.  */
147e83
-      if ((oldval & 2) != 0)
147e83
-	return 0;
147e83
-
147e83
-      /* Check if another thread already runs the initializer.	*/
147e83
-      if ((oldval & 1) == 0)
147e83
-	break;
147e83
-
147e83
-      /* Check whether the initializer execution was interrupted by a fork.  */
147e83
-      if (oldval != newval)
147e83
-	break;
147e83
-
147e83
-      /* Same generation, some other thread was faster. Wait.  */
147e83
-      lll_futex_wait (once_control, oldval, LLL_PRIVATE);
147e83
-    }
147e83
-
147e83
-
147e83
-  /* This thread is the first here.  Do the initialization.
147e83
-     Register a cleanup handler so that in case the thread gets
147e83
-     interrupted the initialization can be restarted.  */
147e83
-  pthread_cleanup_push (clear_once_control, once_control);
147e83
-
147e83
-  init_routine ();
147e83
-
147e83
-  pthread_cleanup_pop (0);
147e83
-
147e83
-
147e83
-  /* Add one to *once_control to take the bottom 2 bits from 01 to 10.
147e83
-     A release barrier is needed to ensure memory written by init_routine
147e83
-     is seen in other threads before *once_control changes.  */
147e83
-  int tmp;
147e83
-  __asm __volatile (__lll_rel_instr "\n"
147e83
-		    "1:	lwarx	%0,0,%2" MUTEX_HINT_REL "\n"
147e83
-		    "	addi	%0,%0,1\n"
147e83
-		    "	stwcx.	%0,0,%2\n"
147e83
-		    "	bne-	1b"
147e83
-		    : "=&b" (tmp), "=m" (*once_control)
147e83
-		    : "r" (once_control), "m" (*once_control)
147e83
-		    : "cr0");
147e83
-
147e83
-  /* Wake up all other threads.  */
147e83
-  lll_futex_wake (once_control, INT_MAX, LLL_PRIVATE);
147e83
-
147e83
-  return 0;
147e83
-}
147e83
-weak_alias (__pthread_once, pthread_once)
147e83
-hidden_def (__pthread_once)
147e83
diff --git a/nptl/sysdeps/unix/sysv/linux/s390/pthread_once.c b/nptl/sysdeps/unix/sysv/linux/s390/pthread_once.c
147e83
deleted file mode 100644
147e83
index 4bce7fec13ea3bb2..0000000000000000
147e83
--- a/nptl/sysdeps/unix/sysv/linux/s390/pthread_once.c
147e83
+++ /dev/null
147e83
@@ -1,108 +0,0 @@
147e83
-/* Copyright (C) 2003-2012 Free Software Foundation, Inc.
147e83
-   This file is part of the GNU C Library.
147e83
-   Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003.
147e83
-
147e83
-   The GNU C Library is free software; you can redistribute it and/or
147e83
-   modify it under the terms of the GNU Lesser General Public
147e83
-   License as published by the Free Software Foundation; either
147e83
-   version 2.1 of the License, or (at your option) any later version.
147e83
-
147e83
-   The GNU C Library is distributed in the hope that it will be useful,
147e83
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
147e83
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
147e83
-   Lesser General Public License for more details.
147e83
-
147e83
-   You should have received a copy of the GNU Lesser General Public
147e83
-   License along with the GNU C Library; if not, see
147e83
-   <http://www.gnu.org/licenses/>.  */
147e83
-
147e83
-#include "pthreadP.h"
147e83
-#include <lowlevellock.h>
147e83
-
147e83
-
147e83
-unsigned long int __fork_generation attribute_hidden;
147e83
-
147e83
-
147e83
-static void
147e83
-clear_once_control (void *arg)
147e83
-{
147e83
-  pthread_once_t *once_control = (pthread_once_t *) arg;
147e83
-
147e83
-  *once_control = 0;
147e83
-  lll_futex_wake (once_control, INT_MAX, LLL_PRIVATE);
147e83
-}
147e83
-
147e83
-
147e83
-int
147e83
-__pthread_once (pthread_once_t *once_control, void (*init_routine) (void))
147e83
-{
147e83
-  while (1)
147e83
-    {
147e83
-      int oldval;
147e83
-      int newval;
147e83
-
147e83
-      /* Pseudo code:
147e83
-	   oldval = *once_control;
147e83
-	   if ((oldval & 2) == 0)
147e83
-	    {
147e83
-	      newval = (oldval & 3) | __fork_generation | 1;
147e83
-	      *once_control = newval;
147e83
-	    }
147e83
-	 Do this atomically.  */
147e83
-      __asm __volatile ("   l	 %1,%0\n"
147e83
-			"0: lhi	 %2,2\n"
147e83
-			"   tml	 %1,2\n"
147e83
-			"   jnz	 1f\n"
147e83
-			"   nr	 %2,%1\n"
147e83
-			"   ahi	 %2,1\n"
147e83
-			"   o	 %2,%3\n"
147e83
-			"   cs	 %1,%2,%0\n"
147e83
-			"   jl	 0b\n"
147e83
-			"1:"
147e83
-			: "=Q" (*once_control), "=&d" (oldval), "=&d" (newval)
147e83
-			: "m" (__fork_generation), "m" (*once_control)
147e83
-			: "cc" );
147e83
-      /* Check if the initialized has already been done.  */
147e83
-      if ((oldval & 2) != 0)
147e83
-	  break;
147e83
-      /* Check if another thread already runs the initializer.	*/
147e83
-      if ((oldval & 1) != 0)
147e83
-	{
147e83
-	  /* Check whether the initializer execution was interrupted
147e83
-	     by a fork.	 */
147e83
-	  if (((oldval ^ newval) & -4) == 0)
147e83
-	    {
147e83
-	      /* Same generation, some other thread was faster. Wait.  */
147e83
-	      lll_futex_wait (once_control, newval, LLL_PRIVATE);
147e83
-	      continue;
147e83
-	    }
147e83
-	}
147e83
-
147e83
-      /* This thread is the first here.  Do the initialization.
147e83
-	 Register a cleanup handler so that in case the thread gets
147e83
-	 interrupted the initialization can be restarted.  */
147e83
-      pthread_cleanup_push (clear_once_control, once_control);
147e83
-
147e83
-      init_routine ();
147e83
-
147e83
-      pthread_cleanup_pop (0);
147e83
-
147e83
-
147e83
-      /* Add one to *once_control.  */
147e83
-      __asm __volatile ("   l	 %1,%0\n"
147e83
-			"0: lr	 %2,%1\n"
147e83
-			"   ahi	 %2,1\n"
147e83
-			"   cs	 %1,%2,%0\n"
147e83
-			"   jl	 0b\n"
147e83
-			: "=Q" (*once_control), "=&d" (oldval), "=&d" (newval)
147e83
-			: "m" (*once_control) : "cc" );
147e83
-
147e83
-      /* Wake up all other threads.  */
147e83
-      lll_futex_wake (once_control, INT_MAX, LLL_PRIVATE);
147e83
-      break;
147e83
-    }
147e83
-
147e83
-  return 0;
147e83
-}
147e83
-weak_alias (__pthread_once, pthread_once)
147e83
-hidden_def (__pthread_once)
147e83
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/pthread_once.S b/nptl/sysdeps/unix/sysv/linux/sh/pthread_once.S
147e83
deleted file mode 100644
147e83
index 62b92d8b103ded65..0000000000000000
147e83
--- a/nptl/sysdeps/unix/sysv/linux/sh/pthread_once.S
147e83
+++ /dev/null
147e83
@@ -1,257 +0,0 @@
147e83
-/* Copyright (C) 2003-2012 Free Software Foundation, Inc.
147e83
-   This file is part of the GNU C Library.
147e83
-
147e83
-   The GNU C Library is free software; you can redistribute it and/or
147e83
-   modify it under the terms of the GNU Lesser General Public
147e83
-   License as published by the Free Software Foundation; either
147e83
-   version 2.1 of the License, or (at your option) any later version.
147e83
-
147e83
-   The GNU C Library is distributed in the hope that it will be useful,
147e83
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
147e83
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
147e83
-   Lesser General Public License for more details.
147e83
-
147e83
-   You should have received a copy of the GNU Lesser General Public
147e83
-   License along with the GNU C Library; if not, see
147e83
-   <http://www.gnu.org/licenses/>.  */
147e83
-
147e83
-#include <unwindbuf.h>
147e83
-#include <sysdep.h>
147e83
-#include <kernel-features.h>
147e83
-#include <lowlevellock.h>
147e83
-#include "lowlevel-atomic.h"
147e83
-
147e83
-
147e83
-	.comm	__fork_generation, 4, 4
147e83
-
147e83
-	.text
147e83
-	.globl	__pthread_once
147e83
-	.type	__pthread_once,@function
147e83
-	.align	5
147e83
-	cfi_startproc
147e83
-__pthread_once:
147e83
-	mov.l	@r4, r0
147e83
-	tst	#2, r0
147e83
-	bt	1f
147e83
-	rts
147e83
-	 mov	#0, r0
147e83
-
147e83
-1:
147e83
-	mov.l	r12, @-r15
147e83
-	cfi_adjust_cfa_offset (4)
147e83
-	cfi_rel_offset (r12, 0)
147e83
-	mov.l	r9, @-r15
147e83
-	cfi_adjust_cfa_offset (4)
147e83
-	cfi_rel_offset (r9, 0)
147e83
-	mov.l	r8, @-r15
147e83
-	cfi_adjust_cfa_offset (4)
147e83
-	cfi_rel_offset (r8, 0)
147e83
-	sts.l	pr, @-r15
147e83
-	cfi_adjust_cfa_offset (4)
147e83
-	cfi_rel_offset (pr, 0)
147e83
-	mov	r5, r8
147e83
-	mov	r4, r9
147e83
-
147e83
-	/* Not yet initialized or initialization in progress.
147e83
-	   Get the fork generation counter now.  */
147e83
-6:
147e83
-	mov.l	@r4, r1
147e83
-	mova	.Lgot, r0
147e83
-	mov.l	.Lgot, r12
147e83
-	add	r0, r12
147e83
-
147e83
-5:
147e83
-	mov	r1, r0
147e83
-
147e83
-	tst	#2, r0
147e83
-	bf	4f
147e83
-
147e83
-	and	#3, r0
147e83
-	mov.l	.Lfgen, r2
147e83
-#ifdef PIC
147e83
-	add	r12, r2
147e83
-#endif
147e83
-	mov.l	@r2, r3
147e83
-	or	r3, r0	
147e83
-	or	#1, r0
147e83
-	mov	r0, r3
147e83
-	mov	r1, r5
147e83
-
147e83
-	CMPXCHG (r5, @r4, r3, r2)
147e83
-	bf	5b
147e83
-
147e83
-	/* Check whether another thread already runs the initializer.  */
147e83
-	mov	r2, r0
147e83
-	tst	#1, r0
147e83
-	bt	3f	/* No -> do it.  */
147e83
-
147e83
-	/* Check whether the initializer execution was interrupted
147e83
-	   by a fork.  */
147e83
-	xor	r3, r0
147e83
-	mov	#-4, r1	/* -4 = 0xfffffffc */
147e83
-	tst	r1, r0
147e83
-	bf	3f	/* Different for generation -> run initializer.  */
147e83
-
147e83
-	/* Somebody else got here first.  Wait.  */
147e83
-#ifdef __ASSUME_PRIVATE_FUTEX
147e83
-	mov	#(FUTEX_PRIVATE_FLAG|FUTEX_WAIT), r5
147e83
-	extu.b	r5, r5
147e83
-#else
147e83
-	stc	gbr, r1
147e83
-	mov.w	.Lpfoff, r2
147e83
-	add	r2, r1
147e83
-	mov.l	@r1, r5
147e83
-# if FUTEX_WAIT != 0
147e83
-	mov	#FUTEX_WAIT, r0
147e83
-	or	r0, r5
147e83
-# endif
147e83
-#endif
147e83
-	mov	r3, r6
147e83
-	mov	#0, r7
147e83
-	mov	#SYS_futex, r3
147e83
-	extu.b	r3, r3
147e83
-	trapa	#0x14
147e83
-	SYSCALL_INST_PAD
147e83
-	bra	6b
147e83
-	 nop
147e83
-
147e83
-	.align	2
147e83
-.Lgot:
147e83
-	.long	_GLOBAL_OFFSET_TABLE_
147e83
-#ifdef PIC
147e83
-.Lfgen:	
147e83
-	.long	__fork_generation@GOTOFF
147e83
-#else
147e83
-.Lfgen:	
147e83
-	.long	__fork_generation
147e83
-#endif
147e83
-
147e83
-3:
147e83
-	/* Call the initializer function after setting up the
147e83
-	   cancellation handler.  Note that it is not possible here
147e83
-	   to use the unwind-based cleanup handling.  This would require
147e83
-	   that the user-provided function and all the code it calls
147e83
-	   is compiled with exceptions.  Unfortunately this cannot be
147e83
-	   guaranteed.  */
147e83
-	add	#-UNWINDBUFSIZE, r15
147e83
-	cfi_adjust_cfa_offset (UNWINDBUFSIZE)
147e83
-
147e83
-	mov.l	.Lsigsetjmp, r1
147e83
-	mov	#UWJMPBUF, r4
147e83
-	add	r15, r4
147e83
-	bsrf	r1
147e83
-	 mov	#0, r5
147e83
-.Lsigsetjmp0:
147e83
-	tst	r0, r0
147e83
-	bf	7f
147e83
-
147e83
-	mov.l	.Lcpush, r1
147e83
-	bsrf	r1
147e83
-	 mov	r15, r4
147e83
-.Lcpush0:
147e83
-
147e83
-	/* Call the user-provided initialization function.  */
147e83
-	jsr	@r8
147e83
-	 nop
147e83
-
147e83
-	/* Pop the cleanup handler.  */
147e83
-	mov.l	.Lcpop, r1
147e83
-	bsrf	r1
147e83
-	 mov	r15, r4
147e83
-.Lcpop0:
147e83
-
147e83
-	add	#UNWINDBUFSIZE, r15
147e83
-	cfi_adjust_cfa_offset (-UNWINDBUFSIZE)
147e83
-
147e83
-	/* Sucessful run of the initializer.  Signal that we are done.  */
147e83
-	INC (@r9, r2)
147e83
-	/* Wake up all other threads.  */
147e83
-	mov	r9, r4
147e83
-#ifdef __ASSUME_PRIVATE_FUTEX
147e83
-	mov	#(FUTEX_PRIVATE_FLAG|FUTEX_WAKE), r5
147e83
-	extu.b	r5, r5
147e83
-#else
147e83
-	stc	gbr, r1
147e83
-	mov.w	.Lpfoff, r2
147e83
-	add	r2, r1
147e83
-	mov.l	@r1, r5
147e83
-	mov	#FUTEX_WAKE, r0
147e83
-	or	r0, r5
147e83
-#endif
147e83
-	mov	#-1, r6
147e83
-	shlr	r6		/* r6 = 0x7fffffff */
147e83
-	mov	#0, r7
147e83
-	mov	#SYS_futex, r3
147e83
-	extu.b	r3, r3
147e83
-	trapa	#0x14
147e83
-	SYSCALL_INST_PAD
147e83
-
147e83
-4:
147e83
-	lds.l	@r15+, pr
147e83
-	cfi_adjust_cfa_offset (-4)
147e83
-	cfi_restore (pr)
147e83
-	mov.l	@r15+, r8
147e83
-	cfi_adjust_cfa_offset (-4)
147e83
-	cfi_restore (r8)
147e83
-	mov.l	@r15+, r9
147e83
-	cfi_adjust_cfa_offset (-4)
147e83
-	cfi_restore (r9)
147e83
-	mov.l	@r15+, r12
147e83
-	cfi_adjust_cfa_offset (-4)
147e83
-	cfi_restore (r12)
147e83
-	rts
147e83
-	 mov	#0, r0
147e83
-
147e83
-7:
147e83
-	/* __sigsetjmp returned for the second time.  */
147e83
-	cfi_adjust_cfa_offset (UNWINDBUFSIZE+16)
147e83
-	cfi_offset (r12, -4)
147e83
-	cfi_offset (r9, -8)
147e83
-	cfi_offset (r8, -12)
147e83
-	cfi_offset (pr, -16)
147e83
-	mov	#0, r7
147e83
-	mov.l	r7, @r9
147e83
-	mov	r9, r4
147e83
-#ifdef __ASSUME_PRIVATE_FUTEX
147e83
-	mov	#(FUTEX_PRIVATE_FLAG|FUTEX_WAKE), r5
147e83
-#else
147e83
-	stc	gbr, r1
147e83
-	mov.w	.Lpfoff, r2
147e83
-	add	r2, r1
147e83
-	mov.l	@r1, r5
147e83
-	mov	#FUTEX_WAKE, r0
147e83
-	or	r0, r5
147e83
-#endif
147e83
-	extu.b	r5, r5
147e83
-	mov	#-1, r6
147e83
-	shlr	r6		/* r6 = 0x7fffffff */
147e83
-	mov	#SYS_futex, r3
147e83
-	extu.b	r3, r3
147e83
-	trapa	#0x14
147e83
-	SYSCALL_INST_PAD
147e83
-
147e83
-	mov.l	.Lunext, r1
147e83
-	bsrf	r1
147e83
-	 mov	r15, r4
147e83
-.Lunext0:
147e83
-	/* NOTREACHED */
147e83
-	sleep
147e83
-	cfi_endproc
147e83
-
147e83
-#ifndef __ASSUME_PRIVATE_FUTEX
147e83
-.Lpfoff:
147e83
-	.word	PRIVATE_FUTEX - TLS_PRE_TCB_SIZE
147e83
-#endif
147e83
-	.align	2
147e83
-.Lsigsetjmp:
147e83
-	.long	__sigsetjmp@PLT-(.Lsigsetjmp0-.)
147e83
-.Lcpush:
147e83
-	.long	HIDDEN_JUMPTARGET(__pthread_register_cancel)-.Lcpush0
147e83
-.Lcpop:
147e83
-	.long	HIDDEN_JUMPTARGET(__pthread_unregister_cancel)-.Lcpop0
147e83
-.Lunext:
147e83
-	.long	HIDDEN_JUMPTARGET(__pthread_unwind_next)-.Lunext0
147e83
-	.size	__pthread_once,.-__pthread_once
147e83
-
147e83
-hidden_def (__pthread_once)
147e83
-strong_alias (__pthread_once, pthread_once)
147e83
diff --git a/sysdeps/unix/sysv/linux/alpha/nptl/pthread_once.c b/sysdeps/unix/sysv/linux/alpha/nptl/pthread_once.c
147e83
deleted file mode 100644
147e83
index c342e0a7a0965086..0000000000000000
147e83
--- a/sysdeps/unix/sysv/linux/alpha/nptl/pthread_once.c
147e83
+++ /dev/null
147e83
@@ -1,95 +0,0 @@
147e83
-/* Copyright (C) 2003-2012 Free Software Foundation, Inc.
147e83
-   This file is part of the GNU C Library.
147e83
-
147e83
-   The GNU C Library is free software; you can redistribute it and/or
147e83
-   modify it under the terms of the GNU Lesser General Public
147e83
-   License as published by the Free Software Foundation; either
147e83
-   version 2.1 of the License, or (at your option) any later version.
147e83
-
147e83
-   The GNU C Library is distributed in the hope that it will be useful,
147e83
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
147e83
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
147e83
-   Lesser General Public License for more details.
147e83
-
147e83
-   You should have received a copy of the GNU Lesser General Public
147e83
-   License along with the GNU C Library.  If not, see
147e83
-   <http://www.gnu.org/licenses/>.  */
147e83
-
147e83
-#include "pthreadP.h"
147e83
-#include <lowlevellock.h>
147e83
-
147e83
-
147e83
-unsigned long int __fork_generation attribute_hidden;
147e83
-
147e83
-static void
147e83
-clear_once_control (void *arg)
147e83
-{
147e83
-  pthread_once_t *once_control = (pthread_once_t *) arg;
147e83
-
147e83
-  *once_control = 0;
147e83
-  lll_futex_wake (once_control, INT_MAX, LLL_PRIVATE);
147e83
-}
147e83
-
147e83
-int
147e83
-__pthread_once (pthread_once_t *once_control, void (*init_routine) (void))
147e83
-{
147e83
-  for (;;)
147e83
-    {
147e83
-      int oldval;
147e83
-      int newval;
147e83
-      int tmp;
147e83
-
147e83
-      /* Pseudo code:
147e83
-	 newval = __fork_generation | 1;
147e83
-	 oldval = *once_control;
147e83
-	 if ((oldval & 2) == 0)
147e83
-	   *once_control = newval;
147e83
-	 Do this atomically.
147e83
-      */
147e83
-      newval = __fork_generation | 1;
147e83
-      __asm __volatile (
147e83
-		"1:	ldl_l	%0, %2\n"
147e83
-		"	and	%0, 2, %1\n"
147e83
-		"	bne	%1, 2f\n"
147e83
-		"	mov	%3, %1\n"
147e83
-		"	stl_c	%1, %2\n"
147e83
-		"	beq	%1, 1b\n"
147e83
-		"2:	mb"
147e83
-		: "=&r" (oldval), "=&r" (tmp), "=m" (*once_control)
147e83
-		: "r" (newval), "m" (*once_control));
147e83
-
147e83
-      /* Check if the initializer has already been done.  */
147e83
-      if ((oldval & 2) != 0)
147e83
-	return 0;
147e83
-
147e83
-      /* Check if another thread already runs the initializer.	*/
147e83
-      if ((oldval & 1) == 0)
147e83
-	break;
147e83
-
147e83
-      /* Check whether the initializer execution was interrupted by a fork.  */
147e83
-      if (oldval != newval)
147e83
-	break;
147e83
-
147e83
-      /* Same generation, some other thread was faster. Wait.  */
147e83
-      lll_futex_wait (once_control, oldval, LLL_PRIVATE);
147e83
-    }
147e83
-
147e83
-  /* This thread is the first here.  Do the initialization.
147e83
-     Register a cleanup handler so that in case the thread gets
147e83
-     interrupted the initialization can be restarted.  */
147e83
-  pthread_cleanup_push (clear_once_control, once_control);
147e83
-
147e83
-  init_routine ();
147e83
-
147e83
-  pthread_cleanup_pop (0);
147e83
-
147e83
-  /* Add one to *once_control to take the bottom 2 bits from 01 to 10.  */
147e83
-  atomic_increment (once_control);
147e83
-
147e83
-  /* Wake up all other threads.  */
147e83
-  lll_futex_wake (once_control, INT_MAX, LLL_PRIVATE);
147e83
-
147e83
-  return 0;
147e83
-}
147e83
-weak_alias (__pthread_once, pthread_once)
147e83
-hidden_def (__pthread_once)
147e83
diff --git a/sysdeps/unix/sysv/linux/hppa/nptl/pthread_once.c b/sysdeps/unix/sysv/linux/hppa/nptl/pthread_once.c
147e83
deleted file mode 100644
147e83
index b920ebb22c10a569..0000000000000000
147e83
--- a/sysdeps/unix/sysv/linux/hppa/nptl/pthread_once.c
147e83
+++ /dev/null
147e83
@@ -1,93 +0,0 @@
147e83
-/* Copyright (C) 2003-2012 Free Software Foundation, Inc.
147e83
-   This file is part of the GNU C Library.
147e83
-   Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
147e83
-
147e83
-   The GNU C Library is free software; you can redistribute it and/or
147e83
-   modify it under the terms of the GNU Lesser General Public
147e83
-   License as published by the Free Software Foundation; either
147e83
-   version 2.1 of the License, or (at your option) any later version.
147e83
-
147e83
-   The GNU C Library is distributed in the hope that it will be useful,
147e83
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
147e83
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
147e83
-   Lesser General Public License for more details.
147e83
-
147e83
-   You should have received a copy of the GNU Lesser General Public
147e83
-   License along with the GNU C Library.  If not, see
147e83
-   <http://www.gnu.org/licenses/>.  */
147e83
-
147e83
-#include "pthreadP.h"
147e83
-#include <lowlevellock.h>
147e83
-
147e83
-
147e83
-unsigned long int __fork_generation attribute_hidden;
147e83
-
147e83
-
147e83
-static void
147e83
-clear_once_control (void *arg)
147e83
-{
147e83
-  pthread_once_t *once_control = (pthread_once_t *) arg;
147e83
-
147e83
-  *once_control = 0;
147e83
-  lll_private_futex_wake (once_control, INT_MAX);
147e83
-}
147e83
-
147e83
-
147e83
-int
147e83
-__pthread_once (once_control, init_routine)
147e83
-     pthread_once_t *once_control;
147e83
-     void (*init_routine) (void);
147e83
-{
147e83
-  while (1)
147e83
-    {
147e83
-      int oldval, val, newval;
147e83
-
147e83
-      val = *once_control;
147e83
-      do
147e83
-	{
147e83
-	  /* Check if the initialized has already been done.  */
147e83
-	  if ((val & 2) != 0)
147e83
-	    return 0;
147e83
-
147e83
-	  oldval = val;
147e83
-	  newval = (oldval & 3) | __fork_generation | 1;
147e83
-	  val = atomic_compare_and_exchange_val_acq (once_control, newval,
147e83
-						     oldval);
147e83
-	}
147e83
-      while (__builtin_expect (val != oldval, 0));
147e83
-
147e83
-      /* Check if another thread already runs the initializer.	*/
147e83
-      if ((oldval & 1) != 0)
147e83
-	{
147e83
-	  /* Check whether the initializer execution was interrupted
147e83
-	     by a fork.	 */
147e83
-	  if (((oldval ^ newval) & -4) == 0)
147e83
-	    {
147e83
-	      /* Same generation, some other thread was faster. Wait.  */
147e83
-	      lll_private_futex_wait (once_control, newval);
147e83
-	      continue;
147e83
-	    }
147e83
-	}
147e83
-
147e83
-      /* This thread is the first here.  Do the initialization.
147e83
-	 Register a cleanup handler so that in case the thread gets
147e83
-	 interrupted the initialization can be restarted.  */
147e83
-      pthread_cleanup_push (clear_once_control, once_control);
147e83
-
147e83
-      init_routine ();
147e83
-
147e83
-      pthread_cleanup_pop (0);
147e83
-
147e83
-
147e83
-      /* Add one to *once_control.  */
147e83
-      atomic_increment (once_control);
147e83
-
147e83
-      /* Wake up all other threads.  */
147e83
-      lll_private_futex_wake (once_control, INT_MAX);
147e83
-      break;
147e83
-    }
147e83
-
147e83
-  return 0;
147e83
-}
147e83
-weak_alias (__pthread_once, pthread_once)
147e83
-hidden_def (__pthread_once)