Blame nptl/pt-vfork.c

Packit Bot 0c2104
/* vfork ABI-compatibility entry points for libpthread.
Packit Bot 0c2104
   Copyright (C) 2014-2018 Free Software Foundation, Inc.
Packit Bot 0c2104
   This file is part of the GNU C Library.
Packit Bot 0c2104
Packit Bot 0c2104
   The GNU C Library is free software; you can redistribute it and/or
Packit Bot 0c2104
   modify it under the terms of the GNU Lesser General Public
Packit Bot 0c2104
   License as published by the Free Software Foundation; either
Packit Bot 0c2104
   version 2.1 of the License, or (at your option) any later version.
Packit Bot 0c2104
Packit Bot 0c2104
   The GNU C Library is distributed in the hope that it will be useful,
Packit Bot 0c2104
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Bot 0c2104
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Bot 0c2104
   Lesser General Public License for more details.
Packit Bot 0c2104
Packit Bot 0c2104
   You should have received a copy of the GNU Lesser General Public
Packit Bot 0c2104
   License along with the GNU C Library; if not, see
Packit Bot 0c2104
   <http://www.gnu.org/licenses/>.  */
Packit Bot 0c2104
Packit Bot 0c2104
#include <unistd.h>
Packit Bot 0c2104
#include <shlib-compat.h>
Packit Bot 0c2104
Packit Bot 0c2104
/* libpthread used to have its own vfork implementation that differed
Packit Bot 0c2104
   from libc's only in having a pointless micro-optimization.  There
Packit Bot 0c2104
   is no longer any use to having a separate copy in libpthread, but
Packit Bot 0c2104
   the historical ABI requires it.  For static linking, there is no
Packit Bot 0c2104
   need to provide anything here--the libc version will be linked in.
Packit Bot 0c2104
   For shared library ABI compatibility, there must be __vfork and
Packit Bot 0c2104
   vfork symbols in libpthread.so; so we define them using IFUNC to
Packit Bot 0c2104
   redirect to the libc function.  */
Packit Bot 0c2104
Packit Bot 0c2104
/* Note! If the architecture doesn't support IFUNC, then we need an
Packit Bot 0c2104
   alternate target-specific mechanism to implement this.  So we just
Packit Bot 0c2104
   assume IFUNC here and require that the target override this file
Packit Bot 0c2104
   if necessary.
Packit Bot 0c2104
Packit Bot 0c2104
   If the architecture can assume all supported versions of gcc will
Packit Bot 0c2104
   produce a tail-call to __libc_vfork, consider including the version
Packit Bot 0c2104
   in sysdeps/unix/sysv/linux/aarch64/pt-vfork.c.  */
Packit Bot 0c2104
Packit Bot 0c2104
#if !HAVE_IFUNC
Packit Bot 0c2104
# error "must write pt-vfork for this machine or get IFUNC support"
Packit Bot 0c2104
#endif
Packit Bot 0c2104
Packit Bot 0c2104
#if (SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_20) \
Packit Bot 0c2104
     || SHLIB_COMPAT (libpthread, GLIBC_2_1_2, GLIBC_2_20))
Packit Bot 0c2104
Packit Bot 0c2104
extern __typeof (vfork) __libc_vfork;   /* Defined in libc.  */
Packit Bot 0c2104
Packit Bot 0c2104
# undef INIT_ARCH
Packit Bot 0c2104
# define INIT_ARCH()
Packit Bot 0c2104
# define DEFINE_VFORK(name) libc_ifunc (name, &__libc_vfork)
Packit Bot 0c2104
Packit Bot 0c2104
#endif
Packit Bot 0c2104
Packit Bot 0c2104
#if SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_20)
Packit Bot 0c2104
extern __typeof(vfork) vfork_ifunc;
Packit Bot 0c2104
DEFINE_VFORK (vfork_ifunc)
Packit Bot 0c2104
compat_symbol (libpthread, vfork_ifunc, vfork, GLIBC_2_0);
Packit Bot 0c2104
#endif
Packit Bot 0c2104
Packit Bot 0c2104
#if SHLIB_COMPAT (libpthread, GLIBC_2_1_2, GLIBC_2_20)
Packit Bot 0c2104
extern __typeof(vfork) __vfork_ifunc;
Packit Bot 0c2104
DEFINE_VFORK (__vfork_ifunc)
Packit Bot 0c2104
compat_symbol (libpthread, __vfork_ifunc, __vfork, GLIBC_2_1_2);
Packit Bot 0c2104
#endif