hppa: Fix feupdateenv and fesetexceptflag (Bug 18111).
[glibc.git] / nptl / pt-vfork.c
blobaebb7b6bd6b247157592ca257b7aa050768751b1
1 /* vfork ABI-compatibility entry points for libpthread.
2 Copyright (C) 2014-2015 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
19 #include <unistd.h>
20 #include <shlib-compat.h>
22 /* libpthread used to have its own vfork implementation that differed
23 from libc's only in having a pointless micro-optimization. There
24 is no longer any use to having a separate copy in libpthread, but
25 the historical ABI requires it. For static linking, there is no
26 need to provide anything here--the libc version will be linked in.
27 For shared library ABI compatibility, there must be __vfork and
28 vfork symbols in libpthread.so; so we define them using IFUNC to
29 redirect to the libc function. */
31 /* Note! If the architecture doesn't support IFUNC, then we need an
32 alternate target-specific mechanism to implement this. So we just
33 assume IFUNC here and require that the target override this file
34 if necessary.
36 If the architecture can assume all supported versions of gcc will
37 produce a tail-call to __libc_vfork, consider including the version
38 in sysdeps/unix/sysv/linux/aarch64/pt-vfork.c. */
40 #if !HAVE_IFUNC
41 # error "must write pt-vfork for this machine or get IFUNC support"
42 #endif
44 #if (SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_20) \
45 || SHLIB_COMPAT (libpthread, GLIBC_2_1_2, GLIBC_2_20))
47 extern __typeof (vfork) __libc_vfork; /* Defined in libc. */
49 static __typeof (vfork) *
50 __attribute__ ((used))
51 vfork_resolve (void)
53 return &__libc_vfork;
56 # ifdef HAVE_ASM_SET_DIRECTIVE
57 # define DEFINE_VFORK(name) \
58 asm (".set " #name ", vfork_resolve\n" \
59 ".globl " #name "\n" \
60 ".type " #name ", %gnu_indirect_function");
61 # else
62 # define DEFINE_VFORK(name) \
63 asm (#name " = vfork_resolve\n" \
64 ".globl " #name "\n" \
65 ".type " #name ", %gnu_indirect_function");
66 # endif
67 #endif
69 #if SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_20)
70 DEFINE_VFORK (vfork_ifunc)
71 compat_symbol (libpthread, vfork_ifunc, vfork, GLIBC_2_0);
72 #endif
74 #if SHLIB_COMPAT (libpthread, GLIBC_2_1_2, GLIBC_2_20)
75 DEFINE_VFORK (__vfork_ifunc)
76 compat_symbol (libpthread, __vfork_ifunc, __vfork, GLIBC_2_1_2);
77 #endif