From 65c689907900378bc3daf394a40b6a046595caab Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 7 Feb 2003 06:46:21 +0000 Subject: Update. 2003-02-07 Jakub Jelinek * tst-popen2.c: New test. * Makefile (tests): Add tst-popen2. * sysdeps/unix/sysv/linux/alpha/vfork.S (__vfork): Branch to __fork whenever libpthread.so is loaded. * sysdeps/unix/sysv/linux/i386/vfork.S (__vfork): Likewise. * sysdeps/unix/sysv/linux/ia64/vfork.S (__vfork): Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/vfork.S (__vfork): Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S (__vfork): Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S (__vfork): Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S (__vfork): Likewise. * sysdeps/unix/sysv/linux/x86_64/vfork.S (__vfork): Likewise. --- linuxthreads/sysdeps/unix/sysv/linux/alpha/vfork.S | 4 +++- linuxthreads/sysdeps/unix/sysv/linux/i386/vfork.S | 14 ++++++++++++- linuxthreads/sysdeps/unix/sysv/linux/ia64/vfork.S | 9 ++++++++- .../unix/sysv/linux/powerpc/powerpc32/vfork.S | 13 ++++++++++-- .../sysdeps/unix/sysv/linux/s390/s390-64/vfork.S | 9 ++++++++- .../sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S | 23 ++++++++++++++++++++-- .../sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S | 23 ++++++++++++++++++---- .../sysdeps/unix/sysv/linux/x86_64/vfork.S | 8 +++++++- 8 files changed, 90 insertions(+), 13 deletions(-) (limited to 'linuxthreads/sysdeps/unix/sysv/linux') diff --git a/linuxthreads/sysdeps/unix/sysv/linux/alpha/vfork.S b/linuxthreads/sysdeps/unix/sysv/linux/alpha/vfork.S index e7507245e7..9002a3b36b 100644 --- a/linuxthreads/sysdeps/unix/sysv/linux/alpha/vfork.S +++ b/linuxthreads/sysdeps/unix/sysv/linux/alpha/vfork.S @@ -27,10 +27,12 @@ __LABEL(__vfork) .prologue 1 PSEUDO_PROF - SINGLE_THREAD_P(t0) #ifdef SHARED + ldq t0, __libc_pthread_functions(gp) !gprel bne t0, HIDDEN_JUMPTARGET (__fork) !samegp #else + .weak __pthread_fork + ldq t0, __pthread_fork(gp) !literal bne t0, $do_fork #endif diff --git a/linuxthreads/sysdeps/unix/sysv/linux/i386/vfork.S b/linuxthreads/sysdeps/unix/sysv/linux/i386/vfork.S index 298aedcf43..f4a56a54bf 100644 --- a/linuxthreads/sysdeps/unix/sysv/linux/i386/vfork.S +++ b/linuxthreads/sysdeps/unix/sysv/linux/i386/vfork.S @@ -31,7 +31,19 @@ ENTRY (__vfork) #ifdef __NR_vfork - SINGLE_THREAD_P +# ifdef SHARED +# if !defined HAVE_HIDDEN || !USE___THREAD + SETUP_PIC_REG (cx) +# else + call __i686.get_pc_thunk.cx +# endif + addl $_GLOBAL_OFFSET_TABLE_, %ecx + cmpl $0, __libc_pthread_functions@GOTOFF(%ecx) +# else + .weak __pthread_fork + movl $__pthread_fork, %eax + testl %eax, %eax +# endif jne HIDDEN_JUMPTARGET (__fork) /* Pop the return PC value into ECX. */ diff --git a/linuxthreads/sysdeps/unix/sysv/linux/ia64/vfork.S b/linuxthreads/sysdeps/unix/sysv/linux/ia64/vfork.S index 172ac2b040..5541edb53c 100644 --- a/linuxthreads/sysdeps/unix/sysv/linux/ia64/vfork.S +++ b/linuxthreads/sysdeps/unix/sysv/linux/ia64/vfork.S @@ -30,7 +30,14 @@ /* Implemented as __clone_syscall(CLONE_VFORK | CLONE_VM | SIGCHLD, 0) */ ENTRY(__vfork) - SINGLE_THREAD_P +#ifdef SHARED + addl r14 = @gprel(__libc_pthread_functions#), gp;; +#else + .weak __pthread_fork + addl r14 = @ltoff(@fptr(__pthread_fork#)), gp;; +#endif + ld8 r14 = [r14];; + cmp.ne p6, p7 = 0, r14 (p6) br.cond.spnt.few HIDDEN_JUMPTARGET (__fork);; alloc r2=ar.pfs,0,0,2,0 mov out0=CLONE_VM+CLONE_VFORK+SIGCHLD diff --git a/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S b/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S index 17590059b6..e85f662b7e 100644 --- a/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S +++ b/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S @@ -29,11 +29,20 @@ ENTRY (__vfork) #ifdef __NR_vfork - - SINGLE_THREAD_P # ifdef SHARED + mflr 9 + bl _GLOBAL_OFFSET_TABLE_@local-4 + mflr 10 + mtlr 9 + lwz 10,__libc_pthread_functions@got(10) + lwz 10,0(10) + cmpwi 10,0 bne- HIDDEN_JUMPTARGET(__fork) # else + .weak __pthread_fork + lis 9,__pthread_fork@ha + la 9,__pthread_fork@l(9) + cmpwi 9,0 bne- .Lhidden_fork # endif diff --git a/linuxthreads/sysdeps/unix/sysv/linux/s390/s390-64/vfork.S b/linuxthreads/sysdeps/unix/sysv/linux/s390/s390-64/vfork.S index efc9710d7b..d2faaa1c68 100644 --- a/linuxthreads/sysdeps/unix/sysv/linux/s390/s390-64/vfork.S +++ b/linuxthreads/sysdeps/unix/sysv/linux/s390/s390-64/vfork.S @@ -27,7 +27,14 @@ and the process ID of the new process to the old process. */ ENTRY (__vfork) - SINGLE_THREAD_P +#ifdef SHARED + larl %r1,__libc_pthread_functions + lg %r1,0(%r1) +#else + .weak __pthread_fork + larl %r1,__pthread_fork +#endif + ltgr %r1,%r1 jgne HIDDEN_JUMPTARGET(__fork) /* Do vfork system call. */ diff --git a/linuxthreads/sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S b/linuxthreads/sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S index 5e98554744..2da7703e31 100644 --- a/linuxthreads/sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S +++ b/linuxthreads/sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S @@ -20,9 +20,28 @@ #include .text +#ifdef SHARED +.LLGETPC0: + retl + addl %o7, %o0, %o0 +#endif ENTRY(__vfork) - ld [%g7 + MULTIPLE_THREADS_OFFSET], %o0 - cmp %o0, 0 +#ifdef SHARED + mov %o7, %o1 + sethi %hi(_GLOBAL_OFFSET_TABLE_-4), %o0 + call .LLGETPC0 + add %o0, %lo(_GLOBAL_OFFSET_TABLE_+4), %o0 + sethi %hi(__libc_pthread_functions), %o2 + mov %o1, %o7 + or %o2, %lo(__libc_pthread_functions), %o2 + ld [%o0 + %o2], %o2 + ld [%o2], %o2 + cmp %o2, 0 +#else + .weak __pthread_fork + sethi %hi(__pthread_fork), %o0 + orcc %o0, %lo(__pthread_fork), %o0 +#endif #if defined SHARED && !defined BROKEN_SPARC_WDISP22 bne HIDDEN_JUMPTARGET(__fork) #else diff --git a/linuxthreads/sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S b/linuxthreads/sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S index 98ad45795a..8b85d763d4 100644 --- a/linuxthreads/sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S +++ b/linuxthreads/sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S @@ -19,13 +19,28 @@ #include - .text +#ifdef SHARED +.LLGETPC0: + retl + addl %o7, %o0, %o0 +#endif ENTRY(__vfork) - ld [%g7 + MULTIPLE_THREADS_OFFSET], %o0 #ifdef SHARED - cmp %o0, 0 - bne HIDDEN_JUMPTARGET (__fork) + mov %o7, %o1 + sethi %hi(_GLOBAL_OFFSET_TABLE_-4), %o0 + call .LLGETPC0 + add %o0, %lo(_GLOBAL_OFFSET_TABLE_+4), %o0 + sethi %hi(__libc_pthread_functions), %o2 + mov %o1, %o7 + or %o2, %lo(__libc_pthread_functions), %o2 + ldx [%o0 + %o2], %o2 + ldx [%o2], %o2 + cmp %o2, 0 + bne HIDDEN_JUMPTARGET(__fork) #else + .weak __pthread_fork + sethi %hi(__pthread_fork), %o0 + or %o0, %lo(__pthread_fork), %o0 brnz,pn %o0, 1f #endif mov __NR_vfork, %g1 diff --git a/linuxthreads/sysdeps/unix/sysv/linux/x86_64/vfork.S b/linuxthreads/sysdeps/unix/sysv/linux/x86_64/vfork.S index 3e867a6211..28989eaa14 100644 --- a/linuxthreads/sysdeps/unix/sysv/linux/x86_64/vfork.S +++ b/linuxthreads/sysdeps/unix/sysv/linux/x86_64/vfork.S @@ -27,7 +27,13 @@ ENTRY (__vfork) - SINGLE_THREAD_P +#ifdef SHARED + cmpq $0, __libc_pthread_functions(%rip) +#else + .weak __pthread_fork + movq $__pthread_fork, %eax + testq %rax, %rax +#endif jne HIDDEN_JUMPTARGET (__fork) /* Pop the return PC value into RDI. We need a register that -- cgit v1.2.3