hurd: Fix build
[glibc.git] / nptl / pt-vfork.c
blob2f890d3f3070d0e2abc4122e5e49f6e174b51c89
1 /* vfork ABI-compatibility entry points for libpthread.
2 Copyright (C) 2014-2018 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 # undef INIT_ARCH
50 # define INIT_ARCH()
51 # define DEFINE_VFORK(name) libc_ifunc (name, &__libc_vfork)
53 #endif
55 #if SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_20)
56 extern __typeof(vfork) vfork_ifunc;
57 DEFINE_VFORK (vfork_ifunc)
58 compat_symbol (libpthread, vfork_ifunc, vfork, GLIBC_2_0);
59 #endif
61 #if SHLIB_COMPAT (libpthread, GLIBC_2_1_2, GLIBC_2_20)
62 extern __typeof(vfork) __vfork_ifunc;
63 DEFINE_VFORK (__vfork_ifunc)
64 compat_symbol (libpthread, __vfork_ifunc, __vfork, GLIBC_2_1_2);
65 #endif