Hi,

I would like to suggest following changeset, any opinions?

Follow GNU C Library from c579f48edba88380635ab98cb612030e3ed8691e
and remove the PID caching. These simplifies the architecture specific
assembly code.
The run of the test suite found no regressions, it even solves
some of the test failures for x86/x86_64/sparc.

Signed-off-by: Waldemar Brodkorb <w...@openadk.org>
---
 libc/sysdeps/linux/arc/clone.S                     | 15 ++---
 libc/sysdeps/linux/arc/vfork.S                     | 13 ----
 libc/sysdeps/linux/arm/clone.S                     | 18 ------
 libc/sysdeps/linux/arm/vfork.S                     | 13 ----
 libc/sysdeps/linux/common/bits/kernel-features.h   |  7 ---
 libc/sysdeps/linux/i386/Makefile.arch              |  7 +--
 libc/sysdeps/linux/i386/clone.S                    |  8 ---
 libc/sysdeps/linux/i386/vfork.S                    |  8 ---
 libc/sysdeps/linux/ia64/clone2.S                   | 19 ------
 libc/sysdeps/linux/metag/clone.S                   | 21 -------
 libc/sysdeps/linux/metag/vfork.S                   | 12 ----
 libc/sysdeps/linux/mips/Makefile.arch              |  4 +-
 libc/sysdeps/linux/mips/clone.S                    | 28 ---------
 libc/sysdeps/linux/mips/vfork.S                    | 12 ----
 libc/sysdeps/linux/nds32/clone.S                   | 24 --------
 libc/sysdeps/linux/nds32/vfork.S                   | 14 -----
 libc/sysdeps/linux/nios2/clone.S                   |  8 ---
 libc/sysdeps/linux/nios2/vfork.S                   | 17 ------
 libc/sysdeps/linux/powerpc/Makefile.arch           |  4 +-
 libc/sysdeps/linux/powerpc/clone.S                 | 30 ++--------
 libc/sysdeps/linux/sh/Makefile.arch                |  7 +--
 libc/sysdeps/linux/sh/clone.S                      | 36 +----------
 libc/sysdeps/linux/sparc/Makefile.arch             |  8 +--
 libc/sysdeps/linux/sparc/clone.S                   | 17 ------
 libc/sysdeps/linux/sparc/vfork.S                   |  2 -
 libc/sysdeps/linux/x86_64/Makefile.arch            |  6 +-
 libc/sysdeps/linux/x86_64/clone.S                  | 13 ----
 libc/sysdeps/linux/x86_64/vfork.S                  |  8 ---
 libc/sysdeps/linux/xtensa/Makefile.arch            |  4 +-
 libc/sysdeps/linux/xtensa/clone.S                  | 19 ------
 libc/sysdeps/linux/xtensa/vfork.S                  | 25 --------
 libpthread/nptl/allocatestack.c                    | 20 +------
 libpthread/nptl/descr.h                            |  2 +-
 libpthread/nptl/init.c                             | 28 +--------
 libpthread/nptl/pthread_cancel.c                   |  6 +-
 libpthread/nptl/sysdeps/alpha/tcb-offsets.sym      |  1 -
 libpthread/nptl/sysdeps/arc/tcb-offsets.sym        |  1 -
 libpthread/nptl/sysdeps/arm/tcb-offsets.sym        |  1 -
 libpthread/nptl/sysdeps/i386/tcb-offsets.sym       |  1 -
 libpthread/nptl/sysdeps/metag/tcb-offsets.sym      |  1 -
 libpthread/nptl/sysdeps/microblaze/tcb-offsets.sym |  1 -
 libpthread/nptl/sysdeps/mips/tcb-offsets.sym       |  1 -
 libpthread/nptl/sysdeps/nds32/tcb-offsets.sym      |  1 -
 libpthread/nptl/sysdeps/nios2/tcb-offsets.sym      |  1 -
 libpthread/nptl/sysdeps/powerpc/tcb-offsets.sym    |  1 -
 libpthread/nptl/sysdeps/pthread/createthread.c     |  5 +-
 libpthread/nptl/sysdeps/sh/tcb-offsets.sym         |  1 -
 libpthread/nptl/sysdeps/sparc/tcb-offsets.sym      |  1 -
 .../nptl/sysdeps/unix/sysv/linux/alpha/clone.S     |  2 -
 .../nptl/sysdeps/unix/sysv/linux/alpha/vfork.S     | 45 --------------
 .../nptl/sysdeps/unix/sysv/linux/arc/Makefile.arch |  3 -
 .../nptl/sysdeps/unix/sysv/linux/arc/clone.S       | 10 ----
 .../nptl/sysdeps/unix/sysv/linux/arc/vfork.S       | 11 ----
 .../nptl/sysdeps/unix/sysv/linux/arm/Makefile.arch |  8 ---
 .../nptl/sysdeps/unix/sysv/linux/arm/clone.S       |  3 -
 .../nptl/sysdeps/unix/sysv/linux/arm/vfork.S       | 38 ------------
 libpthread/nptl/sysdeps/unix/sysv/linux/fork.c     | 12 ----
 libpthread/nptl/sysdeps/unix/sysv/linux/getpid.c   | 30 ----------
 .../sysdeps/unix/sysv/linux/i386/Makefile.arch     |  4 +-
 .../nptl/sysdeps/unix/sysv/linux/i386/clone.S      |  2 -
 .../nptl/sysdeps/unix/sysv/linux/i386/vfork.S      | 37 ------------
 .../sysdeps/unix/sysv/linux/metag/Makefile.arch    |  3 -
 .../nptl/sysdeps/unix/sysv/linux/metag/clone.S     |  9 ---
 .../nptl/sysdeps/unix/sysv/linux/metag/vfork.S     | 55 -----------------
 .../unix/sysv/linux/microblaze/Makefile.arch       |  1 -
 .../sysdeps/unix/sysv/linux/microblaze/clone.S     |  4 --
 .../sysdeps/unix/sysv/linux/microblaze/vfork.S     |  5 --
 .../sysdeps/unix/sysv/linux/mips/Makefile.arch     |  7 +--
 .../nptl/sysdeps/unix/sysv/linux/mips/clone.S      |  2 -
 .../nptl/sysdeps/unix/sysv/linux/mips/pt-clone.S   |  2 -
 .../nptl/sysdeps/unix/sysv/linux/mips/vfork.S      | 42 -------------
 .../sysdeps/unix/sysv/linux/nds32/Makefile.arch    |  3 -
 .../nptl/sysdeps/unix/sysv/linux/nds32/clone.S     |  4 --
 .../nptl/sysdeps/unix/sysv/linux/nds32/vfork.S     | 43 -------------
 .../sysdeps/unix/sysv/linux/nios2/Makefile.arch    |  2 -
 .../nptl/sysdeps/unix/sysv/linux/nios2/clone.S     |  3 -
 .../nptl/sysdeps/unix/sysv/linux/nios2/vfork.S     | 38 ------------
 .../sysdeps/unix/sysv/linux/powerpc/Makefile.arch  |  2 -
 .../nptl/sysdeps/unix/sysv/linux/powerpc/clone.S   |  9 ---
 .../nptl/sysdeps/unix/sysv/linux/powerpc/vfork.S   | 57 ------------------
 .../nptl/sysdeps/unix/sysv/linux/pthread_kill.c    |  5 +-
 .../sysdeps/unix/sysv/linux/pthread_sigqueue.c     | 12 ++--
 libpthread/nptl/sysdeps/unix/sysv/linux/raise.c    | 48 +++++++--------
 .../nptl/sysdeps/unix/sysv/linux/sh/Makefile.arch  |  2 -
 libpthread/nptl/sysdeps/unix/sysv/linux/sh/clone.S |  2 -
 libpthread/nptl/sysdeps/unix/sysv/linux/sh/vfork.S | 70 ----------------------
 .../sysdeps/unix/sysv/linux/sparc/Makefile.arch    |  3 -
 .../nptl/sysdeps/unix/sysv/linux/sparc/clone.S     |  2 -
 .../nptl/sysdeps/unix/sysv/linux/sparc/vfork.S     | 48 ---------------
 .../sysdeps/unix/sysv/linux/x86_64/Makefile.arch   |  6 +-
 .../nptl/sysdeps/unix/sysv/linux/x86_64/clone.S    |  3 -
 .../nptl/sysdeps/unix/sysv/linux/x86_64/vfork.S    | 42 -------------
 .../sysdeps/unix/sysv/linux/xtensa/Makefile.arch   |  3 -
 .../nptl/sysdeps/unix/sysv/linux/xtensa/clone.S    |  3 -
 .../nptl/sysdeps/unix/sysv/linux/xtensa/vfork.S    | 59 ------------------
 libpthread/nptl/sysdeps/x86_64/tcb-offsets.sym     |  1 -
 libpthread/nptl/sysdeps/xtensa/tcb-offsets.sym     |  1 -
 97 files changed, 67 insertions(+), 1239 deletions(-)
 delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/alpha/clone.S
 delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/alpha/vfork.S
 delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/arc/clone.S
 delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/arc/vfork.S
 delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/arm/clone.S
 delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/arm/vfork.S
 delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/i386/clone.S
 delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/i386/vfork.S
 delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/metag/clone.S
 delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/metag/vfork.S
 delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/microblaze/clone.S
 delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/microblaze/vfork.S
 delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/mips/clone.S
 delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/mips/pt-clone.S
 delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/mips/vfork.S
 delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/nds32/clone.S
 delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/nds32/vfork.S
 delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/nios2/clone.S
 delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/nios2/vfork.S
 delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/clone.S
 delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/vfork.S
 delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/sh/clone.S
 delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/sh/vfork.S
 delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/sparc/clone.S
 delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/sparc/vfork.S
 delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/clone.S
 delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/vfork.S
 delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/xtensa/clone.S
 delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/xtensa/vfork.S

diff --git a/libc/sysdeps/linux/arc/clone.S b/libc/sysdeps/linux/arc/clone.S
index 3942b88..4467221 100644
--- a/libc/sysdeps/linux/arc/clone.S
+++ b/libc/sysdeps/linux/arc/clone.S
@@ -29,6 +29,10 @@
 
 #define CLONE_SETTLS           0x00080000
 
+.macro SET_TP  tcb
+        mov    r25, \tcb
+.endm
+
 ENTRY(clone)
        cmp     r0, 0           ; @fn can't be NULL
        cmp.ne  r1, 0           ; @child_stack can't be NULL
@@ -64,17 +68,6 @@ ENTRY(clone)
        SET_TP  r9
 
 .Lnext_clone_quirk:
-#ifdef RESET_PID
-       bbit1   r12, 16, .Lgo_thread    ; CLONE_THREAD = (1 << 16)
-
-       mov     r8, __NR_getpid
-       ARC_TRAP_INSN           ; r0 has PID
-       THREAD_SELF r1          ; Get to struct pthread (just before TCB)
-       st      r0, [r1, PTHREAD_PID]
-       st      r0, [r1, PTHREAD_TID]
-
-.Lgo_thread:
-#endif
 #endif
        ; child jumps off to @fn with @arg as argument, and returns here
        jl.d    [r10]
diff --git a/libc/sysdeps/linux/arc/vfork.S b/libc/sysdeps/linux/arc/vfork.S
index 573a29f..11959b6 100644
--- a/libc/sysdeps/linux/arc/vfork.S
+++ b/libc/sysdeps/linux/arc/vfork.S
@@ -16,25 +16,12 @@
 #define CLONE_FLAGS_FOR_VFORK  (CLONE_VM|CLONE_VFORK|SIGCHLD)
 
 ENTRY(__vfork)
-#ifdef SAVE_PID
-       THREAD_SELF r1          ; Get to struct pthread (just before TCB)
-       ld      r2, [r1, PTHREAD_PID]
-       neg.f   r3, r2
-       bset.z  r3, r3, 31
-       st      r3, [r1, PTHREAD_PID]
-#endif
        mov     r0, CLONE_FLAGS_FOR_VFORK
        mov_s   r1, sp
        mov     r8, __NR_clone
        ARC_TRAP_INSN
 
        cmp     r0, 0
-#ifdef RESTORE_PID
-       bz      1f      ; child continues
-       THREAD_SELF r1          ; Get to struct pthread (just before TCB)
-       st      r2, [r1, PTHREAD_PID]
-1:
-#endif
        jge     [blink] ; pid >=0 return, else detour via tailcall to errno
 
        b   __syscall_error
diff --git a/libc/sysdeps/linux/arm/clone.S b/libc/sysdeps/linux/arm/clone.S
index 0b293ec..b156e93 100644
--- a/libc/sysdeps/linux/arm/clone.S
+++ b/libc/sysdeps/linux/arm/clone.S
@@ -110,9 +110,6 @@ __clone:
        @ do the system call
        @ get flags
        mov     r0, r2
-#ifdef RESET_PID
-       mov     ip, r2
-#endif
        @ new sp is already in r1
        push    {r4, r7}
        cfi_adjust_cfa_offset (8)
@@ -138,21 +135,6 @@ PSEUDO_END (__clone)
 1:
        .fnstart
        .cantunwind
