diff options
author | Peter S. Mazinger <ps.m@gmx.net> | 2011-04-16 15:40:50 +0200 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2012-06-15 14:00:40 +0200 |
commit | 0a043c30ee71245dfe7c9d82d654312c5e1f6127 (patch) | |
tree | 5596b98af169f71b9ce8d3ba0f0088b271bee2c2 | |
parent | 917176e71ef901297e420bbb0db99be5e8100fc3 (diff) |
vfork: make all archs consistent
__vfork is hidden.
__GI_vfork is strong (not weak as it was).
vfork is weak.
e1 can use the generic version.
Note: libc_hidden_def(x) has different meaning in .c and .S files.
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
25 files changed, 69 insertions, 91 deletions
diff --git a/libc/sysdeps/linux/arm/vfork.S b/libc/sysdeps/linux/arm/vfork.S index 17d6a4db0..6a1c65e09 100644 --- a/libc/sysdeps/linux/arm/vfork.S +++ b/libc/sysdeps/linux/arm/vfork.S @@ -104,5 +104,5 @@ __error: .size __vfork,.-__vfork weak_alias(__vfork,vfork) -libc_hidden_weak(vfork) +libc_hidden_def(vfork) #endif diff --git a/libc/sysdeps/linux/avr32/vfork.S b/libc/sysdeps/linux/avr32/vfork.S index 03ca99f65..b2c5ceb55 100644 --- a/libc/sysdeps/linux/avr32/vfork.S +++ b/libc/sysdeps/linux/avr32/vfork.S @@ -17,10 +17,10 @@ * Fortunately, the Linux kernel preserves LR across system calls. */ -#include <features.h> #include <sys/syscall.h> .global __vfork + .hidden __vfork .type __vfork,@function .align 1 __vfork: @@ -55,4 +55,4 @@ __vfork: .size __vfork, . - __vfork weak_alias(__vfork,vfork) -libc_hidden_weak(vfork) +libc_hidden_def(vfork) diff --git a/libc/sysdeps/linux/common/vfork.c b/libc/sysdeps/linux/common/vfork.c index e7c920892..a70ed4a63 100644 --- a/libc/sysdeps/linux/common/vfork.c +++ b/libc/sysdeps/linux/common/vfork.c @@ -4,30 +4,22 @@ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ -#include <unistd.h> -#include <sys/types.h> #include <sys/syscall.h> +#if (defined __NR_vfork || (defined __ARCH_USE_MMU__ && defined __NR_fork)) && (defined __USE_BSD || defined __USE_XOPEN_EXTENDED) +# include <unistd.h> extern __typeof(vfork) __vfork attribute_hidden; -#ifdef __NR_vfork - -# define __NR___vfork __NR_vfork +# ifdef __NR_vfork +# define __NR___vfork __NR_vfork _syscall0(pid_t, __vfork) - -weak_alias(__vfork,vfork) -libc_hidden_weak(vfork) - -#elif defined __ARCH_USE_MMU__ && defined __NR_fork - +# else /* Trivial implementation for arches that lack vfork */ - pid_t __vfork(void) { return fork(); } - -weak_alias(__vfork,vfork) +# endif +strong_alias(__vfork,vfork) libc_hidden_weak(vfork) - #endif diff --git a/libc/sysdeps/linux/cris/sysdep.h b/libc/sysdeps/linux/cris/sysdep.h index 5960fe235..921dbb3f0 100644 --- a/libc/sysdeps/linux/cris/sysdep.h +++ b/libc/sysdeps/linux/cris/sysdep.h @@ -127,6 +127,14 @@ .align ALIGNARG (2) @ \ C_LABEL(name) +#define HIDDEN_ENTRY(name) \ + .text @ \ + ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (name) @ \ + .hidden C_SYMBOL_NAME (name) @ \ + ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME (name), function) @ \ + .align ALIGNARG (2) @ \ + C_LABEL(name) + #undef END #define END(name) \ ASM_SIZE_DIRECTIVE (C_SYMBOL_NAME (name)) diff --git a/libc/sysdeps/linux/cris/vfork.S b/libc/sysdeps/linux/cris/vfork.S index ea8a81d82..964eca4c1 100644 --- a/libc/sysdeps/linux/cris/vfork.S +++ b/libc/sysdeps/linux/cris/vfork.S @@ -16,7 +16,7 @@ * enclosing function */ -ENTRY(__vfork) +HIDDEN_ENTRY(__vfork) movu.w __NR_vfork,$r9 break 13 cmps.w -4096,$r10 @@ -27,4 +27,4 @@ ENTRY(__vfork) PSEUDO_END(__vfork) weak_alias(__vfork,vfork) -libc_hidden_weak(vfork) +libc_hidden_def(vfork) diff --git a/libc/sysdeps/linux/e1/Makefile b/libc/sysdeps/linux/e1/Makefile index c69ccb9e2..29d1c9e47 100644 --- a/libc/sysdeps/linux/e1/Makefile +++ b/libc/sysdeps/linux/e1/Makefile @@ -17,7 +17,7 @@ CRT_OBJ := crt0.o CTOR_TARGETS := $(TOPDIR)lib/crti.o $(TOPDIR)lib/crtn.o # why is crt1.c listed in CSRC ? -CSRC := crt1.c syscalls.c longjmp.c setjmp.c vfork.c +CSRC := crt1.c syscalls.c longjmp.c setjmp.c OBJS := $(patsubst %.c,%.o, $(CSRC)) OBJ_LIST := ../../../obj.sysdeps.$(TARGET_ARCH) diff --git a/libc/sysdeps/linux/e1/vfork.c b/libc/sysdeps/linux/e1/vfork.c deleted file mode 100644 index c7caafd32..000000000 --- a/libc/sysdeps/linux/e1/vfork.c +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> - * - * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. - */ - -#include <sys/types.h> -#include <sys/syscall.h> -#include <errno.h> - -#define __NR___vfork __NR_vfork -attribute_hidden _syscall0(pid_t, __vfork) -weak_alias(__vfork,vfork) -libc_hidden_weak(vfork) diff --git a/libc/sysdeps/linux/frv/vfork.S b/libc/sysdeps/linux/frv/vfork.S index 8935a12f8..4fefffde1 100644 --- a/libc/sysdeps/linux/frv/vfork.S +++ b/libc/sysdeps/linux/frv/vfork.S @@ -17,11 +17,7 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include <features.h> - -#include <asm/unistd.h> -#define _ERRNO_H 1 -#include <bits/errno.h> +#include <sys/syscall.h> .text .globl __vfork @@ -44,4 +40,4 @@ __vfork: .size __vfork,.-__vfork weak_alias(__vfork,vfork) -libc_hidden_weak(vfork) +libc_hidden_def(vfork) diff --git a/libc/sysdeps/linux/h8300/vfork.S b/libc/sysdeps/linux/h8300/vfork.S index 35c04e559..9b65f4fe0 100644 --- a/libc/sysdeps/linux/h8300/vfork.S +++ b/libc/sysdeps/linux/h8300/vfork.S @@ -1,5 +1,5 @@ -#include <asm/unistd.h> +#include <sys/syscall.h> #ifndef __NR_vfork #define __NR_vfork __NR_fork /* uClinux-2.0 only has fork which is vfork */ @@ -12,7 +12,6 @@ #endif .text .align 2 - .globl _errno .globl ___vfork .hidden ___vfork .type ___vfork,@function @@ -38,4 +37,4 @@ fix_errno: jmp @er1 /* don't return, just jmp directly */ weak_alias(__vfork,vfork) -libc_hidden_weak(vfork) +libc_hidden_def(vfork) diff --git a/libc/sysdeps/linux/i386/vfork.S b/libc/sysdeps/linux/i386/vfork.S index c9db2f48c..d85726f19 100644 --- a/libc/sysdeps/linux/i386/vfork.S +++ b/libc/sysdeps/linux/i386/vfork.S @@ -38,4 +38,4 @@ __vfork: .size __vfork,.-__vfork weak_alias(__vfork,vfork) -libc_hidden_weak(vfork) +libc_hidden_def(vfork) diff --git a/libc/sysdeps/linux/i960/vfork.S b/libc/sysdeps/linux/i960/vfork.S index 1646e1be4..e43146cd2 100644 --- a/libc/sysdeps/linux/i960/vfork.S +++ b/libc/sysdeps/linux/i960/vfork.S @@ -18,6 +18,7 @@ .globl ___vfork .hidden ___vfork + .type ___vfork,@function ___vfork: mov g13, r3 ldconst __NR_vfork, g13 @@ -30,4 +31,4 @@ ___vfork: ret weak_alias(__vfork,vfork) -libc_hidden_weak(vfork) +libc_hidden_def(vfork) diff --git a/libc/sysdeps/linux/ia64/sysdep.h b/libc/sysdeps/linux/ia64/sysdep.h index d10020ac1..bae27d1a6 100644 --- a/libc/sysdeps/linux/ia64/sysdep.h +++ b/libc/sysdeps/linux/ia64/sysdep.h @@ -49,6 +49,15 @@ C_LABEL(name) \ CALL_MCOUNT +#define HIDDEN_ENTRY(name) \ + .text; \ + .align 32; \ + .proc C_SYMBOL_NAME(name); \ + .global C_SYMBOL_NAME(name); \ + .hidden C_SYMBOL_NAME(name); \ + C_LABEL(name) \ + CALL_MCOUNT + #define LEAF(name) \ .text; \ .align 32; \ diff --git a/libc/sysdeps/linux/ia64/vfork.S b/libc/sysdeps/linux/ia64/vfork.S index f233b05e2..ba0a862cb 100644 --- a/libc/sysdeps/linux/ia64/vfork.S +++ b/libc/sysdeps/linux/ia64/vfork.S @@ -29,7 +29,7 @@ /* pid_t vfork(void); */ /* Implemented as __clone_syscall(CLONE_VFORK | CLONE_VM | SIGCHLD, 0) */ -ENTRY(__vfork) +HIDDEN_ENTRY(__vfork) alloc r2=ar.pfs,0,0,2,0 mov out0=CLONE_VM+CLONE_VFORK+SIGCHLD mov out1=0 /* Standard sp value. */ @@ -41,4 +41,4 @@ ENTRY(__vfork) PSEUDO_END(__vfork) weak_alias(__vfork,vfork) -libc_hidden_weak(vfork) +libc_hidden_def(vfork) diff --git a/libc/sysdeps/linux/m68k/vfork.S b/libc/sysdeps/linux/m68k/vfork.S index 56d57f73c..b2fe03377 100644 --- a/libc/sysdeps/linux/m68k/vfork.S +++ b/libc/sysdeps/linux/m68k/vfork.S @@ -4,9 +4,7 @@ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ -#include <features.h> - -#include <asm/unistd.h> +#include <sys/syscall.h> #ifndef __NR_vfork #define __NR_vfork __NR_fork /* uClinux-2.0 only has fork which is vfork */ @@ -16,7 +14,6 @@ .text .align 2 - .globl errno .globl __vfork .hidden __vfork .type __vfork,@function @@ -42,4 +39,4 @@ fix_errno: .size __vfork,.-__vfork weak_alias(__vfork,vfork) -libc_hidden_weak(vfork) +libc_hidden_def(vfork) diff --git a/libc/sysdeps/linux/microblaze/vfork.S b/libc/sysdeps/linux/microblaze/vfork.S index 57db5e543..cd6012889 100644 --- a/libc/sysdeps/linux/microblaze/vfork.S +++ b/libc/sysdeps/linux/microblaze/vfork.S @@ -13,21 +13,15 @@ * Microblaze port by John Williams */ -#define _ERRNO_H 1 -#include <bits/errno.h> -#define _SYSCALL_H -#include <bits/sysnum.h> - -#include <libc-symbols.h> +#include <sys/syscall.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. */ -.global C_SYMBOL_NAME(errno) - .globl __vfork + .hidden __vfork .align 4 __vfork: addi r12, r0, SYS_vfork @@ -50,4 +44,4 @@ __vfork: .size __vfork, .-__vfork weak_alias(__vfork,vfork) -libc_hidden_weak(vfork) +libc_hidden_def(vfork) diff --git a/libc/sysdeps/linux/mips/vfork.S b/libc/sysdeps/linux/mips/vfork.S index 00cc675fa..cbf1da6dd 100644 --- a/libc/sysdeps/linux/mips/vfork.S +++ b/libc/sysdeps/linux/mips/vfork.S @@ -18,6 +18,7 @@ /* vfork() is just a special case of clone(). */ +#include <sys/syscall.h> #include <sys/asm.h> #include <sysdep.h> @@ -34,6 +35,7 @@ /* int vfork() */ .text + .hidden __vfork LOCALSZ= 1 FRAMESZ= (((NARGSAVE+LOCALSZ)*SZREG)+ALSZ)&ALMASK GPOFF= FRAMESZ-(1*SZREG) @@ -96,6 +98,6 @@ L(error): END(__vfork) weak_alias(__vfork,vfork) -libc_hidden_weak(vfork) +libc_hidden_def(vfork) #endif diff --git a/libc/sysdeps/linux/nios/vfork.S b/libc/sysdeps/linux/nios/vfork.S index f8a6d031c..603a07e83 100644 --- a/libc/sysdeps/linux/nios/vfork.S +++ b/libc/sysdeps/linux/nios/vfork.S @@ -10,9 +10,6 @@ * Written by Wentao Xu <wentao@microtronix.com> */ -#include <features.h> - -#include <bits/errno.h> #include <sys/syscall.h> #include "NM_Macros.S" @@ -51,4 +48,4 @@ fix_errno: .size __vfork,.-__vfork weak_alias(__vfork,vfork) -libc_hidden_weak(vfork) +libc_hidden_def(vfork) diff --git a/libc/sysdeps/linux/nios2/vfork.S b/libc/sysdeps/linux/nios2/vfork.S index 5d275ffdd..5d61db030 100644 --- a/libc/sysdeps/linux/nios2/vfork.S +++ b/libc/sysdeps/linux/nios2/vfork.S @@ -10,11 +10,7 @@ * Written by Wentao Xu <wentao@microtronix.com> */ -#include <features.h> - -#define _ERRNO_H -#include <bits/errno.h> -#include <asm/unistd.h> +#include <sys/syscall.h> #ifndef __NR_vfork #define __NR_vfork __NR_fork /* uClinux-2.0 only has fork which is vfork */ @@ -53,4 +49,4 @@ fix_errno: .size __vfork,.-__vfork weak_alias(__vfork,vfork) -libc_hidden_weak(vfork) +libc_hidden_def(vfork) diff --git a/libc/sysdeps/linux/powerpc/vfork.S b/libc/sysdeps/linux/powerpc/vfork.S index 008374260..0f31edafc 100644 --- a/libc/sysdeps/linux/powerpc/vfork.S +++ b/libc/sysdeps/linux/powerpc/vfork.S @@ -27,4 +27,4 @@ __vfork: .size __vfork,.-__vfork weak_alias(__vfork,vfork) -libc_hidden_weak(vfork) +libc_hidden_def(vfork) diff --git a/libc/sysdeps/linux/sh/vfork.S b/libc/sysdeps/linux/sh/vfork.S index d311bff12..a60a7ef93 100644 --- a/libc/sysdeps/linux/sh/vfork.S +++ b/libc/sysdeps/linux/sh/vfork.S @@ -20,11 +20,9 @@ respective copyright holders. */ -#include <features.h> #include <sys/syscall.h> #define _ERRNO_H #include <bits/errno.h> -#include <bits/sysnum.h> /* Clone the calling process, but without copying the whole address space. The calling process is suspended until the new process exits or is @@ -109,6 +107,6 @@ __vfork: .size __vfork, .-__vfork weak_alias(__vfork,vfork) -libc_hidden_weak(vfork) +libc_hidden_def(vfork) #include "syscall_error.S" diff --git a/libc/sysdeps/linux/sparc/vfork.S b/libc/sysdeps/linux/sparc/vfork.S index ed3e1a079..626183b2b 100644 --- a/libc/sysdeps/linux/sparc/vfork.S +++ b/libc/sysdeps/linux/sparc/vfork.S @@ -52,4 +52,4 @@ __vfork: .size __vfork,.-__vfork weak_alias(__vfork,vfork) -libc_hidden_weak(vfork) +libc_hidden_def(vfork) diff --git a/libc/sysdeps/linux/v850/vfork.S b/libc/sysdeps/linux/v850/vfork.S index 2533853b5..b67ebf8f5 100644 --- a/libc/sysdeps/linux/v850/vfork.S +++ b/libc/sysdeps/linux/v850/vfork.S @@ -11,12 +11,7 @@ * Written by Miles Bader <miles@gnu.org> */ -#include <features.h> -#define _ERRNO_H 1 -#include <bits/errno.h> -#define _SYSCALL_H -#include <bits/sysnum.h> - +#include <sys/syscall.h> #include <clinkage.h> /* Clone the calling process, but without copying the whole address space. @@ -24,8 +19,7 @@ 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. */ -.global C_SYMBOL_NAME(errno) - +/* this should be made hidden */ C_ENTRY (__vfork): addi SYS_vfork, r0, r12 trap 0 @@ -39,4 +33,4 @@ C_ENTRY (__vfork): jmp [lp] /* error return */ C_END(__vfork) weak_alias(__vfork,vfork) -libc_hidden_weak(vfork) +libc_hidden_def(vfork) diff --git a/libc/sysdeps/linux/x86_64/vfork.S b/libc/sysdeps/linux/x86_64/vfork.S index 97c9c5b67..8467fccaf 100644 --- a/libc/sysdeps/linux/x86_64/vfork.S +++ b/libc/sysdeps/linux/x86_64/vfork.S @@ -63,4 +63,4 @@ __vfork: .size __vfork,.-__vfork weak_alias(__vfork,vfork) -libc_hidden_weak(vfork) +libc_hidden_def(vfork) diff --git a/libc/sysdeps/linux/xtensa/sysdep.h b/libc/sysdeps/linux/xtensa/sysdep.h index 4c32c2ca4..fb691f8c6 100644 --- a/libc/sysdeps/linux/xtensa/sysdep.h +++ b/libc/sysdeps/linux/xtensa/sysdep.h @@ -38,6 +38,16 @@ entry sp, FRAMESIZE; \ CALL_MCOUNT +#define HIDDEN_ENTRY(name) \ + ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(name); \ + .hidden C_SYMBOL_NAME(name); \ + ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name), @function); \ + .align ALIGNARG(2); \ + LITERAL_POSITION; \ + C_LABEL(name) \ + entry sp, FRAMESIZE; \ + CALL_MCOUNT + #undef END #define END(name) ASM_SIZE_DIRECTIVE(name) diff --git a/libc/sysdeps/linux/xtensa/vfork.S b/libc/sysdeps/linux/xtensa/vfork.S index 6e490fe45..977064cbc 100644 --- a/libc/sysdeps/linux/xtensa/vfork.S +++ b/libc/sysdeps/linux/xtensa/vfork.S @@ -49,7 +49,7 @@ /* pid_t vfork(void); Implemented as __clone_syscall(CLONE_VFORK | CLONE_VM | SIGCHLD, 0) */ -ENTRY (__vfork) +HIDDEN_ENTRY (__vfork) movi a6, .Ljumptable extui a2, a0, 30, 2 /* call-size: call4/8/12 = 1/2/3 */ @@ -165,6 +165,5 @@ ENTRY (__vfork) .Lpseudo_end: retw -libc_hidden_def (__vfork) - weak_alias (__vfork, vfork) +libc_hidden_def(vfork) |