]>
Commit | Line | Data |
---|---|---|
5675da1e | 1 | /* vfork ABI-compatibility entry points for libpthread. |
688903eb | 2 | Copyright (C) 2014-2018 Free Software Foundation, Inc. |
5675da1e RM |
3 | This file is part of the GNU C Library. |
4 | ||
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. | |
9 | ||
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. | |
14 | ||
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/>. */ | |
18 | ||
19 | #include <unistd.h> | |
20 | #include <shlib-compat.h> | |
21 | ||
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. */ | |
30 | ||
8820e3ac RH |
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. | |
35 | ||
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. */ | |
39 | ||
40 | #if !HAVE_IFUNC | |
41 | # error "must write pt-vfork for this machine or get IFUNC support" | |
42 | #endif | |
43 | ||
5675da1e RM |
44 | #if (SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_20) \ |
45 | || SHLIB_COMPAT (libpthread, GLIBC_2_1_2, GLIBC_2_20)) | |
46 | ||
47 | extern __typeof (vfork) __libc_vfork; /* Defined in libc. */ | |
48 | ||
051f8be7 SL |
49 | # undef INIT_ARCH |
50 | # define INIT_ARCH() | |
51 | # define DEFINE_VFORK(name) libc_ifunc (name, &__libc_vfork) | |
5675da1e | 52 | |
5675da1e RM |
53 | #endif |
54 | ||
55 | #if SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_20) | |
051f8be7 | 56 | extern __typeof(vfork) vfork_ifunc; |
900e445f RH |
57 | DEFINE_VFORK (vfork_ifunc) |
58 | compat_symbol (libpthread, vfork_ifunc, vfork, GLIBC_2_0); | |
5675da1e RM |
59 | #endif |
60 | ||
61 | #if SHLIB_COMPAT (libpthread, GLIBC_2_1_2, GLIBC_2_20) | |
051f8be7 | 62 | extern __typeof(vfork) __vfork_ifunc; |
900e445f RH |
63 | DEFINE_VFORK (__vfork_ifunc) |
64 | compat_symbol (libpthread, __vfork_ifunc, __vfork, GLIBC_2_1_2); | |
5675da1e | 65 | #endif |