-#ifdef RESET_PID
-       tst     ip, #CLONE_THREAD
-       bne     3f
-       GET_TLS (lr)
-       mov     r1, r0
-       tst     ip, #CLONE_VM
-       ldr     r7, =SYS_ify(getpid)
-       ite     ne
-       movne   r0, #-1
-       swieq   0x0
-       NEGOFF_ADJ_BASE (r1, TID_OFFSET)
-       str     r0, NEGOFF_OFF1 (r1, TID_OFFSET)
-       str     r0, NEGOFF_OFF2 (r1, PID_OFFSET, TID_OFFSET)
-3:
-#endif
        @ pick the function arg and call address off the stack and execute
        ldr     r0, [sp, #4]
        mov     lr, pc
diff --git a/libc/sysdeps/linux/arm/vfork.S b/libc/sysdeps/linux/arm/vfork.S
index 221a90c..455b2f8 100644
--- a/libc/sysdeps/linux/arm/vfork.S
+++ b/libc/sysdeps/linux/arm/vfork.S
@@ -13,15 +13,6 @@
 #include <bits/errno.h>
 #include <sys/syscall.h>
 
-#ifndef SAVE_PID
-#define SAVE_PID
-#endif
-
-#ifndef RESTORE_PID
-#define RESTORE_PID
-#endif
-
-
 #ifdef __NR_fork
 .text
 .global        __vfork
@@ -33,9 +24,7 @@
 .thumb_func
 __vfork:
 #ifdef __NR_vfork
-       SAVE_PID
        DO_CALL (vfork)
-       RESTORE_PID
        ldr             r1, =0xfffff000
        cmp             r0, r1
        bcs             1f
@@ -69,9 +58,7 @@ __error:
 __vfork:
 
 #ifdef __NR_vfork
-       SAVE_PID
        DO_CALL (vfork)
-       RESTORE_PID
        cmn     r0, #4096
        IT(t, cc)
        BXC(cc, lr)
diff --git a/libc/sysdeps/linux/common/bits/kernel-features.h 
b/libc/sysdeps/linux/common/bits/kernel-features.h
index 0b36320..e0195e4 100644
--- a/libc/sysdeps/linux/common/bits/kernel-features.h
+++ b/libc/sysdeps/linux/common/bits/kernel-features.h
@@ -375,13 +375,6 @@
 # define __ASSUME_AT_SECURE    1
 #endif
 
-/* Starting with the 2.5.75 kernel the kernel fills in the correct value
-   in the si_pid field passed as part of the siginfo_t struct to signal
-   handlers.  */
-#if __LINUX_KERNEL_VERSION >= 132427
-# define __ASSUME_CORRECT_SI_PID       1
-#endif
-
 /* The utimes syscall has been available for some architectures
    forever.  For x86 it was introduced after 2.5.75, for x86-64,
    ppc, and ppc64 it was introduced in 2.6.0-test3.  */
diff --git a/libc/sysdeps/linux/i386/Makefile.arch 
b/libc/sysdeps/linux/i386/Makefile.arch
index e1739e1..6c9eed8 100644
--- a/libc/sysdeps/linux/i386/Makefile.arch
+++ b/libc/sysdeps/linux/i386/Makefile.arch
@@ -6,11 +6,8 @@
 #
 
 CSRC-y := brk.c __syscall_error.c sigaction.c
-
-SSRC-y := \
-       __longjmp.S setjmp.S bsd-setjmp.S bsd-_setjmp.S \
-       sync_file_range.S syscall.S mmap.S mmap64.S
+SSRC-y := __longjmp.S setjmp.S bsd-setjmp.S bsd-_setjmp.S \
+       sync_file_range.S syscall.S mmap.S mmap64.S vfork.S clone.S
 
 SSRC-$(UCLIBC_HAS_ADVANCED_REALTIME) += posix_fadvise64.S
-SSRC-$(if $(UCLIBC_HAS_THREADS_NATIVE),,y) += vfork.S clone.S
 SSRC-$(UCLIBC_HAS_CONTEXT_FUNCS) += makecontext.S setcontext.S getcontext.S 
swapcontext.S
diff --git a/libc/sysdeps/linux/i386/clone.S b/libc/sysdeps/linux/i386/clone.S
index 632cf59..68e87b5 100644
--- a/libc/sysdeps/linux/i386/clone.S
+++ b/libc/sysdeps/linux/i386/clone.S
@@ -78,10 +78,6 @@ clone:
        movl    %eax,8(%ecx)
        /* Don't leak any information.  */
        movl    $0,4(%ecx)
-#ifndef RESET_PID
-       movl    $0,(%ecx)
-#endif
-
 
        /* Do the system call */
        pushl   %ebx
@@ -92,10 +88,6 @@ clone:
        movl    FLAGS+12(%esp),%ebx
        movl    CTID+12(%esp),%edi
        movl    $__NR_clone,%eax
-#ifdef RESET_PID
-       /* Remember the flag value.  */
-       movl    %ebx, (%ecx)
-#endif
        int     $0x80
        popl    %edi
        popl    %esi
diff --git a/libc/sysdeps/linux/i386/vfork.S b/libc/sysdeps/linux/i386/vfork.S
index d85726f..6c4102e 100644
--- a/libc/sysdeps/linux/i386/vfork.S
+++ b/libc/sysdeps/linux/i386/vfork.S
@@ -19,18 +19,10 @@
 __vfork:
        popl %ecx
 
-#ifdef SAVE_PID
-       SAVE_PID
-#endif
-
        movl $__NR_vfork,%eax
        int $0x80
        pushl %ecx
 
-#ifdef RESTORE_PID
-       RESTORE_PID
-#endif
-
        cmpl $-4095,%eax
        jae __syscall_error
        ret
diff --git a/libc/sysdeps/linux/ia64/clone2.S b/libc/sysdeps/linux/ia64/clone2.S
index c077f72..692ee36 100644
--- a/libc/sysdeps/linux/ia64/clone2.S
+++ b/libc/sysdeps/linux/ia64/clone2.S
@@ -16,11 +16,8 @@
    <http://www.gnu.org/licenses/>.  */
 
 #include "sysdep.h"
-
-#include "sysdep.h"
 #include <asm/errno.h>
 
-
 /* int  __clone2(int (*fn) (void *arg), void *child_stack_base,        */
 /*              size_t child_stack_size, int flags, void *arg,         */
 /*              pid_t *parent_tid, void *tls, pid_t *child_tid)        */
@@ -68,22 +65,6 @@ ENTRY(__clone2)
 (CHILD)        mov loc0=gp
 (PARENT) ret
        ;;
-#ifdef RESET_PID
-       tbit.nz p6,p0=in3,16    /* CLONE_THREAD */
-       tbit.z p7,p10=in3,8     /* CLONE_VM */
-(p6)   br.cond.dptk 1f
-       ;;
-       mov r15=SYS_ify (getpid)
-(p10)  addl r8=-1,r0
-(p7)   break __BREAK_SYSCALL
-       ;;
-       add r9=PID,r13
-       add r10=TID,r13
-       ;;
-       st4 [r9]=r8
-       st4 [r10]=r8
-       ;;
-#endif
 1:     ld8 out1=[in0],8        /* Retrieve code pointer.       */
        mov out0=in4            /* Pass proper argument to fn */
        ;;
diff --git a/libc/sysdeps/linux/metag/clone.S b/libc/sysdeps/linux/metag/clone.S
index d9d8363..4687cbc 100644
--- a/libc/sysdeps/linux/metag/clone.S
+++ b/libc/sysdeps/linux/metag/clone.S
@@ -52,27 +52,6 @@ __clone:
        ! BRKPNT
 
        ! We are the child
-#ifdef RESET_PID
-       SETL    [A0StP++], D0FrT, D1RtP
-       MOVT    D0FrT, #HI(CLONE_THREAD)
-       ADD     D0FrT, D0FrT, #LO(CLONE_THREAD)
-       ANDS    D0FrT, D0FrT, D1Ar1
-       BNZ     3f
-       MOVT    D0FrT, #HI(CLONE_VM)
-       ADD     D0FrT, D0FrT, #LO(CLONE_VM)
-       ANDS    D0FrT, D0FrT, D1Ar1
-       BZ      1f
-       MOV     D1Ar1, #-1
-       BA      2f
-1:     MOV     D1Re0, #__NR_getpid
-       SWITCH  #0x440001
-       MOV     D1Ar1, D0Re0
-2:     CALLR   D1RtP, __CLONE_METAG_LOAD_TP
-       SUB     D0Re0, D0Re0, #TLS_PRE_TCB_SIZE
-       SETD    [D0Re0 + #PID], D1Ar1
-       SETD    [D0Re0 + #TID], D1Ar1
-3:     GETL    D0FrT, D1RtP, [--A0StP]
-#endif
        ! Rearrange the function arg and call address from registers
        MOV     D0Ar2, D0FrT
        MOV     D1Ar1, D0Ar6
diff --git a/libc/sysdeps/linux/metag/vfork.S b/libc/sysdeps/linux/metag/vfork.S
index 8573ded..5e2fc88 100644
--- a/libc/sysdeps/linux/metag/vfork.S
+++ b/libc/sysdeps/linux/metag/vfork.S
@@ -8,14 +8,6 @@
 #include <bits/errno.h>
 #include <sys/syscall.h>
 
-#ifndef SAVE_PID
-#define SAVE_PID
-#endif
-
-#ifndef RESTORE_PID
-#define RESTORE_PID
-#endif
-
 #ifdef __NR_vfork
 #define __VFORK_NR __NR_vfork
 #else
@@ -33,8 +25,6 @@
        .type   ___vfork, @function
 ___vfork:
 
-       SAVE_PID
-
        MOV     D1Ar1, #0x4111  /* CLONE_VM | CLONE_VFORK | SIGCHLD */
        MOV     D0Ar2, #0
        MOV     D1Ar3, #0
@@ -44,8 +34,6 @@ ___vfork:
        MOV     D1Re0, #__NR_clone
        SWITCH  #0x440001
 
-       RESTORE_PID
-
        MOVT    D1Re0, #HI(-4096)
        ADD     D1Re0, D1Re0, #LO(-4096)
        CMP     D1Re0, D0Re0
diff --git a/libc/sysdeps/linux/mips/Makefile.arch 
b/libc/sysdeps/linux/mips/Makefile.arch
index 10deedc..5e54b07 100644
--- a/libc/sysdeps/linux/mips/Makefile.arch
+++ b/libc/sysdeps/linux/mips/Makefile.arch
@@ -9,11 +9,11 @@ CSRC-y := \
        __longjmp.c  brk.c setjmp_aux.c \
        pread_write.c sigaction.c _test_and_set.c
 
-SSRC-y := bsd-_setjmp.S bsd-setjmp.S setjmp.S syscall.S pipe.S syscall_error.S
+SSRC-y := bsd-_setjmp.S bsd-setjmp.S setjmp.S syscall.S pipe.S syscall_error.S 
\
+         vfork.S clone.S
 
 CSRC-$(UCLIBC_LINUX_SPECIFIC) += cacheflush.c sysmips.c
 CSRC-$(UCLIBC_HAS_ADVANCED_REALTIME) += posix_fadvise.c posix_fadvise64.c
-SSRC-$(if $(UCLIBC_HAS_THREADS_NATIVE),,y) += vfork.S clone.S
 SSRC-$(UCLIBC_HAS_CONTEXT_FUNCS) += makecontext.S setcontext.S getcontext.S \
        swapcontext.S
 
diff --git a/libc/sysdeps/linux/mips/clone.S b/libc/sysdeps/linux/mips/clone.S
index 8f7059d..964cf92 100644
--- a/libc/sysdeps/linux/mips/clone.S
+++ b/libc/sysdeps/linux/mips/clone.S
@@ -24,9 +24,6 @@
 #include <sysdep.h>
 #define _ERRNO_H        1
 #include <bits/errno.h>
-#ifdef RESET_PID
-#include <tls.h>
-#endif
 
 #define CLONE_VM      0x00000100
 #define CLONE_THREAD  0x00010000
@@ -68,9 +65,6 @@ NESTED(clone,4*SZREG,sp)
        PTR_SUBU        a1,32           /* Reserve argument save space.  */
        PTR_S           a0,0(a1)        /* Save function pointer.  */
        PTR_S           a3,PTRSIZE(a1)  /* Save argument pointer.  */
-#ifdef RESET_PID
-       LONG_S          a2,(PTRSIZE*2)(a1)      /* Save clone flags.  */
-#endif
 
        move            a0,a2
 
@@ -129,14 +123,6 @@ L(thread_start):
        SAVE_GP (GPOFF)
        /* The stackframe has been created on entry of clone().  */
 
-#ifdef RESET_PID
-       /* Check and see if we need to reset the PID.  */
-       LONG_L          a0,(PTRSIZE*2)(sp)
-       and             a1,a0,CLONE_THREAD
-       beqz            a1,L(restore_pid)
-L(donepid):
-#endif
-
        /* Restore the arg for user's function.  */
        PTR_L           t9,0(sp)        /* Function pointer.  */
        PTR_L           a0,PTRSIZE(sp)  /* Argument pointer.  */
@@ -153,20 +139,6 @@ L(donepid):
        jal             _exit
 #endif
 
-#ifdef RESET_PID
-L(restore_pid):
-       and             a1,a0,CLONE_VM
-       li              v0,-1
-       bnez            a1,L(gotpid)
-       li              v0,__NR_getpid
-       syscall
-L(gotpid):
-       READ_THREAD_POINTER(v1)
-       INT_S           v0,PID_OFFSET(v1)
-       INT_S           v0,TID_OFFSET(v1)
-       b               L(donepid)
-#endif
-
        END(__thread_start)
 
 weak_alias(clone, __clone)
diff --git a/libc/sysdeps/linux/mips/vfork.S b/libc/sysdeps/linux/mips/vfork.S
index 9311504..10e3be7 100644
--- a/libc/sysdeps/linux/mips/vfork.S
+++ b/libc/sysdeps/linux/mips/vfork.S
@@ -21,14 +21,6 @@
 #include <sys/asm.h>
 #include <sysdep.h>
 
-#ifndef SAVE_PID
-#define SAVE_PID
-#endif
-
-#ifndef RESTORE_PID
-#define RESTORE_PID
-#endif
-
 #ifdef __NR_fork
 
 /* int vfork() */
@@ -65,8 +57,6 @@ NESTED(__vfork,FRAMESZ,sp)
 
        PTR_ADDU        sp, FRAMESZ
 
-       SAVE_PID
-
        li              a0, 0x4112      /* CLONE_VM | CLONE_VFORK | SIGCHLD */
        move            a1, sp
 
@@ -74,8 +64,6 @@ NESTED(__vfork,FRAMESZ,sp)
        li              v0,__NR_clone
        syscall
 
-       RESTORE_PID
-
        bnez            a3,L(error)
 
        /* Successful return from the parent or child.  */
diff --git a/libc/sysdeps/linux/nds32/clone.S b/libc/sysdeps/linux/nds32/clone.S
index 1ed77fb..0e6e432 100644
--- a/libc/sysdeps/linux/nds32/clone.S
+++ b/libc/sysdeps/linux/nds32/clone.S
@@ -28,10 +28,6 @@
 #define _ERRNO_H       1
 #include <bits/errno.h>
 
-#ifdef RESET_PID
-#include <tcb-offsets.h>
-#endif
-
 #define CLONE_VM      0x00000100
 #define CLONE_THREAD  0x00010000
 
@@ -131,27 +127,7 @@ ENTRY(__clone)
        cfi_restore(fp)
 #endif /* PIC  */
        ret
-
-#ifdef RESET_PID
 4:
-       cfi_undefined(lp)
-       movi    $r0, CLONE_THREAD               ! Skip when CLONE_THREAD is set.
-       and     $r0, $r5, $r0
-       bnez    $r0, 8f
-       movi    $r0, CLONE_VM                   ! Value = -1 when CLONE_VM is 
set.
-       and     $r0, $r5, $r0
-       beqz    $r0, 6f
-       movi    $r0, -1
-       j       7f
-6:
-        __do_syscall(getpid) ! __do_syscall(gettid) ! __do_syscall(getpid)
-7:
-       swi     $r0, [$r25 + PID_OFFSET]
-        swi     $r0, [$r25 + TID_OFFSET]
-8:
-#else
-4:
-#endif
        /* Only in child's stack.  */
        pop     $r1                             ! fn
        pop     $r0                             ! arg
diff --git a/libc/sysdeps/linux/nds32/vfork.S b/libc/sysdeps/linux/nds32/vfork.S
index ac3fa30..ab32135 100644
--- a/libc/sysdeps/linux/nds32/vfork.S
+++ b/libc/sysdeps/linux/nds32/vfork.S
@@ -25,32 +25,18 @@
 #define _ERRNO_H    1
 #include <bits/errno.h>
 
-#ifndef SAVE_PID
-#define SAVE_PID
-#endif
-
-#ifndef RESTORE_PID
-#define RESTORE_PID
-#endif
 /* Clone the calling process, but without copying the whole address space.
    The calling process is suspended until the new process exits or is
    replaced by a call to `execve'.  Return -1 for errors, 0 to the new process,
    and the process ID of the new process to the old process.  */
 
-
 ENTRY (__vfork)
 #ifdef PIC
 .pic
 #endif
 
 #ifdef __NR_vfork
-# ifdef SAVE_PID
-    SAVE_PID
-# endif
     syscall __NR_vfork
-# ifdef RESTORE_PID
-    RESTORE_PID
-# endif
     bltz $r0, 2f
 1:
     ret
diff --git a/libc/sysdeps/linux/nios2/clone.S b/libc/sysdeps/linux/nios2/clone.S
index 0626d8a..04f0634 100644
--- a/libc/sysdeps/linux/nios2/clone.S
+++ b/libc/sysdeps/linux/nios2/clone.S
@@ -24,10 +24,6 @@
 #define _ERRNO_H       1
 #include <bits/errno.h>
 
-#ifdef __UCLIBC_HAS_THREADS_NATIVE__
-#include <tcb-offsets.h>
-#endif
-
 #define CLONE_VM      0x00000100
 
 /* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg,
@@ -64,10 +60,6 @@ thread_start:
        andi    r2, r4, CLONE_VM
        bne     r2, zero, 2f
         DO_CALL (getpid, 0)
-#ifdef RESET_PID
-       stw     r2, PID_OFFSET(r23)
-       stw     r2, TID_OFFSET(r23)
-#endif
 2:
        ldw     r5, 4(sp)       /* Function pointer.  */
        ldw     r4, 0(sp)       /* Argument pointer.  */
diff --git a/libc/sysdeps/linux/nios2/vfork.S b/libc/sysdeps/linux/nios2/vfork.S
index 99e4a73..2bef2a9 100644
--- a/libc/sysdeps/linux/nios2/vfork.S
+++ b/libc/sysdeps/linux/nios2/vfork.S
@@ -18,21 +18,7 @@
 
 #include <sysdep.h>
 
-#ifdef __UCLIBC_HAS_THREADS_NATIVE__
-#include <tcb-offsets.h>
-#endif
-
 ENTRY(__vfork)
-
-#ifdef RESET_PID
-       ldw     r6, PID_OFFSET(r23)
-       sub     r7, zero, r6
-       bne     r7, zero, 2f
-       movhi   r7, %hi(0x80000000)
-2:
-       stw     r7, PID_OFFSET(r23)
-#endif
-
        movi    r4, 0x4111 /* (CLONE_VM | CLONE_VFORK | SIGCHLD) */
        mov     r5, zero
 
@@ -42,9 +28,6 @@ ENTRY(__vfork)
        trap
 
        beq     r2, zero, 1f
-#ifdef RESET_PID
-       stw     r6, PID_OFFSET(r23)
-#endif
 1:
        ret
 
diff --git a/libc/sysdeps/linux/powerpc/Makefile.arch 
b/libc/sysdeps/linux/powerpc/Makefile.arch
index f0144e7..9dc27c4 100644
--- a/libc/sysdeps/linux/powerpc/Makefile.arch
+++ b/libc/sysdeps/linux/powerpc/Makefile.arch
@@ -10,9 +10,7 @@ CSRC-$(if $(UCLIBC_HAS_LONG_DOUBLE_MATH),,y) += copysignl.c
 
 SSRC-y := \
        __longjmp.S setjmp.S bsd-setjmp.S bsd-_setjmp.S brk.S \
-       __uClibc_syscall.S syscall.S
-
-SSRC-$(if $(UCLIBC_HAS_THREADS_NATIVE),,y) += clone.S vfork.S
+       __uClibc_syscall.S syscall.S clone.S vfork.S
 
 ifeq ($(CONFIG_E500),y)
 ARCH_HEADERS := fenv.h
diff --git a/libc/sysdeps/linux/powerpc/clone.S 
b/libc/sysdeps/linux/powerpc/clone.S
index 8efbbda..45319d0 100644
--- a/libc/sysdeps/linux/powerpc/clone.S
+++ b/libc/sysdeps/linux/powerpc/clone.S
@@ -47,14 +47,10 @@ __clone:
        /* Set up stack frame for parent.  */
        stwu    r1,-32(r1)
        cfi_adjust_cfa_offset (32)
-#ifdef RESET_PID
-       stmw    r28,16(r1)
-#else
-# ifndef __ASSUME_FIXED_CLONE_SYSCALL
+#ifndef __ASSUME_FIXED_CLONE_SYSCALL
        stmw    r29,16(r1)
-# else
+#else
        stmw    r30,16(r1)
-# endif
 #endif
 
        /* Set up stack frame for child.  */
@@ -67,9 +63,6 @@ __clone:
 #ifndef __ASSUME_FIXED_CLONE_SYSCALL
        mr      r29,r4                  /* Stack pointer in r29.  */
 #endif
-#ifdef RESET_PID
-       mr      r28,r5
-#endif
        mr      r31,r6                  /* Argument in r31.  */
 
        /* 'flags' argument is first parameter to clone syscall. (The other
@@ -101,17 +94,6 @@ __clone:
        mr      r1,r29
 #endif
 
-#ifdef RESET_PID
-       andis.  r0,r28,CLONE_THREAD>>16
-       bne+    r0,.Loldpid
-       andi.   r0,r28,CLONE_VM
-       li      r3,-1
-       bne-    r0,.Lnomoregetpid
-.Lnomoregetpid:
-       stw     r3,TID(r2)
-       stw     r3,PID(r2)
-.Loldpid:
-#endif
        /* Call procedure.  */
        mtctr   r30
        mr      r3,r31
@@ -121,14 +103,10 @@ __clone:
 
 .Lparent:
        /* Parent.  Restore registers & return.  */
-#ifdef RESET_PID
-       lmw     r28,16(r1)
-#else
-# ifndef __ASSUME_FIXED_CLONE_SYSCALL
+#ifndef __ASSUME_FIXED_CLONE_SYSCALL
        lmw     r29,16(r1)
-# else
+#else
        lmw     r30,16(r1)
-# endif
 #endif
        addi    r1,r1,32
        bnslr+
diff --git a/libc/sysdeps/linux/sh/Makefile.arch 
b/libc/sysdeps/linux/sh/Makefile.arch
index 99a7721..6103381 100644
--- a/libc/sysdeps/linux/sh/Makefile.arch
+++ b/libc/sysdeps/linux/sh/Makefile.arch
@@ -6,10 +6,7 @@
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 #
 
-CSRC-y := \
-       pipe.c __init_brk.c brk.c sbrk.c pread_write.c
-
-SSRC-y := setjmp.S __longjmp.S ___fpscr_values.S
+CSRC-y := pipe.c __init_brk.c brk.c sbrk.c pread_write.c
+SSRC-y := setjmp.S __longjmp.S ___fpscr_values.S clone.S vfork.S
 
 CSRC-$(UCLIBC_LINUX_SPECIFIC) += cacheflush.c
-SSRC-$(if $(UCLIBC_HAS_THREADS_NATIVE),,y) += clone.S vfork.S
diff --git a/libc/sysdeps/linux/sh/clone.S b/libc/sysdeps/linux/sh/clone.S
index 3ed6b25..334f83f 100644
--- a/libc/sysdeps/linux/sh/clone.S
+++ b/libc/sysdeps/linux/sh/clone.S
@@ -23,9 +23,7 @@
 #include <sysdep.h>
 #define _ERRNO_H       1
 #include <bits/errno.h>
-#ifdef RESET_PID
-#include <tcb-offsets.h>
-#endif
+
 /* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg,
             pid_t *ptid, void *tls, pid_t *ctid); */
 
@@ -85,29 +83,7 @@ ENTRY(__clone)
 2:
        /* terminate the stack frame */
        mov     #0, r14
-#ifdef RESET_PID
-       mov     r4, r0
-       shlr16  r0
-       tst     #1, r0                  // CLONE_THREAD = (1 << 16)
-       bf/s    4f
-        mov    r4, r0
-       /* new pid */
-       shlr8   r0
-       tst     #1, r0                  // CLONE_VM = (1 << 8)
-       bf/s    3f
-        mov    #-1, r0
-       mov     #+SYS_ify(getpid), r3
-       trapa   #0x15
-3:
-       stc     gbr, r1
-       mov.w   .Lpidoff, r2
-       add     r1, r2
-       mov.l   r0, @r2
-       mov.w   .Ltidoff, r2
-       add     r1, r2
-       mov.l   r0, @r2
-4:
-#endif
+
        /* thread starts */
        mov.l   @r15, r1
        jsr     @r1
@@ -138,12 +114,6 @@ ENTRY(__clone)
        .long   _GLOBAL_OFFSET_TABLE_
 .L3:
        .long   PLTJMP(C_SYMBOL_NAME(_exit))
-#ifdef RESET_PID
-.Lpidoff:
-       .word   PID - TLS_PRE_TCB_SIZE
-.Ltidoff:
-       .word   TID - TLS_PRE_TCB_SIZE
-#endif
-PSEUDO_END (__clone)
 
+PSEUDO_END (__clone)
 weak_alias (__clone, clone)
diff --git a/libc/sysdeps/linux/sparc/Makefile.arch 
b/libc/sysdeps/linux/sparc/Makefile.arch
index 92ea7d9..be393b8 100644
--- a/libc/sysdeps/linux/sparc/Makefile.arch
+++ b/libc/sysdeps/linux/sparc/Makefile.arch
@@ -6,12 +6,8 @@
 #
 
 CSRC-y := brk.c __syscall_error.c sigaction.c
-
-SSRC-y := \
-       __longjmp.S setjmp.S bsd-setjmp.S bsd-_setjmp.S \
-       syscall.S urem.S udiv.S umul.S sdiv.S rem.S pipe.S
-
-SSRC-$(if $(UCLIBC_HAS_THREADS_NATIVE),,y) += fork.S vfork.S clone.S
+SSRC-y := __longjmp.S setjmp.S bsd-setjmp.S bsd-_setjmp.S \
+       syscall.S urem.S udiv.S umul.S sdiv.S rem.S pipe.S fork.S vfork.S 
clone.S
 
 CSRC-$(UCLIBC_HAS_CONTEXT_FUNCS) += makecontext.c
 SSRC-$(UCLIBC_HAS_CONTEXT_FUNCS) += getcontext.S setcontext.S swapcontext.S
diff --git a/libc/sysdeps/linux/sparc/clone.S b/libc/sysdeps/linux/sparc/clone.S
index 1d0e3e6..3ee88da 100644
--- a/libc/sysdeps/linux/sparc/clone.S
+++ b/libc/sysdeps/linux/sparc/clone.S
@@ -22,9 +22,6 @@
 
 #include <asm/errno.h>
 #include <asm/unistd.h>
-#ifdef RESET_PID
-#include <tcb-offsets.h>
-#endif
 #include <sysdep.h>
 
 #define CLONE_VM       0x00000100
@@ -83,20 +80,6 @@ END(__clone)
 
        .type   __thread_start,@function
 __thread_start:
-#ifdef RESET_PID
-       sethi   %hi(CLONE_THREAD), %l0
-       andcc   %g4, %l0, %g0
-       bne     1f
-        andcc  %g4, CLONE_VM, %g0
-       bne,a   2f
-        mov    -1,%o0
-       set     __NR_getpid,%g1
-       ta      0x10
-2:
-       st      %o0,[%g7 + PID]
-       st      %o0,[%g7 + TID]
-1:
-#endif
        mov     %g0, %fp        /* terminate backtrace */
        call    %g2
         mov    %g3,%o0
diff --git a/libc/sysdeps/linux/sparc/vfork.S b/libc/sysdeps/linux/sparc/vfork.S
index e5a3c30..5b05e64 100644
--- a/libc/sysdeps/linux/sparc/vfork.S
+++ b/libc/sysdeps/linux/sparc/vfork.S
@@ -16,8 +16,6 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-/* Code taken from glibc2.2.2/sysdeps/unix/sysv/linux/sparc/vfork.S */
-
 #include <sys/syscall.h>
 
 #ifndef __NR_vfork
diff --git a/libc/sysdeps/linux/x86_64/Makefile.arch 
b/libc/sysdeps/linux/x86_64/Makefile.arch
index 2bc838f..d84e43d 100644
--- a/libc/sysdeps/linux/x86_64/Makefile.arch
+++ b/libc/sysdeps/linux/x86_64/Makefile.arch
@@ -6,11 +6,9 @@
 #
 
 CSRC-y := brk.c __syscall_error.c sigaction.c
+SSRC-y := __longjmp.S setjmp.S syscall.S bsd-setjmp.S bsd-_setjmp.S \
+         vfork.S clone.S
 
-SSRC-y := \
-       __longjmp.S setjmp.S syscall.S bsd-setjmp.S bsd-_setjmp.S
-
-SSRC-$(if $(UCLIBC_HAS_THREADS_NATIVE),,y) += vfork.S clone.S
 ARCH_OBJ_FILTEROUT-$(UCLIBC_LINUX_SPECIFIC) := sched_getcpu.c
 ifeq ($(UCLIBC_LINUX_SPECIFIC),y)
 SSRC-$(UCLIBC_HAS_TLS) += sched_getcpu.S
diff --git a/libc/sysdeps/linux/x86_64/clone.S 
b/libc/sysdeps/linux/x86_64/clone.S
index 3745041..3dda8da 100644
--- a/libc/sysdeps/linux/x86_64/clone.S
+++ b/libc/sysdeps/linux/x86_64/clone.S
@@ -89,19 +89,6 @@ clone:
           the outermost frame obviously.  */
        xorl    %ebp, %ebp
 
-#ifdef RESET_PID
-       testq   $CLONE_THREAD, %rdi
-       jne     1f
-       testq   $CLONE_VM, %rdi
-       movl    $-1, %eax
-       jne     2f
-       movl    $__NR_getpid, %eax
-       syscall
-2:     movl    %eax, %fs:PID
-       movl    %eax, %fs:TID
-1:
-#endif
-
        /* Set up arguments for the function call.  */
        popq    %rax            /* Function to call.  */
        popq    %rdi            /* Argument.  */
diff --git a/libc/sysdeps/linux/x86_64/vfork.S 
b/libc/sysdeps/linux/x86_64/vfork.S
index a8a2f6e..8e096bc 100644
--- a/libc/sysdeps/linux/x86_64/vfork.S
+++ b/libc/sysdeps/linux/x86_64/vfork.S
@@ -38,10 +38,6 @@ __vfork:
           is preserved by the syscall and that we're allowed to destroy. */
        popq    %rdi
 
-#ifdef SAVE_PID
-       SAVE_PID
-#endif
-
        /* Stuff the syscall number in RAX and enter into the kernel.  */
        movl    $__NR_vfork, %eax
        syscall
@@ -49,10 +45,6 @@ __vfork:
        /* Push back the return PC.  */
        pushq   %rdi
 
-#ifdef RESTORE_PID
-       RESTORE_PID
-#endif
-
        cmpl    $-4095, %eax
        jae __syscall_error             /* Branch forward if it failed.  */
 
diff --git a/libc/sysdeps/linux/xtensa/Makefile.arch 
b/libc/sysdeps/linux/xtensa/Makefile.arch
index b9b6b87..23cd08e 100644
--- a/libc/sysdeps/linux/xtensa/Makefile.arch
+++ b/libc/sysdeps/linux/xtensa/Makefile.arch
@@ -6,9 +6,7 @@
 #
 
 CSRC-y := brk.c sigaction.c __syscall_error.c
-
 SSRC-y := bsd-_setjmp.S bsd-setjmp.S setjmp.S clone.S \
-       sigrestorer.S syscall.S mmap.S windowspill.S __longjmp.S vfork.S
+         sigrestorer.S syscall.S mmap.S windowspill.S __longjmp.S vfork.S
 
 CSRC-$(if $(UCLIBC_HAS_THREADS_NATIVE),,y) += fork.c
-SSRC-$(if $(UCLIBC_HAS_THREADS_NATIVE),,y) += clone.S
diff --git a/libc/sysdeps/linux/xtensa/clone.S 
b/libc/sysdeps/linux/xtensa/clone.S
index efdfcdd..913ec5a 100644
--- a/libc/sysdeps/linux/xtensa/clone.S
+++ b/libc/sysdeps/linux/xtensa/clone.S
@@ -21,9 +21,6 @@
 #include <sysdep.h>
 #define _ERRNO_H       1
 #include <bits/errno.h>
-#ifdef RESET_PID
-#include <tls.h>
-#endif
 #define __ASSEMBLY__
 #include <linux/sched.h>
 
@@ -76,21 +73,6 @@ ENTRY (__clone)
 # error invalid values for CLONE_THREAD or CLONE_VM
 #endif
 
-#ifdef RESET_PID
-       bbsi.l  a6, 16, .Lskip_restore_pid      /* CLONE_THREAD = 0x00010000 */
-       movi    a2, -1
-       bbsi    a6, 8, .Lgotpid                 /* CLONE_VM     = 0x00000100 */
-       movi    a2, SYS_ify(getpid)
-       syscall
-.Lgotpid:
-       rur     a3, threadptr
-       movi    a0, TLS_PRE_TCB_SIZE
-       sub     a3, a3, a0
-       s32i    a2, a3, PID
-       s32i    a2, a3, TID
-.Lskip_restore_pid:
-#endif
-
        /* start child thread */
        movi    a0, 0                   /* terminate the stack frame */
 
@@ -115,5 +97,4 @@ ENTRY (__clone)
 #endif
 
 PSEUDO_END (__clone)
-
 weak_alias (__clone, clone)
diff --git a/libc/sysdeps/linux/xtensa/vfork.S 
b/libc/sysdeps/linux/xtensa/vfork.S
index 8058fb0..140ab77 100644
--- a/libc/sysdeps/linux/xtensa/vfork.S
+++ b/libc/sysdeps/linux/xtensa/vfork.S
@@ -34,16 +34,6 @@
 
 */
 
-#ifndef SAVE_PID
-#define SAVE_PID(a,b,c,d)
-#endif
-#ifndef RESTORE_PID
-#define RESTORE_PID(a,b,c)
-#endif
-#ifndef RESTORE_PID12
-#define RESTORE_PID12(a,b,c)
-#endif
-
 /*
    pid_t vfork(void);
    Implemented as __clone_syscall(CLONE_VFORK | CLONE_VM | SIGCHLD, 0)
@@ -73,8 +63,6 @@ HIDDEN_ENTRY (__vfork)
 .L4:   mov     a12, a2
        mov     a13, a3
 
-       SAVE_PID(a5,a15,a2,a3)
-
        /* use syscall 'clone' and set new stack pointer to the same address */
 
        movi    a2, SYS_ify(clone)
@@ -83,8 +71,6 @@ HIDDEN_ENTRY (__vfork)
 
         syscall
 
-       RESTORE_PID(a5,a15,a2)
-
        movi    a5, -4096
 
        mov     a6, a2
@@ -102,16 +88,12 @@ HIDDEN_ENTRY (__vfork)
        mov     a13, a3
        mov     a14, a6
 
-       SAVE_PID(a9,a15,a2,a3)
-
        movi    a2, SYS_ify(clone)
        movi    a3, 0
        movi    a6, CLONE_VM | CLONE_VFORK | SIGCHLD
 
        syscall
 
-       RESTORE_PID(a9,a15,a2)
-
        movi    a9, -4096
 
        mov     a10, a2
@@ -131,16 +113,12 @@ HIDDEN_ENTRY (__vfork)
        mov     a13, a3
        mov     a14, a6
 
-       SAVE_PID (a2,a3,a2,a6)
-
        movi    a2, SYS_ify(clone)
        movi    a3, 0
        movi    a6, CLONE_VM | CLONE_VFORK | SIGCHLD
 
        syscall
 
-       RESTORE_PID12(a3,a6,a15)
-
        mov     a3, a13
        movi    a13, -4096
 
@@ -168,7 +146,6 @@ HIDDEN_ENTRY (__vfork)
 .Lpseudo_end:
        retw
 #elif defined(__XTENSA_CALL0_ABI__)
-       SAVE_PID(a5, a8, a3, a4)
 
        /* Use syscall 'clone'.  Set new stack pointer to the same address.  */
        movi    a2, SYS_ify (clone)
@@ -176,8 +153,6 @@ HIDDEN_ENTRY (__vfork)
        movi    a6, CLONE_VM | CLONE_VFORK | SIGCHLD
        syscall
 
-       RESTORE_PID(a5, a8, a2)
-
        movi    a3, -4096
        bgeu    a2, a3, 1f
        ret
diff --git a/libpthread/nptl/allocatestack.c b/libpthread/nptl/allocatestack.c
index 39ec857..ccf34d6 100644
--- a/libpthread/nptl/allocatestack.c
+++ b/libpthread/nptl/allocatestack.c
@@ -418,9 +418,6 @@ allocate_stack (const struct pthread_attr *attr, struct 
pthread **pdp,
       THREAD_SYSINFO(pd) = THREAD_SELF_SYSINFO;
 #endif
 
-      /* The process ID is also the same as that of the caller.  */
-      pd->pid = THREAD_GETMEM (THREAD_SELF, pid);
-
       /* Allocate the DTV for this thread.  */
       if (_dl_allocate_tls (TLS_TPADJ (pd)) == NULL)
        {
@@ -556,9 +553,6 @@ allocate_stack (const struct pthread_attr *attr, struct 
pthread **pdp,
          THREAD_SYSINFO(pd) = THREAD_SELF_SYSINFO;
 #endif
 
-         /* The process ID is also the same as that of the caller.  */
-         pd->pid = THREAD_GETMEM (THREAD_SELF, pid);
-
          /* Allocate the DTV for this thread.  */
          if (_dl_allocate_tls (TLS_TPADJ (pd)) == NULL)
            {
@@ -833,9 +827,6 @@ __reclaim_stacks (void)
          /* This marks the stack as free.  */
          curp->tid = 0;
 
-         /* The PID field must be initialized for the new process.  */
-         curp->pid = self->pid;
-
          /* Account for the size of the stack.  */
          stack_cache_actsize += curp->stackblock_size;
 
@@ -862,13 +853,6 @@ __reclaim_stacks (void)
        }
     }
 
-  /* Reset the PIDs in any cached stacks.  */
-  list_for_each (runp, &stack_cache)
-    {
-      struct pthread *curp = list_entry (runp, struct pthread, list);
-      curp->pid = self->pid;
-    }
-
   /* Add the stack of all running threads to the cache.  */
   list_splice (&stack_used, &stack_cache);
 
@@ -995,9 +979,9 @@ setxid_signal_thread (struct xid_command *cmdp, struct 
pthread *t)
     return 0;
 
   int val;
+  pid_t pid = getpid ();
   INTERNAL_SYSCALL_DECL (err);
-  val = INTERNAL_SYSCALL (tgkill, err, 3, THREAD_GETMEM (THREAD_SELF, pid),
-                         t->tid, SIGSETXID);
+  val = INTERNAL_SYSCALL (tgkill, err, 3, pid, t->tid, SIGSETXID);
 
   /* If this failed, it must have had not started yet or else exited.  */
   if (!INTERNAL_SYSCALL_ERROR_P (val, err))
diff --git a/libpthread/nptl/descr.h b/libpthread/nptl/descr.h
index 3fda681..30a4f4b 100644
--- a/libpthread/nptl/descr.h
+++ b/libpthread/nptl/descr.h
@@ -153,7 +153,7 @@ struct pthread
   pid_t tid;
 
   /* Process ID - thread group ID in kernel speak.  */
-  pid_t pid;
+  pid_t pid_unused;
 
   /* List of robust mutexes the thread is holding.  */
 #ifdef __PTHREAD_MUTEX_HAVE_PREV
diff --git a/libpthread/nptl/init.c b/libpthread/nptl/init.c
index 0e1c60c..09220c2 100644
--- a/libpthread/nptl/init.c
+++ b/libpthread/nptl/init.c
@@ -64,24 +64,13 @@ static const char nptl_version[] __attribute_used__ = 
VERSION;
 static void
 sigcancel_handler (int sig, siginfo_t *si, void *ctx)
 {
-#ifdef __ASSUME_CORRECT_SI_PID
-  /* Determine the process ID.  It might be negative if the thread is
-     in the middle of a fork() call.  */
-  pid_t pid = THREAD_GETMEM (THREAD_SELF, pid);
-  if (__builtin_expect (pid < 0, 0))
-    pid = -pid;
-#endif
 
   /* Safety check.  It would be possible to call this function for
      other signals and send a signal from another process.  This is not
      correct and might even be a security problem.  Try to catch as
      many incorrect invocations as possible.  */
   if (sig != SIGCANCEL
-#ifdef __ASSUME_CORRECT_SI_PID
-      /* Kernels before 2.5.75 stored the thread ID and not the process
-        ID in si_pid so we skip this test.  */
-      || si->si_pid != pid
-#endif
+      || si->si_pid != getpid()
       || si->si_code != SI_TKILL)
     return;
 
@@ -125,24 +114,13 @@ struct xid_command *__xidcmd attribute_hidden;
 static void
 sighandler_setxid (int sig, siginfo_t *si, void *ctx)
 {
-#ifdef __ASSUME_CORRECT_SI_PID
-  /* Determine the process ID.  It might be negative if the thread is
-     in the middle of a fork() call.  */
-  pid_t pid = THREAD_GETMEM (THREAD_SELF, pid);
-  if (__builtin_expect (pid < 0, 0))
-    pid = -pid;
-#endif
 
   /* Safety check.  It would be possible to call this function for
      other signals and send a signal from another process.  This is not
      correct and might even be a security problem.  Try to catch as
      many incorrect invocations as possible.  */
   if (sig != SIGSETXID
-#ifdef __ASSUME_CORRECT_SI_PID
-      /* Kernels before 2.5.75 stored the thread ID and not the process
-        ID in si_pid so we skip this test.  */
-      || si->si_pid != pid
-#endif
+      || si->si_pid != getpid()
       || si->si_code != SI_TKILL)
     return;
 
@@ -191,7 +169,7 @@ __pthread_initialize_minimal_internal (void)
   /* Minimal initialization of the thread descriptor.  */
   struct pthread *pd = THREAD_SELF;
   INTERNAL_SYSCALL_DECL (err);
-  pd->pid = pd->tid = INTERNAL_SYSCALL (set_tid_address, err, 1, &pd->tid);
+  pd->tid = INTERNAL_SYSCALL (set_tid_address, err, 1, &pd->tid);
   THREAD_SETMEM (pd, specific[0], &pd->specific_1stblock[0]);
   THREAD_SETMEM (pd, user_stack, true);
   if (LLL_LOCK_INITIALIZER != 0)
diff --git a/libpthread/nptl/pthread_cancel.c b/libpthread/nptl/pthread_cancel.c
index ee9a320..d3fd140 100644
--- a/libpthread/nptl/pthread_cancel.c
+++ b/libpthread/nptl/pthread_cancel.c
@@ -21,6 +21,7 @@
 #include "pthreadP.h"
 #include "atomic.h"
 #include <sysdep.h>
+#include <unistd.h>
 #include <bits/kernel-features.h>
 
 
@@ -74,10 +75,9 @@ pthread_cancel (
             the thread is executing fork, it would have to happen in
             a signal handler.  But this is no allowed, pthread_cancel
             is not guaranteed to be async-safe.  */
+         pid_t pid = getpid ();
          int val;
-         val = INTERNAL_SYSCALL (tgkill, err, 3,
-                                 THREAD_GETMEM (THREAD_SELF, pid), pd->tid,
-                                 SIGCANCEL);
+         val = INTERNAL_SYSCALL (tgkill, err, 3, pid, pd->tid, SIGCANCEL);
 
          if (INTERNAL_SYSCALL_ERROR_P (val, err))
            result = INTERNAL_SYSCALL_ERRNO (val, err);
diff --git a/libpthread/nptl/sysdeps/alpha/tcb-offsets.sym 
b/libpthread/nptl/sysdeps/alpha/tcb-offsets.sym
index c21a791..1005621 100644
--- a/libpthread/nptl/sysdeps/alpha/tcb-offsets.sym
+++ b/libpthread/nptl/sysdeps/alpha/tcb-offsets.sym
@@ -10,5 +10,4 @@
 #define thread_offsetof(mem)   (long)(offsetof(struct pthread, mem) - 
sizeof(struct pthread))
 
 MULTIPLE_THREADS_OFFSET                thread_offsetof 
(header.multiple_threads)
-PID_OFFSET                     thread_offsetof (pid)
 TID_OFFSET                     thread_offsetof (tid)
diff --git a/libpthread/nptl/sysdeps/arc/tcb-offsets.sym 
b/libpthread/nptl/sysdeps/arc/tcb-offsets.sym
index cbf0ae4..519a629 100644
--- a/libpthread/nptl/sysdeps/arc/tcb-offsets.sym
+++ b/libpthread/nptl/sysdeps/arc/tcb-offsets.sym
@@ -2,7 +2,6 @@
 #include <tls.h>
 
 PTHREAD_TID            offsetof (struct pthread, tid)
-PTHREAD_PID            offsetof (struct pthread, pid)
 MULTIPLE_THREADS_OFFSET        offsetof (struct pthread, 
header.multiple_threads)
 TLS_PRE_TCB_SIZE       sizeof (struct pthread)
 TLS_TCB_SIZE            sizeof(tcbhead_t)
diff --git a/libpthread/nptl/sysdeps/arm/tcb-offsets.sym 
b/libpthread/nptl/sysdeps/arm/tcb-offsets.sym
index 92cc441..bf9c0a1 100644
--- a/libpthread/nptl/sysdeps/arm/tcb-offsets.sym
+++ b/libpthread/nptl/sysdeps/arm/tcb-offsets.sym
@@ -7,5 +7,4 @@
 #define thread_offsetof(mem)   (long)(offsetof(struct pthread, mem) - 
sizeof(struct pthread))
 
 MULTIPLE_THREADS_OFFSET                thread_offsetof 
(header.multiple_threads)
-PID_OFFSET                     thread_offsetof (pid)
 TID_OFFSET                     thread_offsetof (tid)
diff --git a/libpthread/nptl/sysdeps/i386/tcb-offsets.sym 
b/libpthread/nptl/sysdeps/i386/tcb-offsets.sym
index 69f9deb..990ac7a 100644
--- a/libpthread/nptl/sysdeps/i386/tcb-offsets.sym
+++ b/libpthread/nptl/sysdeps/i386/tcb-offsets.sym
@@ -3,7 +3,6 @@
 
 RESULT                 offsetof (struct pthread, result)
 TID                    offsetof (struct pthread, tid)
-PID                    offsetof (struct pthread, pid)
 CANCELHANDLING         offsetof (struct pthread, cancelhandling)
 CLEANUP_JMP_BUF                offsetof (struct pthread, cleanup_jmp_buf)
 MULTIPLE_THREADS_OFFSET        offsetof (tcbhead_t, multiple_threads)
diff --git a/libpthread/nptl/sysdeps/metag/tcb-offsets.sym 
b/libpthread/nptl/sysdeps/metag/tcb-offsets.sym
index 753b72b..852b5cc 100644
--- a/libpthread/nptl/sysdeps/metag/tcb-offsets.sym
+++ b/libpthread/nptl/sysdeps/metag/tcb-offsets.sym
@@ -3,7 +3,6 @@
 
 RESULT                 offsetof (struct pthread, result)
 TID                    offsetof (struct pthread, tid)
-PID                    offsetof (struct pthread, pid)
 CANCELHANDLING         offsetof (struct pthread, cancelhandling)
 CLEANUP_JMP_BUF                offsetof (struct pthread, cleanup_jmp_buf)
 MULTIPLE_THREADS_OFFSET        offsetof (struct pthread, 
header.multiple_threads)
diff --git a/libpthread/nptl/sysdeps/microblaze/tcb-offsets.sym 
b/libpthread/nptl/sysdeps/microblaze/tcb-offsets.sym
index 18afbee..614f0df 100644
--- a/libpthread/nptl/sysdeps/microblaze/tcb-offsets.sym
+++ b/libpthread/nptl/sysdeps/microblaze/tcb-offsets.sym
@@ -7,5 +7,4 @@
 #define thread_offsetof(mem)   (long)(offsetof (struct pthread, mem) - sizeof 
(struct pthread))
 
 MULTIPLE_THREADS_OFFSET        thread_offsetof (header.multiple_threads)
-PID_OFFSET                     thread_offsetof (pid)
 TID_OFFSET                     thread_offsetof (tid)
diff --git a/libpthread/nptl/sysdeps/mips/tcb-offsets.sym 
b/libpthread/nptl/sysdeps/mips/tcb-offsets.sym
index e0e71dc..9ea25b9 100644
--- a/libpthread/nptl/sysdeps/mips/tcb-offsets.sym
+++ b/libpthread/nptl/sysdeps/mips/tcb-offsets.sym
@@ -7,5 +7,4 @@
 #define thread_offsetof(mem)   (long)(offsetof(struct pthread, mem) - 
TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE)
 
 MULTIPLE_THREADS_OFFSET                thread_offsetof 
(header.multiple_threads)
-PID_OFFSET                     thread_offsetof (pid)
 TID_OFFSET                     thread_offsetof (tid)
diff --git a/libpthread/nptl/sysdeps/nds32/tcb-offsets.sym 
b/libpthread/nptl/sysdeps/nds32/tcb-offsets.sym
index 3b9e101..6701626 100644
--- a/libpthread/nptl/sysdeps/nds32/tcb-offsets.sym
+++ b/libpthread/nptl/sysdeps/nds32/tcb-offsets.sym
@@ -7,6 +7,5 @@
 #define thread_offsetof(mem)    (long)(offsetof(struct pthread, mem) - 
TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE)
 
 MULTIPLE_THREADS_OFFSET         thread_offsetof (header.multiple_threads)
-PID_OFFSET                      thread_offsetof (pid)
 TID_OFFSET                      thread_offsetof (tid)
 
diff --git a/libpthread/nptl/sysdeps/nios2/tcb-offsets.sym 
b/libpthread/nptl/sysdeps/nios2/tcb-offsets.sym
index d9ae952..3cd8d98 100644
--- a/libpthread/nptl/sysdeps/nios2/tcb-offsets.sym
+++ b/libpthread/nptl/sysdeps/nios2/tcb-offsets.sym
@@ -9,6 +9,5 @@
 # define thread_offsetof(mem)   ((ptrdiff_t) THREAD_SELF + offsetof (struct 
pthread, mem))
 
 MULTIPLE_THREADS_OFFSET                thread_offsetof 
(header.multiple_threads)
-PID_OFFSET                     thread_offsetof (pid)
 TID_OFFSET                     thread_offsetof (tid)
 POINTER_GUARD                  (offsetof (tcbhead_t, pointer_guard) - 
TLS_TCB_OFFSET - sizeof (tcbhead_t))
diff --git a/libpthread/nptl/sysdeps/powerpc/tcb-offsets.sym 
b/libpthread/nptl/sysdeps/powerpc/tcb-offsets.sym
index 8ac133d..0bd16fb 100644
--- a/libpthread/nptl/sysdeps/powerpc/tcb-offsets.sym
+++ b/libpthread/nptl/sysdeps/powerpc/tcb-offsets.sym
@@ -12,7 +12,6 @@
 #if TLS_MULTIPLE_THREADS_IN_TCB
 MULTIPLE_THREADS_OFFSET                thread_offsetof 
(header.multiple_threads)
 #endif
-PID                            thread_offsetof (pid)
 TID                            thread_offsetof (tid)
 POINTER_GUARD                  (offsetof (tcbhead_t, pointer_guard) - 
TLS_TCB_OFFSET - sizeof (tcbhead_t))
 #ifndef __ASSUME_PRIVATE_FUTEX
diff --git a/libpthread/nptl/sysdeps/pthread/createthread.c 
b/libpthread/nptl/sysdeps/pthread/createthread.c
index ebfee16..550bf2c 100644
--- a/libpthread/nptl/sysdeps/pthread/createthread.c
+++ b/libpthread/nptl/sysdeps/pthread/createthread.c
@@ -91,6 +91,7 @@ do_clone (struct pthread *pd, const struct pthread_attr *attr,
   if (__builtin_expect (stopped != 0, 0))
     {
       INTERNAL_SYSCALL_DECL (err);
+      pid_t pid = getpid ();
       int res = 0;
 
       /* Set the affinity mask if necessary.  */
@@ -105,9 +106,7 @@ do_clone (struct pthread *pd, const struct pthread_attr 
*attr,
                 send it the cancellation signal.  */
              INTERNAL_SYSCALL_DECL (err2);
            err_out:
-             (void) INTERNAL_SYSCALL (tgkill, err2, 3,
-                                      THREAD_GETMEM (THREAD_SELF, pid),
-                                      pd->tid, SIGCANCEL);
+             (void) INTERNAL_SYSCALL (tgkill, err2, 3, pid, pd->tid, 
SIGCANCEL);
 
              return (INTERNAL_SYSCALL_ERROR_P (res, err)
                      ? INTERNAL_SYSCALL_ERRNO (res, err)
diff --git a/libpthread/nptl/sysdeps/sh/tcb-offsets.sym 
b/libpthread/nptl/sysdeps/sh/tcb-offsets.sym
index 753b72b..852b5cc 100644
--- a/libpthread/nptl/sysdeps/sh/tcb-offsets.sym
+++ b/libpthread/nptl/sysdeps/sh/tcb-offsets.sym
@@ -3,7 +3,6 @@
 
 RESULT                 offsetof (struct pthread, result)
 TID                    offsetof (struct pthread, tid)
-PID                    offsetof (struct pthread, pid)
 CANCELHANDLING         offsetof (struct pthread, cancelhandling)
 CLEANUP_JMP_BUF                offsetof (struct pthread, cleanup_jmp_buf)
 MULTIPLE_THREADS_OFFSET        offsetof (struct pthread, 
header.multiple_threads)
diff --git a/libpthread/nptl/sysdeps/sparc/tcb-offsets.sym 
b/libpthread/nptl/sysdeps/sparc/tcb-offsets.sym
index 923af8a..f75d020 100644
--- a/libpthread/nptl/sysdeps/sparc/tcb-offsets.sym
+++ b/libpthread/nptl/sysdeps/sparc/tcb-offsets.sym
@@ -3,5 +3,4 @@
 
 MULTIPLE_THREADS_OFFSET                offsetof (tcbhead_t, multiple_threads)
 POINTER_GUARD                  offsetof (tcbhead_t, pointer_guard)
-PID                            offsetof (struct pthread, pid)
 TID                            offsetof (struct pthread, tid)
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/alpha/clone.S 
b/libpthread/nptl/sysdeps/unix/sysv/linux/alpha/clone.S
deleted file mode 100644
index eea1cbe..0000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/alpha/clone.S
+++ /dev/null
@@ -1,2 +0,0 @@
-#define RESET_PID
-#include <sysdeps/unix/sysv/linux/alpha/clone.S>
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/alpha/vfork.S 
b/libpthread/nptl/sysdeps/unix/sysv/linux/alpha/vfork.S
deleted file mode 100644
index 664cac4..0000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/alpha/vfork.S
+++ /dev/null
@@ -1,45 +0,0 @@
-/* Copyright (C) 2004 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, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <tcb-offsets.h>
-
-#undef PSEUDO_PREPARE_ARGS
-#define PSEUDO_PREPARE_ARGS                                            \
-       /* Load the current cached pid value across the vfork.  */      \
-       rduniq;                                                         \
-       ldl     a2, PID_OFFSET(v0);                                     \
-       mov     v0, a1;                                                 \
-       /* If the cached value is initialized (nonzero), then write     \
-          back its negation, or INT_MIN, to indicate that the pid      \
-          value is uninitialized in the the child, and in the window   \
-          between here and the point at which we restore the value.  */ \
-       ldah    t0, -0x8000;                                            \
-       negl    a2, t1;                                                 \
-       cmovne  a2, t1, t0;                                             \
-       stl     t0, PID_OFFSET(v0);
-
-PSEUDO (__vfork, vfork, 0)
-
-       /* If we're back in the parent, restore the saved pid.  */
-       beq     v0, 1f
-       stl     a2, PID_OFFSET(a1)
-1:     ret
-
-PSEUDO_END (__vfork)
-libc_hidden_def (__vfork)
-weak_alias (__vfork, vfork)
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/arc/Makefile.arch 
b/libpthread/nptl/sysdeps/unix/sysv/linux/arc/Makefile.arch
index fa5d530..64f3a4f 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/arc/Makefile.arch
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/arc/Makefile.arch
@@ -9,6 +9,3 @@ libpthread_linux_arch_SSRC =
 libpthread_linux_arch_CSRC = pthread_once.c
 
 libc_linux_arch_CSRC = fork.c
-libc_linux_arch_SSRC = clone.S vfork.S
-libc_linux_arch_SSRC-OMIT = waitpid.S
-
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/arc/clone.S 
b/libpthread/nptl/sysdeps/unix/sysv/linux/arc/clone.S
deleted file mode 100644
index 5fd1de3..0000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/arc/clone.S
+++ /dev/null
@@ -1,10 +0,0 @@
-/*
- * Copyright (C) 2013 Synopsys, Inc. (www.synopsys.com)
- *
- * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this 
tarball.
- */
-
-#define RESET_PID
-#include <tls.h>
-#include <tcb-offsets.h>
-#include "../../../../../../../libc/sysdeps/linux/arc/clone.S"
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/arc/vfork.S 
b/libpthread/nptl/sysdeps/unix/sysv/linux/arc/vfork.S
deleted file mode 100644
index d29e05a..0000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/arc/vfork.S
+++ /dev/null
@@ -1,11 +0,0 @@
-/*
- * Copyright (C) 2013 Synopsys, Inc. (www.synopsys.com)
- *
- * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this 
tarball.
- */
-
-#define SAVE_PID
-#define RESTORE_PID
-#include <tls.h>
-#include <tcb-offsets.h>
-#include "../../../../../../../libc/sysdeps/linux/arc/vfork.S"
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/Makefile.arch 
b/libpthread/nptl/sysdeps/unix/sysv/linux/arm/Makefile.arch
index 49d0684..55afe20 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/Makefile.arch
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/arm/Makefile.arch
@@ -9,11 +9,3 @@ libpthread_linux_arch_SSRC =
 libpthread_linux_arch_CSRC = pthread_once.c
 
 libc_linux_arch_CSRC = fork.c
-libc_linux_arch_SSRC = clone.S vfork.S
-libc_linux_arch_SSRC-OMIT = waitpid.S
-
-# We always compile it in arm mode because of SAVE_PID macro
-# This macro should be alternatively implemented in THUMB
-# assembly.
-ASFLAGS-vfork.S = -marm
-CFLAGS-OMIT-vfork.S = -mthumb
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/clone.S 
b/libpthread/nptl/sysdeps/unix/sysv/linux/arm/clone.S
deleted file mode 100644
index 23227eb..0000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/clone.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#define RESET_PID
-#include <tcb-offsets.h>
-#include "../../../../../../../libc/sysdeps/linux/arm/clone.S"
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/vfork.S 
b/libpthread/nptl/sysdeps/unix/sysv/linux/arm/vfork.S
deleted file mode 100644
index b9e8cf8..0000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/vfork.S
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Copyright (C) 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, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <tcb-offsets.h>
-
-/* Save the PID value.  */
-#define SAVE_PID \
-       str     lr, [sp, #-4]!;         /* Save LR.  */                 \
-       mov     r0, #0xffff0fff;        /* Point to the high page.  */  \
-       mov     lr, pc;                 /* Save our return address.  */ \
-       sub     pc, r0, #31;            /* Jump to the TLS entry.  */   \
-       ldr     lr, [sp], #4;           /* Restore LR.  */              \
-       mov     r2, r0;                 /* Save the TLS addr in r2.  */ \
-       ldr     r3, [r2, #PID_OFFSET];  /* Load the saved PID.  */      \
-       rsbs    r0, r3, #0;             /* Negate it.  */               \
-       moveq   r0, #0x80000000;        /* Use 0x80000000 if it was 0.  */ \
-       str     r0, [r2, #PID_OFFSET]   /* Store the temporary PID.  */
-
-/* Restore the old PID value in the parent.  */
-#define RESTORE_PID \
-       cmp     r0, #0;                 /* If we are the parent... */   \
-       strne   r3, [r2, #PID_OFFSET]   /* ... restore the saved PID.  */
-
-#include "../../../../../../../libc/sysdeps/linux/arm/vfork.S"
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/fork.c 
b/libpthread/nptl/sysdeps/unix/sysv/linux/fork.c
index af40410..49806da 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/fork.c
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/fork.c
@@ -135,12 +135,6 @@ fork (void)
   pid_t ppid = THREAD_GETMEM (THREAD_SELF, tid);
 #endif
 
-  /* We need to prevent the getpid() code to update the PID field so
-     that, if a signal arrives in the child very early and the signal
-     handler uses getpid(), the value returned is correct.  */
-  pid_t parentpid = THREAD_GETMEM (THREAD_SELF, pid);
-  THREAD_SETMEM (THREAD_SELF, pid, -parentpid);
-
 #ifdef ARCH_FORK
   pid = ARCH_FORK ();
 #else
@@ -158,9 +152,6 @@ fork (void)
       if (__fork_generation_pointer != NULL)
        *__fork_generation_pointer += 4;
 
-      /* Adjust the PID field for the new process.  */
-      THREAD_SETMEM (self, pid, THREAD_GETMEM (self, tid));
-
 #if HP_TIMING_AVAIL
       /* The CPU clock of the thread and process have to be set to zero.  */
       hp_timing_t now;
@@ -206,9 +197,6 @@ fork (void)
     {
       assert (THREAD_GETMEM (THREAD_SELF, tid) == ppid);
 
-      /* Restore the PID value.  */
-      THREAD_SETMEM (THREAD_SELF, pid, parentpid);
-
       /* We execute this even if the 'fork' call failed.  */
       __UCLIBC_IO_MUTEX_UNLOCK_CANCEL_UNSAFE(_stdio_openlist_add_lock);
 
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/getpid.c 
b/libpthread/nptl/sysdeps/unix/sysv/linux/getpid.c
index 24abccc..03b1031 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/getpid.c
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/getpid.c
@@ -25,41 +25,11 @@
 # define __NR_getpid __NR_getxpid
 #endif
 
-#ifndef NOT_IN_libc
-static inline __attribute__((always_inline)) pid_t really_getpid (pid_t 
oldval);
-
-static inline __attribute__((always_inline)) pid_t
-really_getpid (pid_t oldval)
-{
-  if (__builtin_expect (oldval == 0, 1))
-    {
-      pid_t selftid = THREAD_GETMEM (THREAD_SELF, tid);
-      if (__builtin_expect (selftid != 0, 1))
-       return selftid;
-    }
-
-  INTERNAL_SYSCALL_DECL (err);
-  pid_t result = INTERNAL_SYSCALL (getpid, err, 0);
-
-  /* We do not set the PID field in the TID here since we might be
-     called from a signal handler while the thread executes fork.  */
-  if (oldval == 0)
-    THREAD_SETMEM (THREAD_SELF, tid, result);
-  return result;
-}
-#endif
-
 static pid_t
 __getpid (void)
 {
-#ifdef NOT_IN_libc
   INTERNAL_SYSCALL_DECL (err);
   pid_t result = INTERNAL_SYSCALL (getpid, err, 0);
-#else
-  pid_t result = THREAD_GETMEM (THREAD_SELF, pid);
-  if (__builtin_expect (result <= 0, 0))
-    result = really_getpid (result);
-#endif
   return result;
 }
 weak_alias(__getpid, getpid)
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/i386/Makefile.arch 
b/libpthread/nptl/sysdeps/unix/sysv/linux/i386/Makefile.arch
index be07d9c..ee38a69 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/i386/Makefile.arch
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/i386/Makefile.arch
@@ -5,11 +5,9 @@
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 #
 
-libpthread_linux_arch_SSRC = clone.S pthread_spin_unlock.S pthread_once.S
+libpthread_linux_arch_SSRC = pthread_spin_unlock.S pthread_once.S
 libpthread_linux_arch_CSRC = pthread_spin_init.c
 
 libc_linux_arch_CSRC = fork.c
-libc_linux_arch_SSRC = clone.S vfork.S
 
 ASFLAGS += -DUSE___THREAD
-
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/i386/clone.S 
b/libpthread/nptl/sysdeps/unix/sysv/linux/i386/clone.S
deleted file mode 100644
index 9c7c464..0000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/i386/clone.S
+++ /dev/null
@@ -1,2 +0,0 @@
-#define RESET_PID
-#include <libc/sysdeps/linux/i386/clone.S>
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/i386/vfork.S 
b/libpthread/nptl/sysdeps/unix/sysv/linux/i386/vfork.S
deleted file mode 100644
index 074f0f0..0000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/i386/vfork.S
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Copyright (C) 1999,2002,2004,2006 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, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <tcb-offsets.h>
-
-/* Save the PID value.  */
-#define SAVE_PID \
-       movl    %gs:PID, %edx;                                                \
-       movl    %edx, %eax;                                                   \
-       negl    %eax;                                                         \
-       jne     1f;                                                           \
-       movl    $0x80000000, %eax;                                            \
-1:     movl    %eax, %gs:PID
-
-/* Restore the old PID value in the parent.  */
-#define RESTORE_PID \
-       testl   %eax, %eax;                                                   \
-       je      1f;                                                           \
-       movl    %edx, %gs:PID;                                                \
-1:
-
-
-#include <libc/sysdeps/linux/i386/vfork.S>
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/metag/Makefile.arch 
b/libpthread/nptl/sysdeps/unix/sysv/linux/metag/Makefile.arch
index 0f4d8d3..4c85f0a 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/metag/Makefile.arch
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/metag/Makefile.arch
@@ -9,8 +9,5 @@ libpthread_linux_arch_SSRC =
 libpthread_linux_arch_CSRC = pthread_once.c
 
 libc_linux_arch_CSRC = fork.c
-libc_linux_arch_SSRC = clone.S vfork.S
-libc_linux_arch_SSRC-OMIT = waitpid.S
 
 CFLAGS += $(SSP_ALL_CFLAGS)
-
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/metag/clone.S 
b/libpthread/nptl/sysdeps/unix/sysv/linux/metag/clone.S
deleted file mode 100644
index f5c5c7c..0000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/metag/clone.S
+++ /dev/null
@@ -1,9 +0,0 @@
-/*
- * Copyright (C) 2013 Imagination Technologies Ltd.
- *
- * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this 
tarball.
- */
-
-#define RESET_PID
-#include <tcb-offsets.h>
-#include "../../../../../../../libc/sysdeps/linux/metag/clone.S"
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/metag/vfork.S 
b/libpthread/nptl/sysdeps/unix/sysv/linux/metag/vfork.S
deleted file mode 100644
index 7b369b1..0000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/metag/vfork.S
+++ /dev/null
@@ -1,55 +0,0 @@
-/* Copyright (C) 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; see the file COPYING.LIB.  If
-   not, see <http://www.gnu.org/licenses/>.  */
-
-#include <tcb-offsets.h>
-#include <asm/unistd.h>
-
-#ifdef __PIC__
-#define __VFORK_METAG_LOAD_TP ___metag_load_tp@PLT
-#else
-#define __VFORK_METAG_LOAD_TP ___metag_load_tp
-#endif
-
-/* Save the PID value.  */
-#define SAVE_PID \
-       SETL    [A0StP++], D0FrT, D1RtP; \
-       CALLR   D1RtP, __VFORK_METAG_LOAD_TP; \
-       SUB     D0Re0, D0Re0, #TLS_PRE_TCB_SIZE; \
-       GETD    D0FrT, [D0Re0 + #PID]; \
-       NEGS    D0FrT, D0FrT; \
-       BNZ     1f; \
-       MOVT    D0FrT, #0x8000; \
-1:     SETD    [D0Re0 + #PID], D0FrT; \
-       GETL    D0FrT, D1RtP, [--A0StP];
-
-#define RESTORE_PID \
-       CMP     D0Re0, #0; \
-       BEQ     1f; \
-       MSETL   [A0StP++], D0Re0, D0FrT; \
-       CALLR   D1RtP, __VFORK_METAG_LOAD_TP; \
-       SUB     D0Re0, D0Re0, #TLS_PRE_TCB_SIZE; \
-       GETD    D0FrT, [D0Re0 + #PID]; \
-       NEG     D0FrT, D0FrT; \
-       MOVT    D1Re0, #0x8000; \
-       CMP     D0FrT, D1Re0; \
-       XOREQ   D0FrT, D0FrT, D0FrT; \
-       SETD    [D0Re0 + #PID], D0FrT; \
-       GETL    D0FrT, D1RtP, [--A0StP]; \
-       GETL    D0Re0, D1Re0, [--A0StP]; \
-1:
-
-#include <../../../../../../../libc/sysdeps/linux/metag/vfork.S>
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/microblaze/Makefile.arch 
b/libpthread/nptl/sysdeps/unix/sysv/linux/microblaze/Makefile.arch
index 77707a0..44a0053 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/microblaze/Makefile.arch
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/microblaze/Makefile.arch
@@ -5,4 +5,3 @@ libpthread_linux_arch_SSRC =
 libpthread_linux_arch_CSRC = pthread_once.c
 
 libc_linux_arch_CSRC = fork.c
-libc_linux_arch_SSRC = clone.S vfork.S
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/microblaze/clone.S 
b/libpthread/nptl/sysdeps/unix/sysv/linux/microblaze/clone.S
deleted file mode 100644
index faa78d9..0000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/microblaze/clone.S
+++ /dev/null
@@ -1,4 +0,0 @@
-#define RESET_PID
-#include <tls.h>
-#include <tcb-offsets.h>
-#include "../../../../../../../libc/sysdeps/linux/microblaze/clone.S"
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/microblaze/vfork.S 
b/libpthread/nptl/sysdeps/unix/sysv/linux/microblaze/vfork.S
deleted file mode 100644
index 4336717..0000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/microblaze/vfork.S
+++ /dev/null
@@ -1,5 +0,0 @@
-#define SAVE_PID
-#define RESTORE_PID
-#include <tls.h>
-#include <tcb-offsets.h>
-#include <libc/sysdeps/linux/microblaze/vfork.S>
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/mips/Makefile.arch 
b/libpthread/nptl/sysdeps/unix/sysv/linux/mips/Makefile.arch
index 565efd4..402c5ff 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/mips/Makefile.arch
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/mips/Makefile.arch
@@ -5,13 +5,8 @@
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 #
 
-libpthread_linux_arch_SSRC = clone.S
 libpthread_linux_arch_CSRC = pthread_once.c
 
 libc_linux_arch_CSRC = fork.c
-libc_linux_arch_SSRC = clone.S vfork.S
-ifneq ($(CONFIG_MIPS_O32_ABI),y)
-libc_linux_arch_SSRC-OMIT = waitpid.S
-endif
-ASFLAGS += -DUSE___THREAD
 
+ASFLAGS += -DUSE___THREAD
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/mips/clone.S 
b/libpthread/nptl/sysdeps/unix/sysv/linux/mips/clone.S
deleted file mode 100644
index 858877f..0000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/mips/clone.S
+++ /dev/null
@@ -1,2 +0,0 @@
-#define RESET_PID
-#include <libc/sysdeps/linux/mips/clone.S>
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/mips/pt-clone.S 
b/libpthread/nptl/sysdeps/unix/sysv/linux/mips/pt-clone.S
deleted file mode 100644
index add4055..0000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/mips/pt-clone.S
+++ /dev/null
@@ -1,2 +0,0 @@
-#define RESET_PID
-#include <../../../../../../../libc/sysdeps/linux/mips/clone.S>
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/mips/vfork.S 
b/libpthread/nptl/sysdeps/unix/sysv/linux/mips/vfork.S
deleted file mode 100644
index a23d99c..0000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/mips/vfork.S
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Copyright (C) 2005, 2006 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, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <features.h>
-#include <tls.h>
-
-/* Save the PID value.  */
-#define SAVE_PID \
-       READ_THREAD_POINTER(v1);        /* Get the thread pointer.  */  \
-       lw      a2, PID_OFFSET(v1);     /* Load the saved PID.  */      \
-       subu    a2, $0, a2;             /* Negate it.  */               \
-       bnez    a2, 1f;                 /* If it was zero... */         \
-       lui     a2, 0x8000;             /* use 0x80000000 instead.  */  \
-1:     sw      a2, PID_OFFSET(v1);     /* Store the temporary PID.  */
-
-/* Restore the old PID value in the parent.  */
-#define RESTORE_PID \
-       beqz    v0, 1f;                 /* If we are the parent... */   \
-       READ_THREAD_POINTER(v1);        /* Get the thread pointer.  */  \
-       lw      a2, PID_OFFSET(v1);     /* Load the saved PID.  */      \
-       subu    a2, $0, a2;             /* Re-negate it.  */            \
-       lui     a0, 0x8000;             /* Load 0x80000000... */        \
-       bne     a2, a0, 2f;             /* ... compare against it... */ \
-       li      a2, 0;                  /* ... use 0 instead.  */       \
-2:     sw      a2, PID_OFFSET(v1);     /* Restore the PID.  */         \
-1:
-
-#include <../../../../../../../libc/sysdeps/linux/mips/vfork.S>
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/nds32/Makefile.arch 
b/libpthread/nptl/sysdeps/unix/sysv/linux/nds32/Makefile.arch
index 3b8935c..94aa25f 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/nds32/Makefile.arch
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/nds32/Makefile.arch
@@ -5,8 +5,5 @@ libpthread_linux_arch_SSRC =
 libpthread_linux_arch_CSRC = pthread_once.c
 
 libc_linux_arch_CSRC = fork.c
-libc_linux_arch_SSRC = clone.S vfork.S
-libc_linux_arch_SSRC-OMIT = waitpid.S
 
 CFLAGS += $(SSP_ALL_CFLAGS)
-
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/nds32/clone.S 
b/libpthread/nptl/sysdeps/unix/sysv/linux/nds32/clone.S
deleted file mode 100644
index 94b39fc..0000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/nds32/clone.S
+++ /dev/null
@@ -1,4 +0,0 @@
-/* We want an #include_next, but we are the main source file.
-   So, #include ourselves and in that incarnation we can use #include_next.  */
-# define RESET_PID
-# include <libc/sysdeps/linux/nds32/clone.S>
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/nds32/vfork.S 
b/libpthread/nptl/sysdeps/unix/sysv/linux/nds32/vfork.S
deleted file mode 100644
index f11f76a..0000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/nds32/vfork.S
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2016-2017 Andes Technology, Inc.
- * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
- */
-
-/* Copyright (C) 2013 Free Software Foundation, Inc.
-
-   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, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <tls.h>
-
-/* Save the PID value.  */
-#define SAVE_PID \
-       lwi     $r1, [$r25 + PID_OFFSET];/* Get the thread pointer.  */ \
-       subri   $r1, $r1, 0x0;           /* Negate it.  */              \
-       bnez    $r1, 1f;                 /* If it was zero... */                
\
-       sethi   $r1, 0x80000;            /* use 0x80000000 instead.  */ \
-1:     swi     $r1, [$r25 + PID_OFFSET];/* Store the temporary PID.  */
-
-/* Restore the old PID value in the parent.  */
-#define RESTORE_PID \
-       beqz    $r0, 1f;                /* If we are the parent... */   \
-       lwi     $r1, [$r25 + PID_OFFSET];/* Get the thread pointer.  */ \
-       subri   $r1, $r1, 0x0;          /* Re-negate it.  */            \
-       sethi   $r2, 0x80000;           /* Load 0x80000000... */        \
-       bne     $r1, $r2, 2f;           /* ... compare against it... */ \
-       movi    $r1, 0;                 /* ... use 0 instead.  */       \
-2:     swi     $r1, [$r25 + PID_OFFSET];/* Restore the PID.  */                
\
-1:
-
-#include <../../../../../../../libc/sysdeps/linux/nds32/vfork.S>
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/nios2/Makefile.arch 
b/libpthread/nptl/sysdeps/unix/sysv/linux/nios2/Makefile.arch
index 26f51fb..1295c34 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/nios2/Makefile.arch
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/nios2/Makefile.arch
@@ -5,5 +5,3 @@ libpthread_linux_arch_SSRC =
 libpthread_linux_arch_CSRC = pthread_once.c
 
 libc_linux_arch_CSRC = fork.c
-libc_linux_arch_SSRC = clone.S vfork.S
-libc_linux_arch_SSRC-OMIT = waitpid.S
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/nios2/clone.S 
b/libpthread/nptl/sysdeps/unix/sysv/linux/nios2/clone.S
deleted file mode 100644
index 544974f..0000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/nios2/clone.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#define RESET_PID
-#include <tcb-offsets.h>
-#include "../../../../../../../libc/sysdeps/linux/nios2/clone.S"
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/nios2/vfork.S 
b/libpthread/nptl/sysdeps/unix/sysv/linux/nios2/vfork.S
deleted file mode 100644
index 6ee414c..0000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/nios2/vfork.S
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Copyright (C) 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, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <tcb-offsets.h>
-
-/* Save the PID value.  */
-#define SAVE_PID \
-       str     lr, [sp, #-4]!;         /* Save LR.  */                 \
-       mov     r0, #0xffff0fff;        /* Point to the high page.  */  \
-       mov     lr, pc;                 /* Save our return address.  */ \
-       sub     pc, r0, #31;            /* Jump to the TLS entry.  */   \
-       ldr     lr, [sp], #4;           /* Restore LR.  */              \
-       mov     r2, r0;                 /* Save the TLS addr in r2.  */ \
-       ldr     r3, [r2, #PID_OFFSET];  /* Load the saved PID.  */      \
-       rsbs    r0, r3, #0;             /* Negate it.  */               \
-       moveq   r0, #0x80000000;        /* Use 0x80000000 if it was 0.  */ \
-       str     r0, [r2, #PID_OFFSET]   /* Store the temporary PID.  */
-
-/* Restore the old PID value in the parent.  */
-#define RESTORE_PID \
-       cmp     r0, #0;                 /* If we are the parent... */   \
-       strne   r3, [r2, #PID_OFFSET]   /* ... restore the saved PID.  */
-
-#include "../../../../../../../libc/sysdeps/linux/nios2/vfork.S"
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/Makefile.arch 
b/libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/Makefile.arch
index 2abb1d2..689e029 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/Makefile.arch
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/Makefile.arch
@@ -9,7 +9,5 @@ libpthread_linux_arch_SSRC =
 libpthread_linux_arch_CSRC = pthread_once.c
 
 libc_linux_arch_CSRC = fork.c
-libc_linux_arch_SSRC = clone.S vfork.S
 
 ASFLAGS += -DUSE___THREAD
-
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/clone.S 
b/libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/clone.S
deleted file mode 100644
index 675a997..0000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/clone.S
+++ /dev/null
@@ -1,9 +0,0 @@
-/* We want an #include_next, but we are the main source file.
-   So, #include ourselves and in that incarnation we can use #include_next.  */
-#ifndef INCLUDED_SELF
-# define INCLUDED_SELF
-# include <clone.S>
-#else
-# define RESET_PID
-# include_next <clone.S>
-#endif
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/vfork.S 
b/libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/vfork.S
deleted file mode 100644
index 28c59fd..0000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/vfork.S
+++ /dev/null
@@ -1,57 +0,0 @@
-/* Copyright (C) 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Jakub Jelinek <ja...@redhat.com>, 2004.
-
-   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, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#define _ERRNO_H       1
-#include <bits/errno.h>
-#include <bits/kernel-features.h>
-#include <tcb-offsets.h>
-
-/* Clone the calling process, but without copying the whole address space.
-   The calling process is suspended until the new process exits or is
-   replaced by a call to `execve'.  Return -1 for errors, 0 to the new process,
-   and the process ID of the new process to the old process.  */
-
-ENTRY (__vfork)
-       lwz     0,PID(2)
-       cmpwi   0,0,0
-       neg     0,0
-       bne-    0,1f
-       lis     0,0x8000
-1:     stw     0,PID(2)
-
-       DO_CALL (SYS_ify (vfork))
-
-       cmpwi   1,3,0
-       beqlr-  1
-
-       lwz     0,PID(2)
-       /* Cannot use clrlwi. here, because cr0 needs to be preserved
-          until PSEUDO_RET.  */
-       clrlwi  4,0,1
-       cmpwi   1,4,0
-       beq-    1,1f
-       neg     4,0
-1:     stw     4,PID(2)
-
-       PSEUDO_RET
-
-PSEUDO_END (__vfork)
-libc_hidden_def (__vfork)
-weak_alias (__vfork, vfork)
-libc_hidden_weak(vfork)
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/pthread_kill.c 
b/libpthread/nptl/sysdeps/unix/sysv/linux/pthread_kill.c
index e27ab51..1cce9bf 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/pthread_kill.c
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/pthread_kill.c
@@ -57,9 +57,10 @@ __pthread_kill (
      function would have to be called while the thread is executing
      fork, it would have to happen in a signal handler.  But this is
      no allowed, pthread_kill is not guaranteed to be async-safe.  */
+
+  pid_t pid = getpid ();
   int val;
-  val = INTERNAL_SYSCALL (tgkill, err, 3, THREAD_GETMEM (THREAD_SELF, pid),
-                         tid, signo);
+  val = INTERNAL_SYSCALL (tgkill, err, 3, pid, tid, signo);
 
   return (INTERNAL_SYSCALL_ERROR_P (val, err)
          ? INTERNAL_SYSCALL_ERRNO (val, err) : 0);
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/pthread_sigqueue.c 
b/libpthread/nptl/sysdeps/unix/sysv/linux/pthread_sigqueue.c
index 2b7fa14..0bd3b79 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/pthread_sigqueue.c
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/pthread_sigqueue.c
@@ -53,26 +53,22 @@ pthread_sigqueue (
   if (signo == SIGCANCEL || signo == SIGTIMER || signo == SIGSETXID)
     return EINVAL;
 
+  pid_t pid = getpid ();
+
   /* Set up the siginfo_t structure.  */
   siginfo_t info;
   memset (&info, '\0', sizeof (siginfo_t));
   info.si_signo = signo;
   info.si_code = SI_QUEUE;
-  info.si_pid = THREAD_GETMEM (THREAD_SELF, pid);
+  info.si_pid = pid;
   info.si_uid = getuid ();
   info.si_value = value;
 
   /* We have a special syscall to do the work.  */
   INTERNAL_SYSCALL_DECL (err);
 
-  /* One comment: The PID field in the TCB can temporarily be changed
-     (in fork).  But this must not affect this code here.  Since this
-     function would have to be called while the thread is executing
-     fork, it would have to happen in a signal handler.  But this is
-     no allowed, pthread_sigqueue is not guaranteed to be async-safe.  */
   int val = INTERNAL_SYSCALL (rt_tgsigqueueinfo, err, 4,
-                             THREAD_GETMEM (THREAD_SELF, pid),
-                             tid, signo, &info);
+                             pid, tid, signo, &info);
 
   return (INTERNAL_SYSCALL_ERROR_P (val, err)
          ? INTERNAL_SYSCALL_ERRNO (val, err) : 0);
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/raise.c 
b/libpthread/nptl/sysdeps/unix/sysv/linux/raise.c
index 6b15938..b168c15 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/raise.c
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/raise.c
@@ -26,31 +26,27 @@
 int
 raise (int sig)
 {
-  struct pthread *pd = THREAD_SELF;
-  pid_t pid = THREAD_GETMEM (pd, pid);
-  pid_t selftid = THREAD_GETMEM (pd, tid);
-  if (selftid == 0)
-    {
-      /* This system call is not supposed to fail.  */
-#ifdef INTERNAL_SYSCALL
-      INTERNAL_SYSCALL_DECL (err);
-      selftid = INTERNAL_SYSCALL (gettid, err, 0);
-#else
-      selftid = INLINE_SYSCALL (gettid, 0);
-#endif
-      THREAD_SETMEM (pd, tid, selftid);
-
-      /* We do not set the PID field in the TID here since we might be
-        called from a signal handler while the thread executes fork.  */
-      pid = selftid;
-    }
-  else
-    /* raise is an async-safe function.  It could be called while the
-       fork/vfork function temporarily invalidated the PID field.  Adjust for
-       that.  */
-    if (__builtin_expect (pid <= 0, 0))
-      pid = (pid & INT_MAX) == 0 ? selftid : -pid;
-
-  return INLINE_SYSCALL (tgkill, 3, pid, selftid, sig);
+  /* rt_sigprocmask may fail if:
+
+     1. sigsetsize != sizeof (sigset_t) (EINVAL)
+     2. a failure in copy from/to user space (EFAULT)
+     3. an invalid 'how' operation (EINVAL)
+
+     The first case is already handle in glibc syscall call by using the arch
+     defined _NSIG.  Second case is handled by using a stack allocated mask.
+     The last one should be handled by the block/unblock functions.  */
+
+  //sigset_t set;
+  //__libc_signal_block_app (&set);
+
+  INTERNAL_SYSCALL_DECL (err);
+  pid_t pid = INTERNAL_SYSCALL (getpid, err, 0);
+  pid_t tid = INTERNAL_SYSCALL (gettid, err, 0);
+
+  int ret = INLINE_SYSCALL (tgkill, 3, pid, tid, sig);
+
+  //__libc_signal_restore_set (&set);
+
+  return ret;
 }
 libc_hidden_def (raise)
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/Makefile.arch 
b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/Makefile.arch
index c07498f..e3b2f7c 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/Makefile.arch
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/Makefile.arch
@@ -13,7 +13,5 @@ libpthread_linux_arch_SSRC = pthread_once.S 
pthread_rwlock_wrlock.S \
                        sem_post.S sem_timedwait.S sem_trywait.S sem_wait.S
 
 libc_linux_arch_CSRC = fork.c
-libc_linux_arch_SSRC = clone.S vfork.S
 
 ASFLAGS += -DUSE___THREAD
-
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/clone.S 
b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/clone.S
deleted file mode 100644
index 918d579..0000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/clone.S
+++ /dev/null
@@ -1,2 +0,0 @@
-#define RESET_PID
-#include <libc/sysdeps/linux/sh/clone.S>
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/vfork.S 
b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/vfork.S
deleted file mode 100644
index 5ea1bc1..0000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/vfork.S
+++ /dev/null
@@ -1,70 +0,0 @@
-/* Copyright (C) 2004 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, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#define _ERRNO_H       1
-#include <bits/errno.h>
-#include <tcb-offsets.h>
-
-/* Clone the calling process, but without copying the whole address space.
-   The calling process is suspended until the new process exits or is
-   replaced by a call to `execve'.  Return -1 for errors, 0 to the new process,
-   and the process ID of the new process to the old process.  */
-
-ENTRY (__vfork)
-       /* Save the PID value.  */
-       stc     gbr, r2
-       mov.w   .L2, r0
-       mov.l   @(r0,r2), r4
-       neg     r4, r1
-       tst     r1, r1
-       bf      1f
-       mov     #1, r1
-       rotr    r1
-1:
-       mov.l   r1, @(r0,r2)
-
-       mov.w   .L1, r3
-       trapa   #0x10
-       mov     r0, r1
-
-       /* Restore the old PID value in the parent.  */
-       tst     r0, r0
-       bt.s    2f
-        stc    gbr, r2
-       mov.w   .L2, r0
-       mov.l   r4, @(r0,r2)
-       mov     r1, r0
-2:
-       mov     #-12, r2
-       shad    r2, r1
-       not     r1, r1                  // r1=0 means r0 = -1 to -4095
-       tst     r1, r1                  // i.e. error in linux
-       bf      .Lpseudo_end
-       SYSCALL_ERROR_HANDLER
-.Lpseudo_end:
-       rts
-        nop
-.L1:
-       .word   __NR_vfork
-.L2:
-       .word   PID - TLS_PRE_TCB_SIZE
-       .align  2
-PSEUDO_END (__vfork)
-hidden_def (vfork)
-
-weak_alias (__vfork, vfork)
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/Makefile.arch 
b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/Makefile.arch
index f93ad4d..5253f1c 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/Makefile.arch
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/Makefile.arch
@@ -5,12 +5,9 @@
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 #
 
-libpthread_linux_arch_SSRC = clone.S
 libpthread_linux_arch_CSRC = pthread_once.c lowlevellock.c \
        pthread_barrier_init.c pthread_barrier_wait.c pthread_barrier_destroy.c
 
 libc_linux_arch_CSRC = fork.c libc-lowlevellock.c
-libc_linux_arch_SSRC = clone.S vfork.S
 
 ASFLAGS += -DUSE___THREAD
-
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/clone.S 
b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/clone.S
deleted file mode 100644
index a6142aa..0000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/clone.S
+++ /dev/null
@@ -1,2 +0,0 @@
-#define RESET_PID
-#include <libc/sysdeps/linux/sparc/clone.S>
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/vfork.S 
b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/vfork.S
deleted file mode 100644
index 71f0662..0000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/vfork.S
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Copyright (C) 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Jakub Jelinek <ja...@redhat.com>, 2004.
-
-   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, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <tcb-offsets.h>
-
-       .text
-       .globl          __syscall_error
-ENTRY(__vfork)
-       ld      [%g7 + PID], %o5
-       cmp     %o5, 0
-       bne     1f
-        sub    %g0, %o5, %o4
-       sethi   %hi(0x80000000), %o4
-1:     st      %o4, [%g7 + PID]
-
-       LOADSYSCALL(vfork)
-       ta      0x10
-       bcc     2f
-        mov    %o7, %g1
-       st      %o5, [%g7 + PID]
-       call    __syscall_error
-        mov    %g1, %o7
-2:     sub     %o1, 1, %o1
-       andcc   %o0, %o1, %o0
-       bne,a   1f
-        st     %o5, [%g7 + PID]
-1:     retl
-        nop
-END(__vfork)
-
-libc_hidden_def (vfork)
-weak_alias (__vfork, vfork)
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/Makefile.arch 
b/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/Makefile.arch
index b48f4cb..f3883db 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/Makefile.arch
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/Makefile.arch
@@ -5,7 +5,7 @@
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 #
 
-libpthread_linux_arch_SSRC = clone.S pthread_once.S \
+libpthread_linux_arch_SSRC = pthread_once.S \
        lowlevellock.S pthread_barrier_wait.S pthread_cond_signal.S 
pthread_cond_broadcast.S \
        sem_post.S sem_timedwait.S lowlevelrobustlock.S \
        sem_trywait.S sem_wait.S pthread_rwlock_rdlock.S 
pthread_rwlock_wrlock.S \
@@ -14,9 +14,7 @@ libpthread_linux_arch_SSRC = clone.S pthread_once.S \
 libpthread_linux_arch_CSRC = pthread_spin_init.c
 
 libc_linux_arch_CSRC = fork.c
-libc_linux_arch_SSRC = clone.S vfork.S libc-cancellation.S libc-lowlevellock.S
-libc_linux_arch_SSRC-OMIT = waitpid.S
+libc_linux_arch_SSRC = libc-cancellation.S libc-lowlevellock.S
 librt_linux_arch_SSRC = librt-cancellation.S
 
 ASFLAGS += -DUSE___THREAD
-
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/clone.S 
b/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/clone.S
deleted file mode 100644
index efbaee3..0000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/clone.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include <tcb-offsets.h>
-#define RESET_PID
-#include <libc/sysdeps/linux/x86_64/clone.S>
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/vfork.S 
b/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/vfork.S
deleted file mode 100644
index f3280b8..0000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/vfork.S
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Copyright (C) 2004 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, see
-   <http://www.gnu.org/licenses/>.  */
-
-/* We want an #include_next, but we are the main source file.
-   So, #include ourselves and in that incarnation we can use #include_next.  */
-#ifndef INCLUDED_SELF
-# define INCLUDED_SELF
-# include <vfork.S>
-#else
-
-# include <tcb-offsets.h>
-
-# define SAVE_PID \
-       movl    %fs:PID, %esi;                                                \
-       movl    $0x80000000, %ecx;                                            \
-       movl    %esi, %edx;                                                   \
-       negl    %edx;                                                         \
-       cmove   %ecx, %edx;                                                   \
-       movl    %edx, %fs:PID
-
-# define RESTORE_PID \
-       testq   %rax, %rax;                                                   \
-       je      1f;                                                           \
-       movl    %esi, %fs:PID;                                                \
-1:
-
-# include_next <vfork.S>
-#endif
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/xtensa/Makefile.arch 
b/libpthread/nptl/sysdeps/unix/sysv/linux/xtensa/Makefile.arch
index 7014c3f..6f17348 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/xtensa/Makefile.arch
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/xtensa/Makefile.arch
@@ -2,13 +2,10 @@
 # Licensed under the LGPL v2.1, see the file COPYING and LICENSE.
 
 libc_linux_arch_CSRC = fork.c
-libc_linux_arch_SSRC = clone.S vfork.S
 libpthread_linux_arch_CSRC = pthread_once.c
 libpthread_linux_arch_SSRC =
 
 CFLAGS-OMIT-fork.c = -DNOT_IN_libc -DIS_IN_libpthread
 
-ASFLAGS-clone.S = -D_LIBC_REENTRANT
-ASFLAGS-vfork.S = -D_LIBC_REENTRANT
 ASFLAGS-syscall.S = -D_LIBC_REENTRANT
 ASFLAGS-mmap.S = -D_LIBC_REENTRANT
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/xtensa/clone.S 
b/libpthread/nptl/sysdeps/unix/sysv/linux/xtensa/clone.S
deleted file mode 100644
index 539b9ef..0000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/xtensa/clone.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#define RESET_PID
-#include <tcb-offsets.h>
-#include <libc/sysdeps/linux/xtensa/clone.S>
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/xtensa/vfork.S 
b/libpthread/nptl/sysdeps/unix/sysv/linux/xtensa/vfork.S
deleted file mode 100644
index 46eb76d..0000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/xtensa/vfork.S
+++ /dev/null
@@ -1,59 +0,0 @@
-/* Copyright (C) 2013 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, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <tls.h>
-
-/*
-  Save the PID value, save 0x80000000 if PID was 0.
-  Registers a2 and a3 are available; ar should return the PID and as threadptr
- */
-
-#define SAVE_PID(pid,tp,ar,as)                                         \
-       rur     tp, threadptr;                                          \
-       movi    ar, TLS_PRE_TCB_SIZE;                                   \
-       sub     tp, tp, ar;                                             \
-       l32i    pid, tp, PID;                                           \
-       neg     ar, pid;                                                \
-       movi    as, 0x80000000;                                         \
-       moveqz  ar, as, ar;                                             \
-       s32i    ar, tp, PID;                                            \
-
-/*
-  Restore the PID value, restore to 0 if saved value was 0x80000000
-  Return value from the syscall is in a2.
- */
-#define RESTORE_PID(pid,tp,res)                                                
\
-       beqz    res, 1f;                                                \
-       s32i    pid, tp, PID;                                           \
-1:
-
-/*
-  Special version for call12, where we don't have enough registers
-  available to preserve the original PID.
- */
-#define RESTORE_PID12(ar, as, at)                                      \
-       rur     as, threadptr;                                          \
-       movi    ar, TLS_PRE_TCB_SIZE;                                   \
-       sub     as, as, ar;                                             \
-       l32i    ar, as, PID;                                            \
-       movi    at, 0x80000000;                                         \
-       sub     at, at, ar;                                             \
-       neg     ar, ar;                                                 \
-       moveqz  ar, at, at;                                             \
-       s32i    ar, as, PID;
-
-#include <libc/sysdeps/linux/xtensa/vfork.S>
diff --git a/libpthread/nptl/sysdeps/x86_64/tcb-offsets.sym 
b/libpthread/nptl/sysdeps/x86_64/tcb-offsets.sym
index cf86375..d908521 100644
--- a/libpthread/nptl/sysdeps/x86_64/tcb-offsets.sym
+++ b/libpthread/nptl/sysdeps/x86_64/tcb-offsets.sym
@@ -3,7 +3,6 @@
 
 RESULT                 offsetof (struct pthread, result)
 TID                    offsetof (struct pthread, tid)
-PID                    offsetof (struct pthread, pid)
 CANCELHANDLING         offsetof (struct pthread, cancelhandling)
 CLEANUP_JMP_BUF                offsetof (struct pthread, cleanup_jmp_buf)
 CLEANUP                        offsetof (struct pthread, cleanup)
diff --git a/libpthread/nptl/sysdeps/xtensa/tcb-offsets.sym 
b/libpthread/nptl/sysdeps/xtensa/tcb-offsets.sym
index 4c86876..54eae20 100644
--- a/libpthread/nptl/sysdeps/xtensa/tcb-offsets.sym
+++ b/libpthread/nptl/sysdeps/xtensa/tcb-offsets.sym
@@ -3,5 +3,4 @@
 
 TLS_PRE_TCB_SIZE       sizeof (struct pthread)
 MULTIPLE_THREADS_OFFSET        offsetof (struct pthread, 
header.multiple_threads)
-PID                    offsetof (struct pthread, pid)
 TID                    offsetof (struct pthread, tid)
-- 
2.1.4

_______________________________________________
devel mailing list
devel@uclibc-ng.org
http://mailman.uclibc-ng.org/cgi-bin/mailman/listinfo/devel

Reply via email to