From 48143d8a8f92fd69d95564516fd1b7cf122511b1 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Tue, 24 Jan 2006 17:18:19 +0000 Subject: fork/vfork weak in libc, strong in libpthread --- libc/sysdeps/linux/arm/vfork.S | 12 ++++++----- libc/sysdeps/linux/bfin/vfork.S | 11 ++++++---- libc/sysdeps/linux/common/fork.c | 2 +- libc/sysdeps/linux/common/vfork.c | 13 +++++++----- libc/sysdeps/linux/cris/fork.c | 2 +- libc/sysdeps/linux/e1/vfork.c | 5 +++-- libc/sysdeps/linux/frv/vfork.S | 10 +++++---- libc/sysdeps/linux/h8300/vfork.S | 12 +++++++---- libc/sysdeps/linux/i386/vfork.S | 19 ++++++++--------- libc/sysdeps/linux/i960/vfork.S | 39 ++++++++++++++--------------------- libc/sysdeps/linux/m68k/vfork.S | 10 +++++---- libc/sysdeps/linux/microblaze/vfork.S | 20 ++++++++++-------- libc/sysdeps/linux/nios/vfork.S | 10 +++++---- libc/sysdeps/linux/nios2/vfork.S | 16 ++++++++------ libc/sysdeps/linux/powerpc/vfork.S | 19 +++++++++++------ libc/sysdeps/linux/powerpc/vfork.c | 6 +++--- libc/sysdeps/linux/sh/vfork.S | 10 +++++---- libc/sysdeps/linux/sparc/fork.S | 10 ++++----- libc/sysdeps/linux/sparc/vfork.S | 14 +++++++------ libc/sysdeps/linux/v850/vfork.S | 6 ++++-- libc/sysdeps/linux/x86_64/vfork.S | 14 +++++++------ 21 files changed, 146 insertions(+), 114 deletions(-) (limited to 'libc/sysdeps/linux') diff --git a/libc/sysdeps/linux/arm/vfork.S b/libc/sysdeps/linux/arm/vfork.S index 0bf97c223..fd06148bb 100644 --- a/libc/sysdeps/linux/arm/vfork.S +++ b/libc/sysdeps/linux/arm/vfork.S @@ -2,7 +2,7 @@ /* vfork for uClibc * * Copyright (C) 2000 by Lineo, inc. and Erik Andersen - * Copyright (C) 2000,2001 by Erik Andersen + * Copyright (C) 2000-2006 by Erik Andersen * Written by Erik Andersen * * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. @@ -16,11 +16,12 @@ #ifdef __NR_fork .text -.global vfork -.type vfork,%function +.global __vfork +.hidden __vfork +.type __vfork,%function .align 4 -vfork: +__vfork: #ifdef __NR_vfork swi __NR_vfork @@ -43,6 +44,7 @@ vfork: __error: b __syscall_error -.size vfork,.-vfork +.size __vfork,.-__vfork +weak_alias(__vfork,vfork) libc_hidden_def(vfork) #endif diff --git a/libc/sysdeps/linux/bfin/vfork.S b/libc/sysdeps/linux/bfin/vfork.S index d02ba88ed..ccb80d1e8 100644 --- a/libc/sysdeps/linux/bfin/vfork.S +++ b/libc/sysdeps/linux/bfin/vfork.S @@ -8,11 +8,14 @@ #include .text -.global _vfork -.type _vfork,STT_FUNC; +.global ___vfork +.hidden ___vfork +.type ___vfork,STT_FUNC; .align 4 -_vfork: +___vfork: p0 = __NR_vfork; excpt 0; rts; -.size _vfork,.-_vfork +.size ___vfork,.-___vfork +//weak_alias(___vfork,_vfork) +//libc_hidden_def(_vfork) diff --git a/libc/sysdeps/linux/common/fork.c b/libc/sysdeps/linux/common/fork.c index 13c57237c..eb4001f7e 100644 --- a/libc/sysdeps/linux/common/fork.c +++ b/libc/sysdeps/linux/common/fork.c @@ -15,7 +15,7 @@ #define __NR___libc_fork __NR_fork _syscall0(pid_t, __libc_fork); libc_hidden_proto(fork) -strong_alias(__libc_fork,fork) +weak_alias(__libc_fork,fork) libc_hidden_def(fork) #endif #endif diff --git a/libc/sysdeps/linux/common/vfork.c b/libc/sysdeps/linux/common/vfork.c index b3543a616..f668a020f 100644 --- a/libc/sysdeps/linux/common/vfork.c +++ b/libc/sysdeps/linux/common/vfork.c @@ -1,18 +1,21 @@ +/* + * Copyright (C) 2000-2006 Erik Andersen + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ /* Trivial implementation for arches that lack vfork */ #include #include #include #ifdef __NR_fork - -libc_hidden_proto(vfork) - libc_hidden_proto(fork) -pid_t vfork(void) +pid_t attribute_hidden __vfork(void) { return fork(); } +libc_hidden_proto(vfork) +weak_alias(__vfork,vfork) libc_hidden_def(vfork) - #endif diff --git a/libc/sysdeps/linux/cris/fork.c b/libc/sysdeps/linux/cris/fork.c index e95122a09..56908b481 100644 --- a/libc/sysdeps/linux/cris/fork.c +++ b/libc/sysdeps/linux/cris/fork.c @@ -15,5 +15,5 @@ SYSCALL__ (__libc_fork, 0) /* i dunno what the blurb above is useful for. we just return. */ __asm__("ret\n\tnop"); libc_hidden_proto(fork) -strong_alias(__libc_fork,fork) +weak_alias(__libc_fork,fork) libc_hidden_def(fork) diff --git a/libc/sysdeps/linux/e1/vfork.c b/libc/sysdeps/linux/e1/vfork.c index 36f176acb..ceb8d8263 100644 --- a/libc/sysdeps/linux/e1/vfork.c +++ b/libc/sysdeps/linux/e1/vfork.c @@ -8,7 +8,8 @@ #include #include +#define __NR___vfork __NR_vfork +attribute_hidden _syscall0(pid_t, __vfork); libc_hidden_proto(vfork) - -_syscall0(pid_t, vfork); +weak_alias(__vfork,vfork) libc_hidden_def(vfork) diff --git a/libc/sysdeps/linux/frv/vfork.S b/libc/sysdeps/linux/frv/vfork.S index 9a70e22ac..fbd7fe05f 100644 --- a/libc/sysdeps/linux/frv/vfork.S +++ b/libc/sysdeps/linux/frv/vfork.S @@ -24,10 +24,11 @@ #include .text - .globl vfork - .type vfork,@function + .globl __vfork + .hidden __vfork + .type __vfork,@function /* int vfork(void) */ -vfork: +__vfork: setlos.p #__NR_vfork, gr7 setlos #-4096, gr4 tra gr0, gr0 @@ -40,6 +41,7 @@ vfork: ldd @(gr14, gr15), gr14 jmpl @(gr14, gr0) - .size vfork,.-vfork + .size __vfork,.-__vfork +weak_alias(__vfork,vfork) libc_hidden_def(vfork) diff --git a/libc/sysdeps/linux/h8300/vfork.S b/libc/sysdeps/linux/h8300/vfork.S index 4156fae17..ce591bce1 100644 --- a/libc/sysdeps/linux/h8300/vfork.S +++ b/libc/sysdeps/linux/h8300/vfork.S @@ -12,10 +12,11 @@ #endif .text .align 2 - .globl _errno - .globl _vfork - .type vfork,@function -_vfork: + .globl _errno + .globl ___vfork + .hidden ___vfork + .type ___vfork,@function +___vfork: mov.l @sp+, er1 sub.l er0,er0 mov.b #__NR_vfork,r0l @@ -35,3 +36,6 @@ fix_errno: sub.l er0,er0 dec.l #1,er0 jmp @er1 /* don't return, just jmp directly */ + +//weak_alias(___vfork,_vfork) +//libc_hidden_def(_vfork) diff --git a/libc/sysdeps/linux/i386/vfork.S b/libc/sysdeps/linux/i386/vfork.S index 1f0e9d8ab..02c049faa 100644 --- a/libc/sysdeps/linux/i386/vfork.S +++ b/libc/sysdeps/linux/i386/vfork.S @@ -1,25 +1,23 @@ /* - * June 3, 2003 Erik Andersen + * Copyright (C) 2000-2006 Erik Andersen * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ #include #include #ifndef __NR_vfork - /* No vfork so use fork instead */ -strong_alias(fork,vfork) -strong_alias(vfork,__libc_fork) - +hidden_strong_alias(__libc_fork,__vfork) #else - .text -.global vfork -.type vfork,%function +.global __vfork +.hidden __vfork +.type __vfork,%function .align 1<<4 -vfork: +__vfork: popl %ecx movl $__NR_vfork,%eax int $0x80 @@ -28,6 +26,7 @@ vfork: jae __syscall_error ret -.size vfork,.-vfork +.size __vfork,.-__vfork #endif +weak_alias(__vfork,vfork) libc_hidden_def(vfork) diff --git a/libc/sysdeps/linux/i960/vfork.S b/libc/sysdeps/linux/i960/vfork.S index f519b66fe..c8b7f56cb 100644 --- a/libc/sysdeps/linux/i960/vfork.S +++ b/libc/sysdeps/linux/i960/vfork.S @@ -1,24 +1,14 @@ -# -# clone.S, part of the i960 support for the uClibc library. -# -# Copyright (C) 2002 by Okiok Data Ltd. http://www.okiok.com/ -# -# This program is free software; you can redistribute it and/or modify it under -# the terms of the GNU Library General Public License as published by the Free -# Software Foundation; either version 2 of the License, or (at your option) any -# later version. -# -# This program 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 Library General Public License for more -# details. -# -# You should have received a copy of the GNU Library General Public License -# along with this program; if not, write to the Free Software Foundation, Inc., -# at 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# Derived from an old port of uC-libc to the i960 by Keith Adams (kma@cse.ogi.edu). -# +/* + * clone.S, part of the i960 support for the uClibc library. + * + * Copyright (C) 2002 by Okiok Data Ltd. http://www.okiok.com/ + * Copyright (C) 2000-2006 Erik Andersen + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ +/* + * Derived from an old port of uC-libc to the i960 by Keith Adams (kma@cse.ogi.edu). + */ #include @@ -26,8 +16,9 @@ #define __NR_vfork __NR_fork /* uClinux-2.0 only has fork which is vfork */ #endif - .globl _vfork -_vfork: + .globl ___vfork + .hidden ___vfork +___vfork: mov g13, r3 ldconst __NR_vfork, g13 calls 0 @@ -38,3 +29,5 @@ _vfork: 1: ret +//weak_alias(___vfork,_vfork) +//libc_hidden_def(_vfork) diff --git a/libc/sysdeps/linux/m68k/vfork.S b/libc/sysdeps/linux/m68k/vfork.S index 58564f765..1307597ee 100644 --- a/libc/sysdeps/linux/m68k/vfork.S +++ b/libc/sysdeps/linux/m68k/vfork.S @@ -17,10 +17,11 @@ .text .align 2 .globl errno - .globl vfork - .type vfork,@function + .globl __vfork + .hidden __vfork + .type __vfork,@function -vfork: +__vfork: movl %sp@+, %a1 /* save the return address for later */ movl IMM __NR_vfork,%d0 trap #0 @@ -39,5 +40,6 @@ fix_errno: movl IMM -1, %d0 jmp %a1@ /* don't return, just jmp directly */ -.size vfork,.-vfork +.size __vfork,.-__vfork +weak_alias(__vfork,vfork) libc_hidden_def(vfork) diff --git a/libc/sysdeps/linux/microblaze/vfork.S b/libc/sysdeps/linux/microblaze/vfork.S index a82fbb209..8d96a51e3 100644 --- a/libc/sysdeps/linux/microblaze/vfork.S +++ b/libc/sysdeps/linux/microblaze/vfork.S @@ -1,14 +1,14 @@ /* * libc/sysdeps/linux/microblaze/vfork.S -- `vfork' syscall for linux/microblaze * - * Copyright (C) 2003 John Williams - * Copyright (C) 2001 NEC Corporation - * Copyright (C) 2001 Miles Bader + * Copyright (C) 2001 NEC Corporation + * Copyright (C) 2001 Miles Bader + * Copyright (C) 2003 John Williams + * Copyright (C) 2000-2006 Erik Andersen * - * This file is subject to the terms and conditions of the GNU Lesser - * General Public License. See the file COPYING.LIB in the main - * directory of this archive for more details. - * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ +/* * Written by Miles Bader * Microblaze port by John Williams */ @@ -27,7 +27,7 @@ .global C_SYMBOL_NAME(errno) -C_ENTRY (vfork): +C_ENTRY (__vfork): addi r12, r0, SYS_vfork bralid r17, 0x08; nop @@ -39,4 +39,6 @@ C_ENTRY (vfork): swi r3, r0, C_SYMBOL_NAME(errno); rtsd r15, 8 // error return nop -C_END(vfork) +C_END(__vfork) +//weak_alias(__vfork,vfork) +//libc_hidden_def(vfork) diff --git a/libc/sysdeps/linux/nios/vfork.S b/libc/sysdeps/linux/nios/vfork.S index 2479fe752..dc8b7d445 100644 --- a/libc/sysdeps/linux/nios/vfork.S +++ b/libc/sysdeps/linux/nios/vfork.S @@ -22,9 +22,10 @@ .text .align 2 - .globl vfork - .type vfork,@function -vfork: + .globl __vfork + .hidden __vfork + .type __vfork,@function +__vfork: MOVIP %g1, __NR_vfork trap 63 @@ -48,5 +49,6 @@ fix_errno: ret restore -.size vfork,.-vfork +.size __vfork,.-__vfork +weak_alias(__vfork,vfork) libc_hidden_def(vfork) diff --git a/libc/sysdeps/linux/nios2/vfork.S b/libc/sysdeps/linux/nios2/vfork.S index f8b3179d0..c0e4a7703 100644 --- a/libc/sysdeps/linux/nios2/vfork.S +++ b/libc/sysdeps/linux/nios2/vfork.S @@ -16,12 +16,16 @@ #include #include -#ifdef __NR_fork +#ifndef __NR_vfork +#define __NR_vfork __NR_fork /* uClinux-2.0 only has fork which is vfork */ +#endif + .text -.global vfork -.type vfork,%function +.global __vfork +.hidden __vfork +.type __vfork,%function .align 4 -vfork: +__vfork: movui r2, TRAP_ID_SYSCALL movui r3, __NR_vfork trap @@ -47,6 +51,6 @@ fix_errno: addi sp, sp, 8 ret -.size vfork,.-vfork +.size __vfork,.-__vfork +weak_alias(__vfork,vfork) libc_hidden_def(vfork) -#endif diff --git a/libc/sysdeps/linux/powerpc/vfork.S b/libc/sysdeps/linux/powerpc/vfork.S index 5b4bcc069..a55b6fbc9 100644 --- a/libc/sysdeps/linux/powerpc/vfork.S +++ b/libc/sysdeps/linux/powerpc/vfork.S @@ -1,25 +1,32 @@ +/* + * Copyright (C) 2000-2006 Erik Andersen + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ #include #include #ifndef __NR_vfork /* No vfork so use fork instead */ -strong_alias(fork,vfork) -strong_alias(vfork,__libc_fork) +strong_alias(fork,__libc_fork) +hidden_strong_alias(__libc_fork,__vfork) #else .text -.global vfork -.type vfork,@function +.global __vfork +.hidden __vfork +.type __vfork,@function .type __syscall_error,@function -vfork: +__vfork: li 0, __NR_vfork sc bnslr+ b __syscall_error -.size vfork,.-vfork +.size __vfork,.-__vfork #endif +weak_alias(__vfork,vfork) libc_hidden_def(vfork) diff --git a/libc/sysdeps/linux/powerpc/vfork.c b/libc/sysdeps/linux/powerpc/vfork.c index 16d66bd24..1b8e3cd35 100644 --- a/libc/sysdeps/linux/powerpc/vfork.c +++ b/libc/sysdeps/linux/powerpc/vfork.c @@ -3,15 +3,13 @@ #include #include -libc_hidden_proto(vfork) - #define __syscall_clobbers \ "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12" #define __syscall_return(type) \ return (__sc_err & 0x10000000 ? errno = __sc_ret, __sc_ret = -1 : 0), \ (type) __sc_ret -pid_t vfork(void) +pid_t attribute_hidden __vfork(void) { unsigned long __sc_ret, __sc_err; register unsigned long __sc_0 __asm__ ("r0"); @@ -48,4 +46,6 @@ pid_t vfork(void) __syscall_return (pid_t); } +libc_hidden_proto(vfork) +weak_alias(__vfork,vfork) libc_hidden_def(vfork) diff --git a/libc/sysdeps/linux/sh/vfork.S b/libc/sysdeps/linux/sh/vfork.S index 5c6a356e6..a53d04a0b 100644 --- a/libc/sysdeps/linux/sh/vfork.S +++ b/libc/sysdeps/linux/sh/vfork.S @@ -32,11 +32,12 @@ and the process ID of the new process to the old process. */ .text -.globl vfork -.type vfork,@function +.globl __vfork +.hidden __vfork +.type __vfork,@function .align 4 -vfork: +__vfork: mov.w .L2, r3 trapa #0x10 mov r0, r1 @@ -106,7 +107,8 @@ vfork: .L3: .word __NR_fork -.size vfork, .-vfork +.size __vfork, .-__vfork +weak_alias(__vfork,vfork) libc_hidden_def(vfork) #include "syscall_error.S" diff --git a/libc/sysdeps/linux/sparc/fork.S b/libc/sysdeps/linux/sparc/fork.S index f726e5aef..cb863f654 100644 --- a/libc/sysdeps/linux/sparc/fork.S +++ b/libc/sysdeps/linux/sparc/fork.S @@ -23,11 +23,11 @@ #include .text -.global fork -.type fork,%function +.global __libc_fork +.type __libc_fork,%function .align 4 -fork: +__libc_fork: mov __NR_fork, %g1 ta 0x10 bcc,a 9000f @@ -44,6 +44,6 @@ fork: retl and %o0, %o1, %o0 -.size fork,.-fork +.size __libc_fork,.-__libc_fork +weak_alias(__libc_fork,fork) libc_hidden_def(fork) -strong_alias(fork,__libc_fork) diff --git a/libc/sysdeps/linux/sparc/vfork.S b/libc/sysdeps/linux/sparc/vfork.S index b509f65a4..663243d58 100644 --- a/libc/sysdeps/linux/sparc/vfork.S +++ b/libc/sysdeps/linux/sparc/vfork.S @@ -25,17 +25,18 @@ #ifndef __NR_vfork /* No vfork so use fork instead */ -strong_alias(fork,vfork) -strong_alias(vfork,__libc_fork) +strong_alias(fork,__libc_fork) +hidden_strong_alias(__libc_fork,__vfork) #else .text -.global vfork -.type vfork,%function +.global __vfork +.hidden __vfork +.type __vfork,%function .align 4 -vfork: +__vfork: mov __NR_vfork, %g1 ta 0x10 bcc,a 9000f @@ -52,6 +53,7 @@ vfork: retl and %o0, %o1, %o0 -.size vfork,.-vfork +.size __vfork,.-__vfork #endif /* __NR_vfork */ +weak_alias(__vfork,vfork) libc_hidden_def(vfork) diff --git a/libc/sysdeps/linux/v850/vfork.S b/libc/sysdeps/linux/v850/vfork.S index 34a0ca64c..db4c9f6f7 100644 --- a/libc/sysdeps/linux/v850/vfork.S +++ b/libc/sysdeps/linux/v850/vfork.S @@ -26,7 +26,7 @@ .global C_SYMBOL_NAME(errno) -C_ENTRY (vfork): +C_ENTRY (__vfork): addi SYS_vfork, r0, r12 trap 0 addi -125, r0, r11 // minimum err value @@ -37,4 +37,6 @@ C_ENTRY (vfork): subr r0, r10 st.w r10, 0[r11] jmp [lp] // error return -C_END(vfork) +C_END(__vfork) +//weak_alias(__vfork,vfork) +//libc_hidden_def(vfork) diff --git a/libc/sysdeps/linux/x86_64/vfork.S b/libc/sysdeps/linux/x86_64/vfork.S index 3315e337a..a065916d1 100644 --- a/libc/sysdeps/linux/x86_64/vfork.S +++ b/libc/sysdeps/linux/x86_64/vfork.S @@ -26,17 +26,18 @@ #ifndef __NR_vfork /* No vfork so use fork instead */ -strong_alias(fork,vfork) -strong_alias(vfork,__libc_fork) +strong_alias(fork,__libc_fork) +hidden_strong_alias(__libc_fork,__vfork) #else .text -.global vfork -.type vfork,%function +.global __vfork +.hidden __vfork +.type __vfork,%function .align 16 -vfork: +__vfork: /* Pop the return PC value into RDI. We need a register that is preserved by the syscall and that we're allowed to destroy. */ @@ -55,7 +56,8 @@ vfork: /* Normal return. */ ret -.size vfork,.-vfork +.size __vfork,.-__vfork #endif /* __NR_vfork */ +weak_alias(__vfork,vfork) libc_hidden_def(vfork) -- cgit v1.2.3