From f7c7c0e055425e0122996a91704cc12bfaeef308 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Thu, 15 Dec 2005 19:49:58 +0000 Subject: Hide fork and vfork, use the newly introduced *alias --- libc/sysdeps/linux/arm/vfork.S | 15 ++++++++++----- libc/sysdeps/linux/common/fork.c | 7 ++++--- libc/sysdeps/linux/common/vfork.c | 7 +++++-- libc/sysdeps/linux/frv/vfork.S | 12 ++++++++---- libc/sysdeps/linux/i386/vfork.S | 9 +++++---- libc/sysdeps/linux/m68k/vfork.S | 15 ++++++++++----- libc/sysdeps/linux/powerpc/vfork.S | 9 ++++++--- libc/sysdeps/linux/powerpc/vfork.c | 4 ++-- libc/sysdeps/linux/sh/vfork.S | 12 +++++++----- libc/sysdeps/linux/sparc/fork.S | 15 ++++++++------- libc/sysdeps/linux/sparc/vfork.S | 15 +++++++-------- libc/sysdeps/linux/x86_64/vfork.S | 11 ++++++----- 12 files changed, 78 insertions(+), 53 deletions(-) (limited to 'libc') diff --git a/libc/sysdeps/linux/arm/vfork.S b/libc/sysdeps/linux/arm/vfork.S index 530bba07c..68798995a 100644 --- a/libc/sysdeps/linux/arm/vfork.S +++ b/libc/sysdeps/linux/arm/vfork.S @@ -8,16 +8,20 @@ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ +#include + #define _ERRNO_H #include #include #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 @@ -34,11 +38,12 @@ vfork: swi __NR_fork cmn r0, #4096 - /* Syscal worked. Return to child/parent */ + /* Syscall worked. Return to child/parent */ movcc pc, lr __error: b __syscall_error -.size vfork,.-vfork +.size __vfork,.-__vfork +strong_alias(__vfork,vfork) #endif diff --git a/libc/sysdeps/linux/common/fork.c b/libc/sysdeps/linux/common/fork.c index e766799c0..899cbaf63 100644 --- a/libc/sysdeps/linux/common/fork.c +++ b/libc/sysdeps/linux/common/fork.c @@ -12,8 +12,9 @@ #ifdef __ARCH_HAS_MMU__ #ifdef __NR_fork -#define __NR___libc_fork __NR_fork -_syscall0(pid_t, __libc_fork); -weak_alias(__libc_fork, fork); +#define __NR___fork __NR_fork +attribute_hidden _syscall0(pid_t, __fork); +strong_alias(__fork,fork) +weak_alias(__fork,__libc_fork) #endif #endif diff --git a/libc/sysdeps/linux/common/vfork.c b/libc/sysdeps/linux/common/vfork.c index ba4f042ca..d0a4d9a0e 100644 --- a/libc/sysdeps/linux/common/vfork.c +++ b/libc/sysdeps/linux/common/vfork.c @@ -2,7 +2,10 @@ #include #include -pid_t vfork(void) +extern __pid_t __fork (void) __THROW attribute_hidden; + +pid_t attribute_hidden __vfork(void) { - return fork(); + return __fork(); } +strong_alias(__vfork,vfork) diff --git a/libc/sysdeps/linux/frv/vfork.S b/libc/sysdeps/linux/frv/vfork.S index 230f2f820..b5ecc09af 100644 --- a/libc/sysdeps/linux/frv/vfork.S +++ b/libc/sysdeps/linux/frv/vfork.S @@ -17,15 +17,18 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include + #include #define _ERRNO_H 1 #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 @@ -38,5 +41,6 @@ vfork: ldd @(gr14, gr15), gr14 jmpl @(gr14, gr0) - .size vfork,.-vfork + .size __vfork,.-__vfork +strong_alias(__vfork,vfork) diff --git a/libc/sysdeps/linux/i386/vfork.S b/libc/sysdeps/linux/i386/vfork.S index d382dbac3..18a8e5dfa 100644 --- a/libc/sysdeps/linux/i386/vfork.S +++ b/libc/sysdeps/linux/i386/vfork.S @@ -3,17 +3,20 @@ * */ +#include #include #ifndef __NR_vfork /* No vfork so use fork instead */ -.weak vfork ; vfork = __libc_fork +hidden_strong_alias(__fork,__vfork) +weak_alias(vfork,__libc_fork) #else .text .global __vfork +.hidden __vfork .type __vfork,%function .align 1<<4 @@ -27,7 +30,5 @@ __vfork: ret .size __vfork,.-__vfork - - -.weak vfork ; vfork = __vfork #endif +strong_alias(__vfork,vfork) diff --git a/libc/sysdeps/linux/m68k/vfork.S b/libc/sysdeps/linux/m68k/vfork.S index 5db163bf5..e58b9e949 100644 --- a/libc/sysdeps/linux/m68k/vfork.S +++ b/libc/sysdeps/linux/m68k/vfork.S @@ -1,3 +1,4 @@ +#include #include @@ -10,11 +11,13 @@ .text .align 2 .globl errno - .globl vfork -#if defined __HAVE_ELF__ - .type vfork,@function + .globl __vfork +#ifdef __HAVE_ELF__ + .hidden __vfork + .type __vfork,@function #endif -vfork: + +__vfork: movl %sp@+, %a1 /* save the return address for later */ movl IMM __NR_vfork,%d0 trap #0 @@ -24,7 +27,7 @@ vfork: jmp %a1@ /* don't return, just jmp directly */ fix_errno: negl %d0 -#ifndef __PIC__ +#ifndef __PIC__ /* needs handling as the other archs */ movl errno, %a0 #else movl errno@GOT(%a5), %a0 @@ -33,3 +36,5 @@ fix_errno: movl IMM -1, %d0 jmp %a1@ /* don't return, just jmp directly */ +.size __vfork,.-__vfork +strong_alias(__vfork,vfork) diff --git a/libc/sysdeps/linux/powerpc/vfork.S b/libc/sysdeps/linux/powerpc/vfork.S index 67d8aaeac..7cf5eaa16 100644 --- a/libc/sysdeps/linux/powerpc/vfork.S +++ b/libc/sysdeps/linux/powerpc/vfork.S @@ -1,14 +1,17 @@ +#include #include #ifndef __NR_vfork /* No vfork so use fork instead */ -.weak vfork ; vfork = __libc_fork +hidden_strong_alias(__fork,__vfork) +weak_alias(vfork,__libc_fork) #else .text .global __vfork +.hidden __vfork .type __vfork,@function .type __syscall_error,@function @@ -17,7 +20,7 @@ __vfork: sc bnslr+ b __syscall_error -.size __vfork,.-__vfork -.weak vfork ; vfork = __vfork +.size __vfork,.-__vfork #endif +strong_alias(__vfork,vfork) diff --git a/libc/sysdeps/linux/powerpc/vfork.c b/libc/sysdeps/linux/powerpc/vfork.c index 6623d8dde..39f992513 100644 --- a/libc/sysdeps/linux/powerpc/vfork.c +++ b/libc/sysdeps/linux/powerpc/vfork.c @@ -9,7 +9,7 @@ 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"); @@ -46,4 +46,4 @@ pid_t vfork(void) __syscall_return (pid_t); } - +strong_alias(__vfork,vfork) diff --git a/libc/sysdeps/linux/sh/vfork.S b/libc/sysdeps/linux/sh/vfork.S index 981928e08..f3c20a9d6 100644 --- a/libc/sysdeps/linux/sh/vfork.S +++ b/libc/sysdeps/linux/sh/vfork.S @@ -32,9 +32,11 @@ and the process ID of the new process to the old process. */ .text -.align 4 +.globl __vfork +.hidden __vfork .type __vfork,@function -.globl __vfork; +.align 4 + __vfork: mov.w .L2, r3 trapa #0x10 @@ -104,9 +106,9 @@ __vfork: .word __NR_vfork .L3: .word __NR_fork - .size __vfork, .-__vfork -.weak vfork - vfork = __vfork + +.size __vfork, .-__vfork +strong_alias(__vfork,vfork) #include "syscall_error.S" diff --git a/libc/sysdeps/linux/sparc/fork.S b/libc/sysdeps/linux/sparc/fork.S index c382f4b4e..dfa109dcd 100644 --- a/libc/sysdeps/linux/sparc/fork.S +++ b/libc/sysdeps/linux/sparc/fork.S @@ -19,14 +19,16 @@ /* Code taken from glibc2.2.2/sysdeps/unix/sysv/linux/sparc/vfork.S */ +#include #include .text -.global __libc_fork -.type __libc_fork,%function +.global __fork +.hidden __fork +.type __fork,%function .align 4 -__libc_fork: +__fork: mov __NR_fork, %g1 ta 0x10 bcc,a 9000f @@ -43,7 +45,6 @@ __libc_fork: retl and %o0, %o1, %o0 -.size __libc_fork,.-__libc_fork - -.weak fork - fork = __libc_fork +.size __fork,.-__fork +strong_alias(__fork,fork) +weak_alias(fork,__libc_fork) diff --git a/libc/sysdeps/linux/sparc/vfork.S b/libc/sysdeps/linux/sparc/vfork.S index 854b66182..9b7092c98 100644 --- a/libc/sysdeps/linux/sparc/vfork.S +++ b/libc/sysdeps/linux/sparc/vfork.S @@ -23,14 +23,16 @@ #ifndef __NR_vfork /* No vfork so use fork instead */ -.weak vfork - vfork = __libc_fork + +hidden_strong_alias(__fork,__vfork) +weak_alias(vfork,__libc_fork) #else .text -.global vfork -.type vfork,%function +.global __vfork +.hidden __vfork +.type __vfork,%function .align 4 __vfork: @@ -51,8 +53,5 @@ __vfork: and %o0, %o1, %o0 .size __vfork,.-__vfork - -.weak vfork - vfork = __vfork - #endif /* __NR_vfork */ +strong_alias(__vfork,vfork) diff --git a/libc/sysdeps/linux/x86_64/vfork.S b/libc/sysdeps/linux/x86_64/vfork.S index dde29e96a..5786058d2 100644 --- a/libc/sysdeps/linux/x86_64/vfork.S +++ b/libc/sysdeps/linux/x86_64/vfork.S @@ -16,6 +16,7 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include #include /* Clone the calling process, but without copying the whole address space. @@ -25,15 +26,17 @@ #ifndef __NR_vfork /* No vfork so use fork instead */ -.weak vfork - vfork = __libc_fork +hidden_strong_alias(__fork,__vfork) +weak_alias(vfork,__libc_fork) #else .text .global __vfork +.hidden __vfork .type __vfork,%function .align 16 + __vfork: /* Pop the return PC value into RDI. We need a register that @@ -58,7 +61,5 @@ __error: .size __vfork,.-__vfork -.weak vfork - vfork = __vfork - #endif /* __NR_vfork */ +strong_alias(__vfork,vfork) -- cgit v1.2.3