diff mbox series

[09/16] Remove stat wrapper functions, move them to exported symbols

Message ID 20200723194641.1949404-10-adhemerval.zanella@linaro.org
State New
Headers show
Series Add y2038 support for stat functions | expand

Commit Message

Adhemerval Zanella July 23, 2020, 7:46 p.m. UTC
This patch removes the stat, stat64, lstat, lstat64, fstat, fstat64,
fstatat, and fstatat64 static wrapper and add the symbol on the libc
with the expected names.

Both the prototypes of the internal symbol linked by the static
wrappers and the inline redirectors are also removed from the installed
sys/stat.h header file.  The wrapper implementation license is also
change from LGPL to GPL.

Internally the _STAT_VER* definitions are moved to a arch-specific
xstatver.h file.  The internal defines that redirects internals
{f}stat{at} to their {f}xstat{at} counterparts are removed for Linux
(!NO_RTLD_HIDDEN).  Hurd still requires them since {f}stat{at} pulls
extra objects that makes the loader build fail otherwise (I haven't
dig into why exactly).

Checked with a build for all affected Linux ABIs and Hurd.  I checked
also on x86_64-linux-gnu and i686-linux-gnu.
---
 include/sys/stat.h                            |  94 ++++++++-----
 io/Makefile                                   |   4 +-
 io/Versions                                   |   4 +
 io/fstat.c                                    |  33 +----
 io/fstat64.c                                  |  36 +----
 io/fstatat.c                                  |  36 +----
 io/fstatat64.c                                |  36 +----
 io/lstat.c                                    |  33 +----
 io/lstat64.c                                  |  36 +----
 io/stat.c                                     |  34 +----
 io/stat64.c                                   |  36 +----
 io/sys/stat.h                                 | 129 ------------------
 nscd/gai.c                                    |   5 +
 sysdeps/generic/xstatver.h                    |   3 +
 sysdeps/mach/hurd/i386/libc.abilist           |   8 ++
 sysdeps/posix/getaddrinfo.c                   |   2 +-
 sysdeps/unix/sysv/linux/aarch64/libc.abilist  |   8 ++
 sysdeps/unix/sysv/linux/alpha/bits/stat.h     |   9 --
 sysdeps/unix/sysv/linux/alpha/libc.abilist    |   8 ++
 sysdeps/unix/sysv/linux/alpha/xstatver.h      |   9 ++
 sysdeps/unix/sysv/linux/arc/libc.abilist      |   8 ++
 sysdeps/unix/sysv/linux/arm/le/libc.abilist   |   8 ++
 sysdeps/unix/sysv/linux/bits/stat.h           |   6 -
 sysdeps/unix/sysv/linux/csky/libc.abilist     |   8 ++
 sysdeps/unix/sysv/linux/generic/bits/stat.h   |  11 --
 sysdeps/unix/sysv/linux/generic/xstatver.h    |   5 +
 sysdeps/unix/sysv/linux/hppa/libc.abilist     |   8 ++
 sysdeps/unix/sysv/linux/i386/libc.abilist     |   8 ++
 sysdeps/unix/sysv/linux/ia64/bits/stat.h      |   5 -
 sysdeps/unix/sysv/linux/ia64/libc.abilist     |   8 ++
 sysdeps/unix/sysv/linux/ia64/xstatver.h       |   5 +
 sysdeps/unix/sysv/linux/m68k/bits/stat.h      |   7 -
 .../unix/sysv/linux/m68k/m680x0/libc.abilist  |   8 ++
 sysdeps/unix/sysv/linux/m68k/xstatver.h       |   7 +
 .../sysv/linux/microblaze/be/libc.abilist     |   8 ++
 .../unix/sysv/linux/microblaze/bits/stat.h    |   7 -
 sysdeps/unix/sysv/linux/microblaze/xstatver.h |   7 +
 sysdeps/unix/sysv/linux/mips/bits/stat.h      |   7 -
 .../sysv/linux/mips/mips32/fpu/libc.abilist   |   8 ++
 .../sysv/linux/mips/mips64/n32/libc.abilist   |   8 ++
 .../sysv/linux/mips/mips64/n64/libc.abilist   |   8 ++
 sysdeps/unix/sysv/linux/mips/xstatver.h       |   7 +
 sysdeps/unix/sysv/linux/nios2/libc.abilist    |   8 ++
 sysdeps/unix/sysv/linux/powerpc/bits/stat.h   |  11 --
 .../linux/powerpc/powerpc32/fpu/libc.abilist  |   8 ++
 .../linux/powerpc/powerpc64/be/libc.abilist   |   8 ++
 .../linux/powerpc/powerpc64/le/libc.abilist   |   8 ++
 sysdeps/unix/sysv/linux/powerpc/xstatver.h    |  11 ++
 .../unix/sysv/linux/riscv/rv64/libc.abilist   |   8 ++
 sysdeps/unix/sysv/linux/s390/bits/stat.h      |  12 --
 .../unix/sysv/linux/s390/s390-32/libc.abilist |   8 ++
 .../unix/sysv/linux/s390/s390-64/libc.abilist |   8 ++
 sysdeps/unix/sysv/linux/s390/xstatver.h       |  16 +++
 sysdeps/unix/sysv/linux/sh/le/libc.abilist    |   8 ++
 sysdeps/unix/sysv/linux/sparc/bits/stat.h     |   7 -
 .../sysv/linux/sparc/sparc32/libc.abilist     |   8 ++
 .../sysv/linux/sparc/sparc64/libc.abilist     |   8 ++
 sysdeps/unix/sysv/linux/sparc/xstatver.h      |   7 +
 sysdeps/unix/sysv/linux/x86/bits/stat.h       |  10 --
 sysdeps/unix/sysv/linux/x86/xstatver.h        |  13 ++
 .../unix/sysv/linux/x86_64/64/libc.abilist    |   8 ++
 .../unix/sysv/linux/x86_64/x32/libc.abilist   |   8 ++
 sysdeps/unix/sysv/linux/xstatver.h            |   7 +
 63 files changed, 414 insertions(+), 501 deletions(-)
 create mode 100644 sysdeps/generic/xstatver.h
 create mode 100644 sysdeps/unix/sysv/linux/alpha/xstatver.h
 create mode 100644 sysdeps/unix/sysv/linux/generic/xstatver.h
 create mode 100644 sysdeps/unix/sysv/linux/ia64/xstatver.h
 create mode 100644 sysdeps/unix/sysv/linux/m68k/xstatver.h
 create mode 100644 sysdeps/unix/sysv/linux/microblaze/xstatver.h
 create mode 100644 sysdeps/unix/sysv/linux/mips/xstatver.h
 create mode 100644 sysdeps/unix/sysv/linux/powerpc/xstatver.h
 create mode 100644 sysdeps/unix/sysv/linux/s390/xstatver.h
 create mode 100644 sysdeps/unix/sysv/linux/sparc/xstatver.h
 create mode 100644 sysdeps/unix/sysv/linux/x86/xstatver.h
 create mode 100644 sysdeps/unix/sysv/linux/xstatver.h

Comments

Lukasz Majewski July 24, 2020, 9:23 a.m. UTC | #1
On Thu, 23 Jul 2020 16:46:34 -0300
Adhemerval Zanella <adhemerval.zanella@linaro.org> wrote:

> This patch removes the stat, stat64, lstat, lstat64, fstat, fstat64,
> fstatat, and fstatat64 static wrapper and add the symbol on the libc
> with the expected names.
> 
> Both the prototypes of the internal symbol linked by the static
> wrappers and the inline redirectors are also removed from the
> installed sys/stat.h header file.  The wrapper implementation license
> is also change from LGPL to GPL.
> 
> Internally the _STAT_VER* definitions are moved to a arch-specific
> xstatver.h file.  The internal defines that redirects internals
> {f}stat{at} to their {f}xstat{at} counterparts are removed for Linux
> (!NO_RTLD_HIDDEN).  Hurd still requires them since {f}stat{at} pulls
> extra objects that makes the loader build fail otherwise (I haven't
> dig into why exactly).
> 
> Checked with a build for all affected Linux ABIs and Hurd.  I checked
> also on x86_64-linux-gnu and i686-linux-gnu.

Reviewed-by: Lukasz Majewski <lukma@denx.de>

> ---
>  include/sys/stat.h                            |  94 ++++++++-----
>  io/Makefile                                   |   4 +-
>  io/Versions                                   |   4 +
>  io/fstat.c                                    |  33 +----
>  io/fstat64.c                                  |  36 +----
>  io/fstatat.c                                  |  36 +----
>  io/fstatat64.c                                |  36 +----
>  io/lstat.c                                    |  33 +----
>  io/lstat64.c                                  |  36 +----
>  io/stat.c                                     |  34 +----
>  io/stat64.c                                   |  36 +----
>  io/sys/stat.h                                 | 129
> ------------------ nscd/gai.c                                    |
> 5 + sysdeps/generic/xstatver.h                    |   3 +
>  sysdeps/mach/hurd/i386/libc.abilist           |   8 ++
>  sysdeps/posix/getaddrinfo.c                   |   2 +-
>  sysdeps/unix/sysv/linux/aarch64/libc.abilist  |   8 ++
>  sysdeps/unix/sysv/linux/alpha/bits/stat.h     |   9 --
>  sysdeps/unix/sysv/linux/alpha/libc.abilist    |   8 ++
>  sysdeps/unix/sysv/linux/alpha/xstatver.h      |   9 ++
>  sysdeps/unix/sysv/linux/arc/libc.abilist      |   8 ++
>  sysdeps/unix/sysv/linux/arm/le/libc.abilist   |   8 ++
>  sysdeps/unix/sysv/linux/bits/stat.h           |   6 -
>  sysdeps/unix/sysv/linux/csky/libc.abilist     |   8 ++
>  sysdeps/unix/sysv/linux/generic/bits/stat.h   |  11 --
>  sysdeps/unix/sysv/linux/generic/xstatver.h    |   5 +
>  sysdeps/unix/sysv/linux/hppa/libc.abilist     |   8 ++
>  sysdeps/unix/sysv/linux/i386/libc.abilist     |   8 ++
>  sysdeps/unix/sysv/linux/ia64/bits/stat.h      |   5 -
>  sysdeps/unix/sysv/linux/ia64/libc.abilist     |   8 ++
>  sysdeps/unix/sysv/linux/ia64/xstatver.h       |   5 +
>  sysdeps/unix/sysv/linux/m68k/bits/stat.h      |   7 -
>  .../unix/sysv/linux/m68k/m680x0/libc.abilist  |   8 ++
>  sysdeps/unix/sysv/linux/m68k/xstatver.h       |   7 +
>  .../sysv/linux/microblaze/be/libc.abilist     |   8 ++
>  .../unix/sysv/linux/microblaze/bits/stat.h    |   7 -
>  sysdeps/unix/sysv/linux/microblaze/xstatver.h |   7 +
>  sysdeps/unix/sysv/linux/mips/bits/stat.h      |   7 -
>  .../sysv/linux/mips/mips32/fpu/libc.abilist   |   8 ++
>  .../sysv/linux/mips/mips64/n32/libc.abilist   |   8 ++
>  .../sysv/linux/mips/mips64/n64/libc.abilist   |   8 ++
>  sysdeps/unix/sysv/linux/mips/xstatver.h       |   7 +
>  sysdeps/unix/sysv/linux/nios2/libc.abilist    |   8 ++
>  sysdeps/unix/sysv/linux/powerpc/bits/stat.h   |  11 --
>  .../linux/powerpc/powerpc32/fpu/libc.abilist  |   8 ++
>  .../linux/powerpc/powerpc64/be/libc.abilist   |   8 ++
>  .../linux/powerpc/powerpc64/le/libc.abilist   |   8 ++
>  sysdeps/unix/sysv/linux/powerpc/xstatver.h    |  11 ++
>  .../unix/sysv/linux/riscv/rv64/libc.abilist   |   8 ++
>  sysdeps/unix/sysv/linux/s390/bits/stat.h      |  12 --
>  .../unix/sysv/linux/s390/s390-32/libc.abilist |   8 ++
>  .../unix/sysv/linux/s390/s390-64/libc.abilist |   8 ++
>  sysdeps/unix/sysv/linux/s390/xstatver.h       |  16 +++
>  sysdeps/unix/sysv/linux/sh/le/libc.abilist    |   8 ++
>  sysdeps/unix/sysv/linux/sparc/bits/stat.h     |   7 -
>  .../sysv/linux/sparc/sparc32/libc.abilist     |   8 ++
>  .../sysv/linux/sparc/sparc64/libc.abilist     |   8 ++
>  sysdeps/unix/sysv/linux/sparc/xstatver.h      |   7 +
>  sysdeps/unix/sysv/linux/x86/bits/stat.h       |  10 --
>  sysdeps/unix/sysv/linux/x86/xstatver.h        |  13 ++
>  .../unix/sysv/linux/x86_64/64/libc.abilist    |   8 ++
>  .../unix/sysv/linux/x86_64/x32/libc.abilist   |   8 ++
>  sysdeps/unix/sysv/linux/xstatver.h            |   7 +
>  63 files changed, 414 insertions(+), 501 deletions(-)
>  create mode 100644 sysdeps/generic/xstatver.h
>  create mode 100644 sysdeps/unix/sysv/linux/alpha/xstatver.h
>  create mode 100644 sysdeps/unix/sysv/linux/generic/xstatver.h
>  create mode 100644 sysdeps/unix/sysv/linux/ia64/xstatver.h
>  create mode 100644 sysdeps/unix/sysv/linux/m68k/xstatver.h
>  create mode 100644 sysdeps/unix/sysv/linux/microblaze/xstatver.h
>  create mode 100644 sysdeps/unix/sysv/linux/mips/xstatver.h
>  create mode 100644 sysdeps/unix/sysv/linux/powerpc/xstatver.h
>  create mode 100644 sysdeps/unix/sysv/linux/s390/xstatver.h
>  create mode 100644 sysdeps/unix/sysv/linux/sparc/xstatver.h
>  create mode 100644 sysdeps/unix/sysv/linux/x86/xstatver.h
>  create mode 100644 sysdeps/unix/sysv/linux/xstatver.h
> 
> diff --git a/include/sys/stat.h b/include/sys/stat.h
> index f8847cf73e..0be918a7a7 100644
> --- a/include/sys/stat.h
> +++ b/include/sys/stat.h
> @@ -2,10 +2,26 @@
>  #include <io/sys/stat.h>
>  
>  #ifndef _ISOMAC
> +# include <xstatver.h>
> +
>  /* Now define the internal interfaces. */
>  extern int __stat (const char *__file, struct stat *__buf);
> +extern int __stat64 (const char *__file, struct stat64 *__buf);
>  extern int __fstat (int __fd, struct stat *__buf);
> +extern int __fstat64 (int __fd, struct stat64 *__buf);
>  extern int __lstat (const char *__file, struct stat *__buf);
> +extern int __lstat64 (const char *__file, struct stat64 *__buf);
> +extern int __fstatat (int dirfd, const char *pathname, struct stat
> *buf,
> +		      int flags);
> +extern int __fstatat64 (int dirfd, const char *pathname, struct
> stat64 *buf,
> +			int flags);
> +# if IS_IN (libc) || (IS_IN (rtld) && !defined NO_RTLD_HIDDEN)
> +hidden_proto (__stat64)
> +hidden_proto (__fstat64)
> +hidden_proto (__lstat64)
> +hidden_proto (__fstatat64)
> +# endif
> +
>  extern int __chmod (const char *__file, __mode_t __mode);
>  libc_hidden_proto (__chmod)
>  extern int __fchmod (int __fd, __mode_t __mode);
> @@ -13,20 +29,9 @@ libc_hidden_proto (fchmodat)
>  extern __mode_t __umask (__mode_t __mask);
>  extern int __mkdir (const char *__path, __mode_t __mode);
>  libc_hidden_proto (__mkdir)
> +
>  extern int __mknod (const char *__path,
>  		    __mode_t __mode, __dev_t __dev);
> -#if IS_IN (libc) || (IS_IN (rtld) && !defined NO_RTLD_HIDDEN)
> -hidden_proto (__fxstat)
> -hidden_proto (__fxstat64)
> -hidden_proto (__lxstat)
> -hidden_proto (__lxstat64)
> -hidden_proto (__xstat)
> -hidden_proto (__xstat64)
> -#endif
> -extern __inline__ int __stat (const char *__path, struct stat
> *__statbuf) -{
> -  return __xstat (_STAT_VER, __path, __statbuf);
> -}
>  libc_hidden_proto (__xmknod)
>  extern __inline__ int __mknod (const char *__path, __mode_t __mode,
>  			       __dev_t __dev)
> @@ -35,32 +40,47 @@ extern __inline__ int __mknod (const char
> *__path, __mode_t __mode, }
>  libc_hidden_proto (__xmknodat)
>  
> -libc_hidden_proto (__fxstatat)
> -libc_hidden_proto (__fxstatat64)
> -
> -# if IS_IN (rtld) && !defined NO_RTLD_HIDDEN
> -extern __typeof (__fxstatat64) __fxstatat64 attribute_hidden;
> +int __fxstat (int __ver, int __fildes, struct stat *__stat_buf);
> +int __xstat (int __ver, const char *__filename,
> +	     struct stat *__stat_buf);
> +int __lxstat (int __ver, const char *__filename, struct stat
> *__stat_buf); +int __fxstatat (int __ver, int __fildes, const char
> *__filename,
> +		struct stat *__stat_buf, int __flag);
> +int __fxstat64 (int ver, int __fildes, struct stat64 *__stat_buf);
> +int __xstat64 (int ver, const char *__filename, struct stat64
> *__stat_buf); +int __lxstat64 (int ver, const char *__filename,
> struct stat64 *__stat_buf); +int __fxstatat64 (int ver, int __fildes,
> const char *__filename,
> +		  struct stat64 *__stat_buf, int __flag);
> +libc_hidden_proto (__fxstat);
> +libc_hidden_proto (__xstat);
> +libc_hidden_proto (__lxstat);
> +libc_hidden_proto (__fxstatat);
> +# if IS_IN (libc) || (IS_IN (rtld) && !defined NO_RTLD_HIDDEN)
> +hidden_proto (__fxstat64);
> +hidden_proto (__xstat64);
> +hidden_proto (__lxstat64);
> +hidden_proto (__fxstatat64);
>  # endif
>  
> -/* The `stat', `fstat', `lstat' functions have to be handled special
> since
> -   even while not compiling the library with optimization calls to
> these
> -   functions in the shared library must reference the `xstat' etc
> functions.
> -   We have to use macros but we cannot define them in the normal
> headers
> -   since on user level we must use real functions.  */
> -#define stat(fname, buf) __xstat (_STAT_VER, fname, buf)
> -#define lstat(fname, buf)  __lxstat (_STAT_VER, fname, buf)
> -#define __lstat(fname, buf)  __lxstat (_STAT_VER, fname, buf)
> -#define lstat64(fname, buf)  __lxstat64 (_STAT_VER, fname, buf)
> -#define __lstat64(fname, buf)  __lxstat64 (_STAT_VER, fname, buf)
> -#define stat64(fname, buf) __xstat64 (_STAT_VER, fname, buf)
> -#define __stat64(fname, buf) __xstat64 (_STAT_VER, fname, buf)
> -#define fstat64(fd, buf) __fxstat64 (_STAT_VER, fd, buf)
> -#define __fstat64(fd, buf) __fxstat64 (_STAT_VER, fd, buf)
> -#define fstat(fd, buf) __fxstat (_STAT_VER, fd, buf)
> -#define __fstat(fd, buf) __fxstat (_STAT_VER, fd, buf)
> -#define __fstatat(dfd, fname, buf, flag) \
> -  __fxstatat (_STAT_VER, dfd, fname, buf, flag)
> -#define __fstatat64(dfd, fname, buf, flag) \
> -  __fxstatat64 (_STAT_VER, dfd, fname, buf, flag)
> +# ifdef NO_RTLD_HIDDEN
> +/* These are still required for Hurd.  */
> +#  define stat(fname, buf) __xstat (_STAT_VER, fname, buf)
> +#  define lstat(fname, buf)  __lxstat (_STAT_VER, fname, buf)
> +#  define __lstat(fname, buf)  __lxstat (_STAT_VER, fname, buf)
> +#  define lstat64(fname, buf)  __lxstat64 (_STAT_VER, fname, buf)
> +#  define __lstat64(fname, buf)  __lxstat64 (_STAT_VER, fname, buf)
> +#  define stat64(fname, buf) __xstat64 (_STAT_VER, fname, buf)
> +#  define __stat64(fname, buf) __xstat64 (_STAT_VER, fname, buf)
> +#  define fstat64(fd, buf) __fxstat64 (_STAT_VER, fd, buf)
> +#  define __fstat64(fd, buf) __fxstat64 (_STAT_VER, fd, buf)
> +#  define fstat(fd, buf) __fxstat (_STAT_VER, fd, buf)
> +#  define __fstat(fd, buf) __fxstat (_STAT_VER, fd, buf)
> +#  define __fstatat(dfd, fname, buf, flag) \
> +    __fxstatat (_STAT_VER, dfd, fname, buf, flag)
> +#  define __fstatat64(dfd, fname, buf, flag) \
> +    __fxstatat64 (_STAT_VER, dfd, fname, buf, flag)
> +# endif /* NO_RTLD_HIDDEN  */
> +
>  #endif
> +
>  #endif
> diff --git a/io/Makefile b/io/Makefile
> index cf380f3516..cee356b666 100644
> --- a/io/Makefile
> +++ b/io/Makefile
> @@ -60,8 +60,7 @@ routines :=
> 			\ # These routines will be omitted from the
> libc shared object. # Instead the static object files will be
> included in a special archive # linked against when the shared
> library will be used. -static-only-routines = stat fstat lstat stat64
> fstat64 lstat64	\
> -		       fstatat fstatat64 mknod mknodat
> +static-only-routines = mknod mknodat
>  
>  others		:= pwd
>  test-srcs	:= ftwtest
> @@ -78,6 +77,7 @@ tests		:= test-utime test-stat
> test-stat2 test-lfs tst-getcwd \ 
>  # Likewise for statx, but we do not need static linking here.
>  tests-internal += tst-statx
> +tests-static += tst-statx
>  
>  ifeq ($(run-built-tests),yes)
>  tests-special += $(objpfx)ftwtest.out
> diff --git a/io/Versions b/io/Versions
> index ee468055ff..f6db0e84ad 100644
> --- a/io/Versions
> +++ b/io/Versions
> @@ -132,6 +132,9 @@ libc {
>      fcntl64;
>      statx;
>    }
> +  GLIBC_2.33 {
> +    stat; stat64; fstat; fstat64; lstat; lstat64; fstatat; fstatat64;
> +  }
>    GLIBC_PRIVATE {
>      __libc_fcntl64;
>      __fcntl_nocancel;
> @@ -141,5 +144,6 @@ libc {
>      __file_change_detection_for_stat;
>      __file_change_detection_for_path;
>      __file_change_detection_for_fp;
> +    __fstat64;
>    }
>  }
> diff --git a/io/fstat.c b/io/fstat.c
> index 6ce077dc4a..faadd75e31 100644
> --- a/io/fstat.c
> +++ b/io/fstat.c
> @@ -1,4 +1,5 @@
> -/* Copyright (C) 1996-2020 Free Software Foundation, Inc.
> +/* Get file status.
> +   Copyright (C) 1996-2020 Free Software Foundation, Inc.
>     This file is part of the GNU C Library.
>  
>     The GNU C Library is free software; you can redistribute it and/or
> @@ -6,23 +7,6 @@
>     License as published by the Free Software Foundation; either
>     version 2.1 of the License, or (at your option) any later version.
>  
> -   In addition to the permissions in the GNU Lesser General Public
> -   License, the Free Software Foundation gives you unlimited
> -   permission to link the compiled version of this file with other
> -   programs, and to distribute those programs without any restriction
> -   coming from the use of this file. (The GNU Lesser General Public
> -   License restrictions do apply in other respects; for example, they
> -   cover modification of the file, and distribution when not linked
> -   into another program.)
> -
> -   Note that people who make modified versions of this file are not
> -   obligated to grant this special exception for their modified
> -   versions; it is their choice whether to do so. The GNU Lesser
> -   General Public License gives permission to release a modified
> -   version without this exception; this exception also makes it
> -   possible to release a modified version which carries forward this
> -   exception.
> -
>     The GNU C Library is distributed in the hope that it will be
> useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
>     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> @@ -34,22 +18,11 @@
>  
>  #include <sys/stat.h>
>  
> -/* This definition is only used if inlining fails for this function;
> see
> -   the last page of <sys/stat.h>.  The real work is done by the `x'
> -   function which is passed a version number argument.  We arrange
> in the
> -   makefile that when not inlined this function is always statically
> -   linked; that way a dynamically-linked executable always encodes
> the
> -   version number corresponding to the data structures it uses, so
> the `x'
> -   functions in the shared library can adapt without needing to
> recompile
> -   all callers.  */
> -
> -#undef fstat
>  #undef __fstat
>  int
> -attribute_hidden
>  __fstat (int fd, struct stat *buf)
>  {
>    return __fxstat (_STAT_VER, fd, buf);
>  }
>  
> -weak_hidden_alias (__fstat, fstat)
> +weak_alias (__fstat, fstat)
> diff --git a/io/fstat64.c b/io/fstat64.c
> index c4dd3acd60..b1fc17e5bf 100644
> --- a/io/fstat64.c
> +++ b/io/fstat64.c
> @@ -1,4 +1,5 @@
> -/* Copyright (C) 1996-2020 Free Software Foundation, Inc.
> +/* Get file status.
> +   Copyright (C) 1996-2020 Free Software Foundation, Inc.
>     This file is part of the GNU C Library.
>  
>     The GNU C Library is free software; you can redistribute it and/or
> @@ -6,23 +7,6 @@
>     License as published by the Free Software Foundation; either
>     version 2.1 of the License, or (at your option) any later version.
>  
> -   In addition to the permissions in the GNU Lesser General Public
> -   License, the Free Software Foundation gives you unlimited
> -   permission to link the compiled version of this file with other
> -   programs, and to distribute those programs without any restriction
> -   coming from the use of this file. (The GNU Lesser General Public
> -   License restrictions do apply in other respects; for example, they
> -   cover modification of the file, and distribution when not linked
> -   into another program.)
> -
> -   Note that people who make modified versions of this file are not
> -   obligated to grant this special exception for their modified
> -   versions; it is their choice whether to do so. The GNU Lesser
> -   General Public License gives permission to release a modified
> -   version without this exception; this exception also makes it
> -   possible to release a modified version which carries forward this
> -   exception.
> -
>     The GNU C Library is distributed in the hope that it will be
> useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
>     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> @@ -34,19 +18,11 @@
>  
>  #include <sys/stat.h>
>  
> -/* This definition is only used if inlining fails for this function;
> see
> -   the last page of <sys/stat.h>.  The real work is done by the `x'
> -   function which is passed a version number argument.  We arrange
> in the
> -   makefile that when not inlined this function is always statically
> -   linked; that way a dynamically-linked executable always encodes
> the
> -   version number corresponding to the data structures it uses, so
> the `x'
> -   functions in the shared library can adapt without needing to
> recompile
> -   all callers.  */
> -
> -#undef fstat64
> +#undef __fstat64
>  int
> -attribute_hidden
> -fstat64 (int fd, struct stat64 *buf)
> +__fstat64 (int fd, struct stat64 *buf)
>  {
>    return __fxstat64 (_STAT_VER, fd, buf);
>  }
> +hidden_def (__fstat64)
> +weak_alias (__fstat64, fstat64)
> diff --git a/io/fstatat.c b/io/fstatat.c
> index edc773487a..12443c2ff4 100644
> --- a/io/fstatat.c
> +++ b/io/fstatat.c
> @@ -1,4 +1,5 @@
> -/* Copyright (C) 2005-2020 Free Software Foundation, Inc.
> +/* Get file status.
> +   Copyright (C) 2005-2020 Free Software Foundation, Inc.
>     This file is part of the GNU C Library.
>  
>     The GNU C Library is free software; you can redistribute it and/or
> @@ -6,23 +7,6 @@
>     License as published by the Free Software Foundation; either
>     version 2.1 of the License, or (at your option) any later version.
>  
> -   In addition to the permissions in the GNU Lesser General Public
> -   License, the Free Software Foundation gives you unlimited
> -   permission to link the compiled version of this file with other
> -   programs, and to distribute those programs without any restriction
> -   coming from the use of this file. (The GNU Lesser General Public
> -   License restrictions do apply in other respects; for example, they
> -   cover modification of the file, and distribution when not linked
> -   into another program.)
> -
> -   Note that people who make modified versions of this file are not
> -   obligated to grant this special exception for their modified
> -   versions; it is their choice whether to do so. The GNU Lesser
> -   General Public License gives permission to release a modified
> -   version without this exception; this exception also makes it
> -   possible to release a modified version which carries forward this
> -   exception.
> -
>     The GNU C Library is distributed in the hope that it will be
> useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
>     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> @@ -34,19 +18,11 @@
>  
>  #include <sys/stat.h>
>  
> -/* This definition is only used if inlining fails for this function;
> see
> -   the last page of <sys/stat.h>.  The real work is done by the `x'
> -   function which is passed a version number argument.  We arrange
> in the
> -   makefile that when not inlined this function is always statically
> -   linked; that way a dynamically-linked executable always encodes
> the
> -   version number corresponding to the data structures it uses, so
> the `x'
> -   functions in the shared library can adapt without needing to
> recompile
> -   all callers.  */
> -
> -#undef fstatat
> +#undef __fstatat
>  int
> -attribute_hidden
> -fstatat (int fd, const char *file, struct stat *buf, int flag)
> +__fstatat (int fd, const char *file, struct stat *buf, int flag)
>  {
>    return __fxstatat (_STAT_VER, fd, file, buf, flag);
>  }
> +
> +weak_alias (__fstatat, fstatat)
> diff --git a/io/fstatat64.c b/io/fstatat64.c
> index b57133bd90..5ba4cdf68a 100644
> --- a/io/fstatat64.c
> +++ b/io/fstatat64.c
> @@ -1,4 +1,5 @@
> -/* Copyright (C) 2005-2020 Free Software Foundation, Inc.
> +/* Get file status.
> +   Copyright (C) 2005-2020 Free Software Foundation, Inc.
>     This file is part of the GNU C Library.
>  
>     The GNU C Library is free software; you can redistribute it and/or
> @@ -6,23 +7,6 @@
>     License as published by the Free Software Foundation; either
>     version 2.1 of the License, or (at your option) any later version.
>  
> -   In addition to the permissions in the GNU Lesser General Public
> -   License, the Free Software Foundation gives you unlimited
> -   permission to link the compiled version of this file with other
> -   programs, and to distribute those programs without any restriction
> -   coming from the use of this file. (The GNU Lesser General Public
> -   License restrictions do apply in other respects; for example, they
> -   cover modification of the file, and distribution when not linked
> -   into another program.)
> -
> -   Note that people who make modified versions of this file are not
> -   obligated to grant this special exception for their modified
> -   versions; it is their choice whether to do so. The GNU Lesser
> -   General Public License gives permission to release a modified
> -   version without this exception; this exception also makes it
> -   possible to release a modified version which carries forward this
> -   exception.
> -
>     The GNU C Library is distributed in the hope that it will be
> useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
>     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> @@ -34,19 +18,11 @@
>  
>  #include <sys/stat.h>
>  
> -/* This definition is only used if inlining fails for this function;
> see
> -   the last page of <sys/stat.h>.  The real work is done by the `x'
> -   function which is passed a version number argument.  We arrange
> in the
> -   makefile that when not inlined this function is always statically
> -   linked; that way a dynamically-linked executable always encodes
> the
> -   version number corresponding to the data structures it uses, so
> the `x'
> -   functions in the shared library can adapt without needing to
> recompile
> -   all callers.  */
> -
> -#undef fstatat64
> +#undef __fstatat64
>  int
> -attribute_hidden
> -fstatat64 (int fd, const char *file, struct stat64 *buf, int flag)
> +__fstatat64 (int fd, const char *file, struct stat64 *buf, int flag)
>  {
>    return __fxstatat64 (_STAT_VER, fd, file, buf, flag);
>  }
> +hidden_def (__fstatat64)
> +weak_alias (__fstatat64, fstatat64)
> diff --git a/io/lstat.c b/io/lstat.c
> index 7134741106..2a046c05e1 100644
> --- a/io/lstat.c
> +++ b/io/lstat.c
> @@ -1,4 +1,5 @@
> -/* Copyright (C) 1996-2020 Free Software Foundation, Inc.
> +/* Get file status.
> +   Copyright (C) 1996-2020 Free Software Foundation, Inc.
>     This file is part of the GNU C Library.
>  
>     The GNU C Library is free software; you can redistribute it and/or
> @@ -6,23 +7,6 @@
>     License as published by the Free Software Foundation; either
>     version 2.1 of the License, or (at your option) any later version.
>  
> -   In addition to the permissions in the GNU Lesser General Public
> -   License, the Free Software Foundation gives you unlimited
> -   permission to link the compiled version of this file with other
> -   programs, and to distribute those programs without any restriction
> -   coming from the use of this file. (The GNU Lesser General Public
> -   License restrictions do apply in other respects; for example, they
> -   cover modification of the file, and distribution when not linked
> -   into another program.)
> -
> -   Note that people who make modified versions of this file are not
> -   obligated to grant this special exception for their modified
> -   versions; it is their choice whether to do so. The GNU Lesser
> -   General Public License gives permission to release a modified
> -   version without this exception; this exception also makes it
> -   possible to release a modified version which carries forward this
> -   exception.
> -
>     The GNU C Library is distributed in the hope that it will be
> useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
>     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> @@ -34,22 +18,11 @@
>  
>  #include <sys/stat.h>
>  
> -/* This definition is only used if inlining fails for this function;
> see
> -   the last page of <sys/stat.h>.  The real work is done by the `x'
> -   function which is passed a version number argument.  We arrange
> in the
> -   makefile that when not inlined this function is always statically
> -   linked; that way a dynamically-linked executable always encodes
> the
> -   version number corresponding to the data structures it uses, so
> the `x'
> -   functions in the shared library can adapt without needing to
> recompile
> -   all callers.  */
> -
> -#undef lstat
>  #undef __lstat
>  int
> -attribute_hidden
>  __lstat (const char *file, struct stat *buf)
>  {
>    return __lxstat (_STAT_VER, file, buf);
>  }
>  
> -weak_hidden_alias (__lstat, lstat)
> +weak_alias (__lstat, lstat)
> diff --git a/io/lstat64.c b/io/lstat64.c
> index a890da71a8..a73c5a2541 100644
> --- a/io/lstat64.c
> +++ b/io/lstat64.c
> @@ -1,4 +1,5 @@
> -/* Copyright (C) 1996-2020 Free Software Foundation, Inc.
> +/* Get file status.
> +   Copyright (C) 1996-2020 Free Software Foundation, Inc.
>     This file is part of the GNU C Library.
>  
>     The GNU C Library is free software; you can redistribute it and/or
> @@ -6,23 +7,6 @@
>     License as published by the Free Software Foundation; either
>     version 2.1 of the License, or (at your option) any later version.
>  
> -   In addition to the permissions in the GNU Lesser General Public
> -   License, the Free Software Foundation gives you unlimited
> -   permission to link the compiled version of this file with other
> -   programs, and to distribute those programs without any restriction
> -   coming from the use of this file. (The GNU Lesser General Public
> -   License restrictions do apply in other respects; for example, they
> -   cover modification of the file, and distribution when not linked
> -   into another program.)
> -
> -   Note that people who make modified versions of this file are not
> -   obligated to grant this special exception for their modified
> -   versions; it is their choice whether to do so. The GNU Lesser
> -   General Public License gives permission to release a modified
> -   version without this exception; this exception also makes it
> -   possible to release a modified version which carries forward this
> -   exception.
> -
>     The GNU C Library is distributed in the hope that it will be
> useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
>     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> @@ -34,19 +18,11 @@
>  
>  #include <sys/stat.h>
>  
> -/* This definition is only used if inlining fails for this function;
> see
> -   the last page of <sys/stat.h>.  The real work is done by the `x'
> -   function which is passed a version number argument.  We arrange
> in the
> -   makefile that when not inlined this function is always statically
> -   linked; that way a dynamically-linked executable always encodes
> the
> -   version number corresponding to the data structures it uses, so
> the `x'
> -   functions in the shared library can adapt without needing to
> recompile
> -   all callers.  */
> -
> -#undef lstat64
> +#undef __lstat64
>  int
> -attribute_hidden
> -lstat64 (const char *file, struct stat64 *buf)
> +__lstat64 (const char *file, struct stat64 *buf)
>  {
>    return __lxstat64 (_STAT_VER, file, buf);
>  }
> +hidden_def (__lstat64)
> +weak_alias (__lstat64, lstat64)
> diff --git a/io/stat.c b/io/stat.c
> index 8c3cd877c8..b3d06107e3 100644
> --- a/io/stat.c
> +++ b/io/stat.c
> @@ -1,4 +1,5 @@
> -/* Copyright (C) 1996-2020 Free Software Foundation, Inc.
> +/* Get file status.
> +   Copyright (C) 1996-2020 Free Software Foundation, Inc.
>     This file is part of the GNU C Library.
>  
>     The GNU C Library is free software; you can redistribute it and/or
> @@ -6,23 +7,6 @@
>     License as published by the Free Software Foundation; either
>     version 2.1 of the License, or (at your option) any later version.
>  
> -   In addition to the permissions in the GNU Lesser General Public
> -   License, the Free Software Foundation gives you unlimited
> -   permission to link the compiled version of this file with other
> -   programs, and to distribute those programs without any restriction
> -   coming from the use of this file. (The GNU Lesser General Public
> -   License restrictions do apply in other respects; for example, they
> -   cover modification of the file, and distribution when not linked
> -   into another program.)
> -
> -   Note that people who make modified versions of this file are not
> -   obligated to grant this special exception for their modified
> -   versions; it is their choice whether to do so. The GNU Lesser
> -   General Public License gives permission to release a modified
> -   version without this exception; this exception also makes it
> -   possible to release a modified version which carries forward this
> -   exception.
> -
>     The GNU C Library is distributed in the hope that it will be
> useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
>     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> @@ -34,21 +18,11 @@
>  
>  #include <sys/stat.h>
>  
> -/* This definition is only used if inlining fails for this function;
> see
> -   the last page of <sys/stat.h>.  The real work is done by the `x'
> -   function which is passed a version number argument.  We arrange
> in the
> -   makefile that when not inlined this function is always statically
> -   linked; that way a dynamically-linked executable always encodes
> the
> -   version number corresponding to the data structures it uses, so
> the `x'
> -   functions in the shared library can adapt without needing to
> recompile
> -   all callers.  */
> -
> -#undef stat
> +#undef __stat
>  int
> -attribute_hidden
>  __stat (const char *file, struct stat *buf)
>  {
>    return __xstat (_STAT_VER, file, buf);
>  }
>  
> -weak_hidden_alias (__stat, stat)
> +weak_alias (__stat, stat)
> diff --git a/io/stat64.c b/io/stat64.c
> index 8b6b662f3a..41e8905c4e 100644
> --- a/io/stat64.c
> +++ b/io/stat64.c
> @@ -1,4 +1,5 @@
> -/* Copyright (C) 1996-2020 Free Software Foundation, Inc.
> +/* Get file status.
> +   Copyright (C) 1996-2020 Free Software Foundation, Inc.
>     This file is part of the GNU C Library.
>  
>     The GNU C Library is free software; you can redistribute it and/or
> @@ -6,23 +7,6 @@
>     License as published by the Free Software Foundation; either
>     version 2.1 of the License, or (at your option) any later version.
>  
> -   In addition to the permissions in the GNU Lesser General Public
> -   License, the Free Software Foundation gives you unlimited
> -   permission to link the compiled version of this file with other
> -   programs, and to distribute those programs without any restriction
> -   coming from the use of this file. (The GNU Lesser General Public
> -   License restrictions do apply in other respects; for example, they
> -   cover modification of the file, and distribution when not linked
> -   into another program.)
> -
> -   Note that people who make modified versions of this file are not
> -   obligated to grant this special exception for their modified
> -   versions; it is their choice whether to do so. The GNU Lesser
> -   General Public License gives permission to release a modified
> -   version without this exception; this exception also makes it
> -   possible to release a modified version which carries forward this
> -   exception.
> -
>     The GNU C Library is distributed in the hope that it will be
> useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
>     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> @@ -34,19 +18,11 @@
>  
>  #include <sys/stat.h>
>  
> -/* This definition is only used if inlining fails for this function;
> see
> -   the last page of <sys/stat.h>.  The real work is done by the `x'
> -   function which is passed a version number argument.  We arrange
> in the
> -   makefile that when not inlined this function is always statically
> -   linked; that way a dynamically-linked executable always encodes
> the
> -   version number corresponding to the data structures it uses, so
> the `x'
> -   functions in the shared library can adapt without needing to
> recompile
> -   all callers.  */
> -
> -#undef stat64
> +#undef __stat64
>  int
> -attribute_hidden
> -stat64 (const char *file, struct stat64 *buf)
> +__stat64 (const char *file, struct stat64 *buf)
>  {
>    return __xstat64 (_STAT_VER, file, buf);
>  }
> +hidden_def (__stat64)
> +weak_alias (__stat64, stat64)
> diff --git a/io/sys/stat.h b/io/sys/stat.h
> index ce014d03a5..83cf253c72 100644
> --- a/io/sys/stat.h
> +++ b/io/sys/stat.h
> @@ -368,73 +368,10 @@ extern int utimensat (int __fd, const char
> *__path, extern int futimens (int __fd, const struct timespec
> __times[2]) __THROW; #endif
>  
> -/* To allow the `struct stat' structure and the file type `mode_t'
> -   bits to vary without changing shared library major version number,
> -   the `stat' family of functions and `mknod' are in fact inline
> -   wrappers around calls to `xstat', `fxstat', `lxstat', and
> `xmknod',
> -   which all take a leading version-number argument designating the
> -   data structure and bits used.  <bits/stat.h> defines _STAT_VER
> with
> -   the version number corresponding to `struct stat' as defined in
> -   that file; and _MKNOD_VER with the version number corresponding to
> -   the S_IF* macros defined therein.  It is arranged that when not
> -   inlined these function are always statically linked; that way a
> -   dynamically-linked executable always encodes the version number
> -   corresponding to the data structures it uses, so the `x' functions
> -   in the shared library can adapt without needing to recompile all
> -   callers.  */
> -
> -#ifndef _STAT_VER
> -# define _STAT_VER	0
> -#endif
>  #ifndef _MKNOD_VER
>  # define _MKNOD_VER	0
>  #endif
>  
> -/* Wrappers for stat and mknod system calls.  */
> -#ifndef __USE_FILE_OFFSET64
> -extern int __fxstat (int __ver, int __fildes, struct stat
> *__stat_buf)
> -     __THROW __nonnull ((3));
> -extern int __xstat (int __ver, const char *__filename,
> -		    struct stat *__stat_buf) __THROW __nonnull ((2,
> 3)); -extern int __lxstat (int __ver, const char *__filename,
> -		     struct stat *__stat_buf) __THROW __nonnull ((2,
> 3)); -extern int __fxstatat (int __ver, int __fildes, const char
> *__filename,
> -		       struct stat *__stat_buf, int __flag)
> -     __THROW __nonnull ((3, 4));
> -#else
> -# ifdef __REDIRECT_NTH
> -extern int __REDIRECT_NTH (__fxstat, (int __ver, int __fildes,
> -				      struct stat *__stat_buf),
> __fxstat64)
> -     __nonnull ((3));
> -extern int __REDIRECT_NTH (__xstat, (int __ver, const char
> *__filename,
> -				     struct stat *__stat_buf),
> __xstat64)
> -     __nonnull ((2, 3));
> -extern int __REDIRECT_NTH (__lxstat, (int __ver, const char
> *__filename,
> -				      struct stat *__stat_buf),
> __lxstat64)
> -     __nonnull ((2, 3));
> -extern int __REDIRECT_NTH (__fxstatat, (int __ver, int __fildes,
> -					const char *__filename,
> -					struct stat *__stat_buf, int
> __flag),
> -			   __fxstatat64) __nonnull ((3, 4));
> -
> -# else
> -#  define __fxstat __fxstat64
> -#  define __xstat __xstat64
> -#  define __lxstat __lxstat64
> -# endif
> -#endif
> -
> -#ifdef __USE_LARGEFILE64
> -extern int __fxstat64 (int __ver, int __fildes, struct stat64
> *__stat_buf)
> -     __THROW __nonnull ((3));
> -extern int __xstat64 (int __ver, const char *__filename,
> -		      struct stat64 *__stat_buf) __THROW __nonnull
> ((2, 3)); -extern int __lxstat64 (int __ver, const char *__filename,
> -		       struct stat64 *__stat_buf) __THROW __nonnull
> ((2, 3)); -extern int __fxstatat64 (int __ver, int __fildes, const
> char *__filename,
> -			 struct stat64 *__stat_buf, int __flag)
> -     __THROW __nonnull ((3, 4));
> -#endif
>  extern int __xmknod (int __ver, const char *__path, __mode_t __mode,
>  		     __dev_t *__dev) __THROW __nonnull ((2, 4));
>  
> @@ -447,37 +384,6 @@ extern int __xmknodat (int __ver, int __fd,
> const char *__path, #endif
>  
>  #ifdef __USE_EXTERN_INLINES
> -/* Inlined versions of the real stat and mknod functions.  */
> -
> -__extern_inline int
> -__NTH (stat (const char *__path, struct stat *__statbuf))
> -{
> -  return __xstat (_STAT_VER, __path, __statbuf);
> -}
> -
> -# if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
> -__extern_inline int
> -__NTH (lstat (const char *__path, struct stat *__statbuf))
> -{
> -  return __lxstat (_STAT_VER, __path, __statbuf);
> -}
> -# endif
> -
> -__extern_inline int
> -__NTH (fstat (int __fd, struct stat *__statbuf))
> -{
> -  return __fxstat (_STAT_VER, __fd, __statbuf);
> -}
> -
> -# ifdef __USE_ATFILE
> -__extern_inline int
> -__NTH (fstatat (int __fd, const char *__filename, struct stat
> *__statbuf,
> -		int __flag))
> -{
> -  return __fxstatat (_STAT_VER, __fd, __filename, __statbuf, __flag);
> -}
> -# endif
> -
>  # ifdef __USE_MISC
>  __extern_inline int
>  __NTH (mknod (const char *__path, __mode_t __mode, __dev_t __dev))
> @@ -494,41 +400,6 @@ __NTH (mknodat (int __fd, const char *__path,
> __mode_t __mode, return __xmknodat (_MKNOD_VER, __fd, __path, __mode,
> &__dev); }
>  # endif
> -
> -# if defined __USE_LARGEFILE64 \
> -  && (! defined __USE_FILE_OFFSET64 \
> -      || (defined __REDIRECT_NTH && defined __OPTIMIZE__))
> -__extern_inline int
> -__NTH (stat64 (const char *__path, struct stat64 *__statbuf))
> -{
> -  return __xstat64 (_STAT_VER, __path, __statbuf);
> -}
> -
> -#  if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
> -__extern_inline int
> -__NTH (lstat64 (const char *__path, struct stat64 *__statbuf))
> -{
> -  return __lxstat64 (_STAT_VER, __path, __statbuf);
> -}
> -#  endif
> -
> -__extern_inline int
> -__NTH (fstat64 (int __fd, struct stat64 *__statbuf))
> -{
> -  return __fxstat64 (_STAT_VER, __fd, __statbuf);
> -}
> -
> -#  ifdef __USE_ATFILE
> -__extern_inline int
> -__NTH (fstatat64 (int __fd, const char *__filename, struct stat64
> *__statbuf,
> -		  int __flag))
> -{
> -  return __fxstatat64 (_STAT_VER, __fd, __filename, __statbuf,
> __flag); -}
> -#  endif
> -
> -# endif
> -
>  #endif
>  
>  __END_DECLS
> diff --git a/nscd/gai.c b/nscd/gai.c
> index 2e19530102..b0058bc873 100644
> --- a/nscd/gai.c
> +++ b/nscd/gai.c
> @@ -16,6 +16,7 @@
>     along with this program; if not, see
> <https://www.gnu.org/licenses/>.  */ 
>  #include <alloca.h>
> +#include <sys/stat.h>
>  
>  /* This file uses the getaddrinfo code but it compiles it without
> NSCD support.  We just need a few symbol renames.  */
> @@ -32,6 +33,10 @@
>  #define __libc_use_alloca(size) (size <= __MAX_ALLOCA_CUTOFF)
>  #define __getifaddrs getifaddrs
>  #define __freeifaddrs freeifaddrs
> +#undef __fstat64
> +#define __fstat64 fstat64
> +#undef __stat64
> +#define __stat64 stat64
>  
>  /* We are nscd, so we don't want to be talking to ourselves.  */
>  #undef  USE_NSCD
> diff --git a/sysdeps/generic/xstatver.h b/sysdeps/generic/xstatver.h
> new file mode 100644
> index 0000000000..d727c98a16
> --- /dev/null
> +++ b/sysdeps/generic/xstatver.h
> @@ -0,0 +1,3 @@
> +/* Versions of the 'struct stat' data structure used in
> compatibility xstat
> +   functions.  */
> +#define _STAT_VER 0
> diff --git a/sysdeps/mach/hurd/i386/libc.abilist
> b/sysdeps/mach/hurd/i386/libc.abilist index 5f6154d518..74a4ed5c1d
> 100644 --- a/sysdeps/mach/hurd/i386/libc.abilist
> +++ b/sysdeps/mach/hurd/i386/libc.abilist
> @@ -2192,6 +2192,14 @@ GLIBC_2.32 thrd_current F
>  GLIBC_2.32 thrd_equal F
>  GLIBC_2.32 thrd_sleep F
>  GLIBC_2.32 thrd_yield F
> +GLIBC_2.33 fstat F
> +GLIBC_2.33 fstat64 F
> +GLIBC_2.33 fstatat F
> +GLIBC_2.33 fstatat64 F
> +GLIBC_2.33 lstat F
> +GLIBC_2.33 lstat64 F
> +GLIBC_2.33 stat F
> +GLIBC_2.33 stat64 F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
> index 82c898fe35..ad4923ddbc 100644
> --- a/sysdeps/posix/getaddrinfo.c
> +++ b/sysdeps/posix/getaddrinfo.c
> @@ -2138,7 +2138,7 @@ static void
>  gaiconf_reload (void)
>  {
>    struct stat64 st;
> -  if (stat64 (GAICONF_FNAME, &st) != 0
> +  if (__stat64 (GAICONF_FNAME, &st) != 0
>        || !check_gaiconf_mtime (&st))
>      gaiconf_init ();
>  }
> diff --git a/sysdeps/unix/sysv/linux/aarch64/libc.abilist
> b/sysdeps/unix/sysv/linux/aarch64/libc.abilist index
> 6cd61988b4..03e4ae9296 100644 ---
> a/sysdeps/unix/sysv/linux/aarch64/libc.abilist +++
> b/sysdeps/unix/sysv/linux/aarch64/libc.abilist @@ -2160,3 +2160,11 @@
> GLIBC_2.32 sigabbrev_np F GLIBC_2.32 sigdescr_np F
>  GLIBC_2.32 strerrordesc_np F
>  GLIBC_2.32 strerrorname_np F
> +GLIBC_2.33 fstat F
> +GLIBC_2.33 fstat64 F
> +GLIBC_2.33 fstatat F
> +GLIBC_2.33 fstatat64 F
> +GLIBC_2.33 lstat F
> +GLIBC_2.33 lstat64 F
> +GLIBC_2.33 stat F
> +GLIBC_2.33 stat64 F
> diff --git a/sysdeps/unix/sysv/linux/alpha/bits/stat.h
> b/sysdeps/unix/sysv/linux/alpha/bits/stat.h index
> 0064ca09ff..1fc27936b9 100644 ---
> a/sysdeps/unix/sysv/linux/alpha/bits/stat.h +++
> b/sysdeps/unix/sysv/linux/alpha/bits/stat.h @@ -22,15 +22,6 @@
>  #ifndef _BITS_STAT_H
>  #define _BITS_STAT_H	1
>  
> -/* Versions of the `struct stat' data structure.  */
> -#define _STAT_VER_KERNEL	0
> -#define _STAT_VER_GLIBC2	1
> -#define _STAT_VER_GLIBC2_1	2
> -#define _STAT_VER_KERNEL64	3
> -#define _STAT_VER_GLIBC2_3_4	3
> -#define _STAT_VER_LINUX		3
> -#define _STAT_VER		_STAT_VER_LINUX
> -
>  /* Versions of the `xmknod' interface.  */
>  #define _MKNOD_VER_LINUX	0
>  
> diff --git a/sysdeps/unix/sysv/linux/alpha/libc.abilist
> b/sysdeps/unix/sysv/linux/alpha/libc.abilist index
> 8edb5deea1..5b752ef4a8 100644 ---
> a/sysdeps/unix/sysv/linux/alpha/libc.abilist +++
> b/sysdeps/unix/sysv/linux/alpha/libc.abilist @@ -2242,6 +2242,14 @@
> GLIBC_2.32 sigabbrev_np F GLIBC_2.32 sigdescr_np F
>  GLIBC_2.32 strerrordesc_np F
>  GLIBC_2.32 strerrorname_np F
> +GLIBC_2.33 fstat F
> +GLIBC_2.33 fstat64 F
> +GLIBC_2.33 fstatat F
> +GLIBC_2.33 fstatat64 F
> +GLIBC_2.33 lstat F
> +GLIBC_2.33 lstat64 F
> +GLIBC_2.33 stat F
> +GLIBC_2.33 stat64 F
>  GLIBC_2.4 _IO_fprintf F
>  GLIBC_2.4 _IO_printf F
>  GLIBC_2.4 _IO_sprintf F
> diff --git a/sysdeps/unix/sysv/linux/alpha/xstatver.h
> b/sysdeps/unix/sysv/linux/alpha/xstatver.h new file mode 100644
> index 0000000000..bbb9469617
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/alpha/xstatver.h
> @@ -0,0 +1,9 @@
> +/* Versions of the 'struct stat' data structure used in
> compatibility xstat
> +   functions.  */
> +#define _STAT_VER_KERNEL	0
> +#define _STAT_VER_GLIBC2	1
> +#define _STAT_VER_GLIBC2_1	2
> +#define _STAT_VER_KERNEL64	3
> +#define _STAT_VER_GLIBC2_3_4	3
> +#define _STAT_VER_LINUX		3
> +#define _STAT_VER		_STAT_VER_LINUX
> diff --git a/sysdeps/unix/sysv/linux/arc/libc.abilist
> b/sysdeps/unix/sysv/linux/arc/libc.abilist index
> df13f49e15..925b532383 100644 ---
> a/sysdeps/unix/sysv/linux/arc/libc.abilist +++
> b/sysdeps/unix/sysv/linux/arc/libc.abilist @@ -1920,3 +1920,11 @@
> GLIBC_2.32 wprintf F GLIBC_2.32 write F
>  GLIBC_2.32 writev F
>  GLIBC_2.32 wscanf F
> +GLIBC_2.33 fstat F
> +GLIBC_2.33 fstat64 F
> +GLIBC_2.33 fstatat F
> +GLIBC_2.33 fstatat64 F
> +GLIBC_2.33 lstat F
> +GLIBC_2.33 lstat64 F
> +GLIBC_2.33 stat F
> +GLIBC_2.33 stat64 F
> diff --git a/sysdeps/unix/sysv/linux/arm/le/libc.abilist
> b/sysdeps/unix/sysv/linux/arm/le/libc.abilist index
> a83cc81958..a4c1a7c03c 100644 ---
> a/sysdeps/unix/sysv/linux/arm/le/libc.abilist +++
> b/sysdeps/unix/sysv/linux/arm/le/libc.abilist @@ -141,6 +141,14 @@
> GLIBC_2.32 sigabbrev_np F GLIBC_2.32 sigdescr_np F
>  GLIBC_2.32 strerrordesc_np F
>  GLIBC_2.32 strerrorname_np F
> +GLIBC_2.33 fstat F
> +GLIBC_2.33 fstat64 F
> +GLIBC_2.33 fstatat F
> +GLIBC_2.33 fstatat64 F
> +GLIBC_2.33 lstat F
> +GLIBC_2.33 lstat64 F
> +GLIBC_2.33 stat F
> +GLIBC_2.33 stat64 F
>  GLIBC_2.4 _Exit F
>  GLIBC_2.4 _IO_2_1_stderr_ D 0xa0
>  GLIBC_2.4 _IO_2_1_stdin_ D 0xa0
> diff --git a/sysdeps/unix/sysv/linux/bits/stat.h
> b/sysdeps/unix/sysv/linux/bits/stat.h index 240628a6f4..b542623208
> 100644 --- a/sysdeps/unix/sysv/linux/bits/stat.h
> +++ b/sysdeps/unix/sysv/linux/bits/stat.h
> @@ -23,12 +23,6 @@
>  #define _BITS_STAT_H	1
>  
>  /* Versions of the `struct stat' data structure.  */
> -#define _STAT_VER_LINUX_OLD	1
> -#define _STAT_VER_KERNEL	1
> -#define _STAT_VER_SVR4		2
> -#define _STAT_VER_LINUX		3
> -#define _STAT_VER		_STAT_VER_LINUX	/* The one
> defined below.  */ -
>  /* Versions of the `xmknod' interface.  */
>  #define _MKNOD_VER_LINUX	1
>  #define _MKNOD_VER_SVR4		2
> diff --git a/sysdeps/unix/sysv/linux/csky/libc.abilist
> b/sysdeps/unix/sysv/linux/csky/libc.abilist index
> 32887b1c58..799873e189 100644 ---
> a/sysdeps/unix/sysv/linux/csky/libc.abilist +++
> b/sysdeps/unix/sysv/linux/csky/libc.abilist @@ -2104,3 +2104,11 @@
> GLIBC_2.32 sigabbrev_np F GLIBC_2.32 sigdescr_np F
>  GLIBC_2.32 strerrordesc_np F
>  GLIBC_2.32 strerrorname_np F
> +GLIBC_2.33 fstat F
> +GLIBC_2.33 fstat64 F
> +GLIBC_2.33 fstatat F
> +GLIBC_2.33 fstatat64 F
> +GLIBC_2.33 lstat F
> +GLIBC_2.33 lstat64 F
> +GLIBC_2.33 stat F
> +GLIBC_2.33 stat64 F
> diff --git a/sysdeps/unix/sysv/linux/generic/bits/stat.h
> b/sysdeps/unix/sysv/linux/generic/bits/stat.h index
> 8d0980f0f5..35e14a47c6 100644 ---
> a/sysdeps/unix/sysv/linux/generic/bits/stat.h +++
> b/sysdeps/unix/sysv/linux/generic/bits/stat.h @@ -26,17 +26,6 @@
>  #include <bits/endian.h>
>  #include <bits/wordsize.h>
>  
> -/* 64-bit libc uses the kernel's 'struct stat', accessed via the
> -   stat() syscall; 32-bit libc uses the kernel's 'struct stat64'
> -   and accesses it via the stat64() syscall.  All the various
> -   APIs offered by libc use the kernel shape for their struct stat
> -   structure; the only difference is that 32-bit programs not
> -   using __USE_FILE_OFFSET64 only see the low 32 bits of some
> -   of the fields (specifically st_ino, st_size, and st_blocks).  */
> -#define _STAT_VER_KERNEL	0
> -#define _STAT_VER_LINUX		0
> -#define _STAT_VER		_STAT_VER_KERNEL
> -
>  /* Versions of the `xmknod' interface.  */
>  #define _MKNOD_VER_LINUX	0
>  
> diff --git a/sysdeps/unix/sysv/linux/generic/xstatver.h
> b/sysdeps/unix/sysv/linux/generic/xstatver.h new file mode 100644
> index 0000000000..8675db494c
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/generic/xstatver.h
> @@ -0,0 +1,5 @@
> +/* Versions of the 'struct stat' data structure used in
> compatibility xstat
> +   functions.  */
> +#define _STAT_VER_KERNEL	0
> +#define _STAT_VER_LINUX		0
> +#define _STAT_VER		_STAT_VER_KERNEL
> diff --git a/sysdeps/unix/sysv/linux/hppa/libc.abilist
> b/sysdeps/unix/sysv/linux/hppa/libc.abilist index
> baf425072b..95c7bf4f06 100644 ---
> a/sysdeps/unix/sysv/linux/hppa/libc.abilist +++
> b/sysdeps/unix/sysv/linux/hppa/libc.abilist @@ -2063,6 +2063,14 @@
> GLIBC_2.32 sigabbrev_np F GLIBC_2.32 sigdescr_np F
>  GLIBC_2.32 strerrordesc_np F
>  GLIBC_2.32 strerrorname_np F
> +GLIBC_2.33 fstat F
> +GLIBC_2.33 fstat64 F
> +GLIBC_2.33 fstatat F
> +GLIBC_2.33 fstatat64 F
> +GLIBC_2.33 lstat F
> +GLIBC_2.33 lstat64 F
> +GLIBC_2.33 stat F
> +GLIBC_2.33 stat64 F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/i386/libc.abilist
> b/sysdeps/unix/sysv/linux/i386/libc.abilist index
> 8b0242a9b1..e7cf5cdb98 100644 ---
> a/sysdeps/unix/sysv/linux/i386/libc.abilist +++
> b/sysdeps/unix/sysv/linux/i386/libc.abilist @@ -2229,6 +2229,14 @@
> GLIBC_2.32 sigabbrev_np F GLIBC_2.32 sigdescr_np F
>  GLIBC_2.32 strerrordesc_np F
>  GLIBC_2.32 strerrorname_np F
> +GLIBC_2.33 fstat F
> +GLIBC_2.33 fstat64 F
> +GLIBC_2.33 fstatat F
> +GLIBC_2.33 fstatat64 F
> +GLIBC_2.33 lstat F
> +GLIBC_2.33 lstat64 F
> +GLIBC_2.33 stat F
> +GLIBC_2.33 stat64 F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/ia64/bits/stat.h
> b/sysdeps/unix/sysv/linux/ia64/bits/stat.h index
> 608e988ae6..8ec2e4c81f 100644 ---
> a/sysdeps/unix/sysv/linux/ia64/bits/stat.h +++
> b/sysdeps/unix/sysv/linux/ia64/bits/stat.h @@ -22,11 +22,6 @@
>  #ifndef _BITS_STAT_H
>  #define _BITS_STAT_H	1
>  
> -/* Versions of the `struct stat' data structure.  */
> -#define _STAT_VER_KERNEL	0
> -#define _STAT_VER_LINUX		1
> -#define _STAT_VER		_STAT_VER_LINUX
> -
>  /* Versions of the `xmknod' interface.  */
>  #define _MKNOD_VER_LINUX	0
>  
> diff --git a/sysdeps/unix/sysv/linux/ia64/libc.abilist
> b/sysdeps/unix/sysv/linux/ia64/libc.abilist index
> b6ba86dbe9..beeb905efd 100644 ---
> a/sysdeps/unix/sysv/linux/ia64/libc.abilist +++
> b/sysdeps/unix/sysv/linux/ia64/libc.abilist @@ -2095,6 +2095,14 @@
> GLIBC_2.32 sigabbrev_np F GLIBC_2.32 sigdescr_np F
>  GLIBC_2.32 strerrordesc_np F
>  GLIBC_2.32 strerrorname_np F
> +GLIBC_2.33 fstat F
> +GLIBC_2.33 fstat64 F
> +GLIBC_2.33 fstatat F
> +GLIBC_2.33 fstatat64 F
> +GLIBC_2.33 lstat F
> +GLIBC_2.33 lstat64 F
> +GLIBC_2.33 stat F
> +GLIBC_2.33 stat64 F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/ia64/xstatver.h
> b/sysdeps/unix/sysv/linux/ia64/xstatver.h new file mode 100644
> index 0000000000..4f02f697ad
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/ia64/xstatver.h
> @@ -0,0 +1,5 @@
> +/* Versions of the 'struct stat' data structure used in
> compatibility xstat
> +   functions.  */
> +#define _STAT_VER_KERNEL	0
> +#define _STAT_VER_LINUX		1
> +#define _STAT_VER		_STAT_VER_LINUX
> diff --git a/sysdeps/unix/sysv/linux/m68k/bits/stat.h
> b/sysdeps/unix/sysv/linux/m68k/bits/stat.h index
> 453dcac709..bf41776e6c 100644 ---
> a/sysdeps/unix/sysv/linux/m68k/bits/stat.h +++
> b/sysdeps/unix/sysv/linux/m68k/bits/stat.h @@ -22,13 +22,6 @@
>  #ifndef _BITS_STAT_H
>  #define _BITS_STAT_H	1
>  
> -/* Versions of the `struct stat' data structure.  */
> -#define _STAT_VER_LINUX_OLD	1
> -#define _STAT_VER_KERNEL	1
> -#define _STAT_VER_SVR4		2
> -#define _STAT_VER_LINUX		3
> -#define _STAT_VER		_STAT_VER_LINUX	/* The one
> defined below.  */ -
>  /* Versions of the `xmknod' interface.  */
>  #define _MKNOD_VER_LINUX	1
>  #define _MKNOD_VER_SVR4		2
> diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
> b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist index
> 2d726097ca..ed34e1fc82 100644 ---
> a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist +++
> b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist @@ -2175,6
> +2175,14 @@ GLIBC_2.32 sigabbrev_np F GLIBC_2.32 sigdescr_np F
>  GLIBC_2.32 strerrordesc_np F
>  GLIBC_2.32 strerrorname_np F
> +GLIBC_2.33 fstat F
> +GLIBC_2.33 fstat64 F
> +GLIBC_2.33 fstatat F
> +GLIBC_2.33 fstatat64 F
> +GLIBC_2.33 lstat F
> +GLIBC_2.33 lstat64 F
> +GLIBC_2.33 stat F
> +GLIBC_2.33 stat64 F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/m68k/xstatver.h
> b/sysdeps/unix/sysv/linux/m68k/xstatver.h new file mode 100644
> index 0000000000..59dba71dd1
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/m68k/xstatver.h
> @@ -0,0 +1,7 @@
> +/* Versions of the 'struct stat' data structure used in
> compatibility xstat
> +   functions.  */
> +#define _STAT_VER_LINUX_OLD	1
> +#define _STAT_VER_KERNEL	1
> +#define _STAT_VER_SVR4		2
> +#define _STAT_VER_LINUX		3
> +#define _STAT_VER		_STAT_VER_LINUX
> diff --git a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
> b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist index
> 7c78649e03..e00f5115b2 100644 ---
> a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist +++
> b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist @@ -2155,3
> +2155,11 @@ GLIBC_2.32 sigabbrev_np F GLIBC_2.32 sigdescr_np F
>  GLIBC_2.32 strerrordesc_np F
>  GLIBC_2.32 strerrorname_np F
> +GLIBC_2.33 fstat F
> +GLIBC_2.33 fstat64 F
> +GLIBC_2.33 fstatat F
> +GLIBC_2.33 fstatat64 F
> +GLIBC_2.33 lstat F
> +GLIBC_2.33 lstat64 F
> +GLIBC_2.33 stat F
> +GLIBC_2.33 stat64 F
> diff --git a/sysdeps/unix/sysv/linux/microblaze/bits/stat.h
> b/sysdeps/unix/sysv/linux/microblaze/bits/stat.h index
> c5817e5b77..51316a8c1b 100644 ---
> a/sysdeps/unix/sysv/linux/microblaze/bits/stat.h +++
> b/sysdeps/unix/sysv/linux/microblaze/bits/stat.h @@ -23,13 +23,6 @@
>  #ifndef _BITS_STAT_H
>  #define _BITS_STAT_H	1
>  
> -/* Versions of the `struct stat' data structure.  */
> -#define _STAT_VER_LINUX_OLD    1
> -#define _STAT_VER_KERNEL       1
> -#define _STAT_VER_SVR4         2
> -#define _STAT_VER_LINUX        3
> -#define _STAT_VER              _STAT_VER_LINUX  /* The one defined
> below.  */ -
>  /* Versions of the `xmknod' interface.  */
>  #define _MKNOD_VER_LINUX       1
>  #define _MKNOD_VER_SVR4        2
> diff --git a/sysdeps/unix/sysv/linux/microblaze/xstatver.h
> b/sysdeps/unix/sysv/linux/microblaze/xstatver.h new file mode 100644
> index 0000000000..bddaa0d5ec
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/microblaze/xstatver.h
> @@ -0,0 +1,7 @@
> +/* Versions of the 'struct stat' data structure used in
> compatibility xstat
> +   functions.  */
> +#define _STAT_VER_LINUX_OLD    1
> +#define _STAT_VER_KERNEL       1
> +#define _STAT_VER_SVR4         2
> +#define _STAT_VER_LINUX        3
> +#define _STAT_VER              _STAT_VER_LINUX  /* The one defined
> below.  */ diff --git a/sysdeps/unix/sysv/linux/mips/bits/stat.h
> b/sysdeps/unix/sysv/linux/mips/bits/stat.h index
> b0e6726655..cfeb4ce6a4 100644 ---
> a/sysdeps/unix/sysv/linux/mips/bits/stat.h +++
> b/sysdeps/unix/sysv/linux/mips/bits/stat.h @@ -24,13 +24,6 @@
>  
>  #include <sgidefs.h>
>  
> -/* Versions of the `struct stat' data structure.  */
> -#define _STAT_VER_LINUX_OLD	1
> -#define _STAT_VER_KERNEL	1
> -#define _STAT_VER_SVR4		2
> -#define _STAT_VER_LINUX		3
> -#define _STAT_VER		_STAT_VER_LINUX /* The one defined
> below.  */ -
>  /* Versions of the `xmknod' interface.  */
>  #define _MKNOD_VER_LINUX	1
>  #define _MKNOD_VER_SVR4		2
> diff --git a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
> b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist index
> 9fa655b3a5..fe9ba4e982 100644 ---
> a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist +++
> b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist @@ -2146,6
> +2146,14 @@ GLIBC_2.32 sigabbrev_np F GLIBC_2.32 sigdescr_np F
>  GLIBC_2.32 strerrordesc_np F
>  GLIBC_2.32 strerrorname_np F
> +GLIBC_2.33 fstat F
> +GLIBC_2.33 fstat64 F
> +GLIBC_2.33 fstatat F
> +GLIBC_2.33 fstatat64 F
> +GLIBC_2.33 lstat F
> +GLIBC_2.33 lstat64 F
> +GLIBC_2.33 stat F
> +GLIBC_2.33 stat64 F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
> b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist index
> de990933cf..e67591e710 100644 ---
> a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist +++
> b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist @@ -2152,6
> +2152,14 @@ GLIBC_2.32 sigabbrev_np F GLIBC_2.32 sigdescr_np F
>  GLIBC_2.32 strerrordesc_np F
>  GLIBC_2.32 strerrorname_np F
> +GLIBC_2.33 fstat F
> +GLIBC_2.33 fstat64 F
> +GLIBC_2.33 fstatat F
> +GLIBC_2.33 fstatat64 F
> +GLIBC_2.33 lstat F
> +GLIBC_2.33 lstat64 F
> +GLIBC_2.33 stat F
> +GLIBC_2.33 stat64 F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
> b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist index
> 754491f209..e4eb9e6bbf 100644 ---
> a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist +++
> b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist @@ -2146,6
> +2146,14 @@ GLIBC_2.32 sigabbrev_np F GLIBC_2.32 sigdescr_np F
>  GLIBC_2.32 strerrordesc_np F
>  GLIBC_2.32 strerrorname_np F
> +GLIBC_2.33 fstat F
> +GLIBC_2.33 fstat64 F
> +GLIBC_2.33 fstatat F
> +GLIBC_2.33 fstatat64 F
> +GLIBC_2.33 lstat F
> +GLIBC_2.33 lstat64 F
> +GLIBC_2.33 stat F
> +GLIBC_2.33 stat64 F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/mips/xstatver.h
> b/sysdeps/unix/sysv/linux/mips/xstatver.h new file mode 100644
> index 0000000000..59dba71dd1
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/mips/xstatver.h
> @@ -0,0 +1,7 @@
> +/* Versions of the 'struct stat' data structure used in
> compatibility xstat
> +   functions.  */
> +#define _STAT_VER_LINUX_OLD	1
> +#define _STAT_VER_KERNEL	1
> +#define _STAT_VER_SVR4		2
> +#define _STAT_VER_LINUX		3
> +#define _STAT_VER		_STAT_VER_LINUX
> diff --git a/sysdeps/unix/sysv/linux/nios2/libc.abilist
> b/sysdeps/unix/sysv/linux/nios2/libc.abilist index
> 36a875115c..0878998441 100644 ---
> a/sysdeps/unix/sysv/linux/nios2/libc.abilist +++
> b/sysdeps/unix/sysv/linux/nios2/libc.abilist @@ -2193,3 +2193,11 @@
> GLIBC_2.32 sigabbrev_np F GLIBC_2.32 sigdescr_np F
>  GLIBC_2.32 strerrordesc_np F
>  GLIBC_2.32 strerrorname_np F
> +GLIBC_2.33 fstat F
> +GLIBC_2.33 fstat64 F
> +GLIBC_2.33 fstatat F
> +GLIBC_2.33 fstatat64 F
> +GLIBC_2.33 lstat F
> +GLIBC_2.33 lstat64 F
> +GLIBC_2.33 stat F
> +GLIBC_2.33 stat64 F
> diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/stat.h
> b/sysdeps/unix/sysv/linux/powerpc/bits/stat.h index
> 61781bd902..40ea9a96d4 100644 ---
> a/sysdeps/unix/sysv/linux/powerpc/bits/stat.h +++
> b/sysdeps/unix/sysv/linux/powerpc/bits/stat.h @@ -24,17 +24,6 @@
>  
>  #include <bits/wordsize.h>
>  
> -/* Versions of the `struct stat' data structure.  */
> -#define _STAT_VER_LINUX_OLD	1
> -#define _STAT_VER_KERNEL	1
> -#define _STAT_VER_SVR4		2
> -#define _STAT_VER_LINUX	  3
> -#if __WORDSIZE == 32
> -# define _STAT_VER		_STAT_VER_LINUX
> -#else
> -# define _STAT_VER		_STAT_VER_KERNEL
> -#endif
> -
>  /* Versions of the `xmknod' interface.  */
>  #define _MKNOD_VER_LINUX	1
>  #define _MKNOD_VER_SVR4		2
> diff --git
> a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
> b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist index
> 6de9bed51d..993c957e8e 100644 ---
> a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist +++
> b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist @@
> -2202,6 +2202,14 @@ GLIBC_2.32 sigabbrev_np F GLIBC_2.32 sigdescr_np
> F GLIBC_2.32 strerrordesc_np F GLIBC_2.32 strerrorname_np F
> +GLIBC_2.33 fstat F
> +GLIBC_2.33 fstat64 F
> +GLIBC_2.33 fstatat F
> +GLIBC_2.33 fstatat64 F
> +GLIBC_2.33 lstat F
> +GLIBC_2.33 lstat64 F
> +GLIBC_2.33 stat F
> +GLIBC_2.33 stat64 F
>  GLIBC_2.4 _IO_fprintf F
>  GLIBC_2.4 _IO_printf F
>  GLIBC_2.4 _IO_sprintf F
> diff --git
> a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
> b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist index
> 92114806ac..25a8e828e9 100644 ---
> a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist +++
> b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist @@
> -2065,6 +2065,14 @@ GLIBC_2.32 sigabbrev_np F GLIBC_2.32 sigdescr_np
> F GLIBC_2.32 strerrordesc_np F GLIBC_2.32 strerrorname_np F
> +GLIBC_2.33 fstat F
> +GLIBC_2.33 fstat64 F
> +GLIBC_2.33 fstatat F
> +GLIBC_2.33 fstatat64 F
> +GLIBC_2.33 lstat F
> +GLIBC_2.33 lstat64 F
> +GLIBC_2.33 stat F
> +GLIBC_2.33 stat64 F
>  GLIBC_2.4 _IO_fprintf F
>  GLIBC_2.4 _IO_printf F
>  GLIBC_2.4 _IO_sprintf F
> diff --git
> a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
> b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist index
> b01fdcfae1..46ae28e552 100644 ---
> a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist +++
> b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist @@
> -2355,3 +2355,11 @@ GLIBC_2.32 sigabbrev_np F GLIBC_2.32 sigdescr_np
> F GLIBC_2.32 strerrordesc_np F GLIBC_2.32 strerrorname_np F
> +GLIBC_2.33 fstat F
> +GLIBC_2.33 fstat64 F
> +GLIBC_2.33 fstatat F
> +GLIBC_2.33 fstatat64 F
> +GLIBC_2.33 lstat F
> +GLIBC_2.33 lstat64 F
> +GLIBC_2.33 stat F
> +GLIBC_2.33 stat64 F
> diff --git a/sysdeps/unix/sysv/linux/powerpc/xstatver.h
> b/sysdeps/unix/sysv/linux/powerpc/xstatver.h new file mode 100644
> index 0000000000..1656e2f7e4
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/powerpc/xstatver.h
> @@ -0,0 +1,11 @@
> +/* Versions of the 'struct stat' data structure used in
> compatibility xstat
> +   functions.  */
> +#define _STAT_VER_LINUX_OLD	1
> +#define _STAT_VER_KERNEL	1
> +#define _STAT_VER_SVR4		2
> +#define _STAT_VER_LINUX	  3
> +#if __WORDSIZE == 32
> +# define _STAT_VER		_STAT_VER_LINUX
> +#else
> +# define _STAT_VER		_STAT_VER_KERNEL
> +#endif
> diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
> b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist index
> 45cbeb1d98..1044aa6be2 100644 ---
> a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist +++
> b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist @@ -2122,3 +2122,11
> @@ GLIBC_2.32 sigabbrev_np F GLIBC_2.32 sigdescr_np F
>  GLIBC_2.32 strerrordesc_np F
>  GLIBC_2.32 strerrorname_np F
> +GLIBC_2.33 fstat F
> +GLIBC_2.33 fstat64 F
> +GLIBC_2.33 fstatat F
> +GLIBC_2.33 fstatat64 F
> +GLIBC_2.33 lstat F
> +GLIBC_2.33 lstat64 F
> +GLIBC_2.33 stat F
> +GLIBC_2.33 stat64 F
> diff --git a/sysdeps/unix/sysv/linux/s390/bits/stat.h
> b/sysdeps/unix/sysv/linux/s390/bits/stat.h index
> b383a98692..d12055529a 100644 ---
> a/sysdeps/unix/sysv/linux/s390/bits/stat.h +++
> b/sysdeps/unix/sysv/linux/s390/bits/stat.h @@ -25,21 +25,9 @@
>  #include <bits/wordsize.h>
>  
>  #if __WORDSIZE == 64
> -/* Versions of the `struct stat' data structure.  */
> -# define _STAT_VER_KERNEL	0
> -# define _STAT_VER_LINUX	1
> -# define _STAT_VER		_STAT_VER_LINUX
> -
>  /* Versions of the `xmknod' interface.	*/
>  #define _MKNOD_VER_LINUX	0
>  #else
> -/* Versions of the `struct stat' data structure.  */
> -# define _STAT_VER_LINUX_OLD	1
> -# define _STAT_VER_KERNEL	1
> -# define _STAT_VER_SVR4		2
> -# define _STAT_VER_LINUX	3
> -# define _STAT_VER		_STAT_VER_LINUX
> -
>  /* Versions of the `xmknod' interface.  */
>  # define _MKNOD_VER_LINUX	1
>  # define _MKNOD_VER_SVR4	2
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
> b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist index
> d0752dba6c..6b1fa7e67f 100644 ---
> a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist +++
> b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist @@ -2200,6
> +2200,14 @@ GLIBC_2.32 sigabbrev_np F GLIBC_2.32 sigdescr_np F
>  GLIBC_2.32 strerrordesc_np F
>  GLIBC_2.32 strerrorname_np F
> +GLIBC_2.33 fstat F
> +GLIBC_2.33 fstat64 F
> +GLIBC_2.33 fstatat F
> +GLIBC_2.33 fstatat64 F
> +GLIBC_2.33 lstat F
> +GLIBC_2.33 lstat64 F
> +GLIBC_2.33 stat F
> +GLIBC_2.33 stat64 F
>  GLIBC_2.4 _IO_fprintf F
>  GLIBC_2.4 _IO_printf F
>  GLIBC_2.4 _IO_sprintf F
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
> b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist index
> af5f14d1c6..0aec094e7b 100644 ---
> a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist +++
> b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist @@ -2101,6
> +2101,14 @@ GLIBC_2.32 sigabbrev_np F GLIBC_2.32 sigdescr_np F
>  GLIBC_2.32 strerrordesc_np F
>  GLIBC_2.32 strerrorname_np F
> +GLIBC_2.33 fstat F
> +GLIBC_2.33 fstat64 F
> +GLIBC_2.33 fstatat F
> +GLIBC_2.33 fstatat64 F
> +GLIBC_2.33 lstat F
> +GLIBC_2.33 lstat64 F
> +GLIBC_2.33 stat F
> +GLIBC_2.33 stat64 F
>  GLIBC_2.4 _IO_fprintf F
>  GLIBC_2.4 _IO_printf F
>  GLIBC_2.4 _IO_sprintf F
> diff --git a/sysdeps/unix/sysv/linux/s390/xstatver.h
> b/sysdeps/unix/sysv/linux/s390/xstatver.h new file mode 100644
> index 0000000000..5ad0db2797
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/s390/xstatver.h
> @@ -0,0 +1,16 @@
> +/* Versions of the 'struct stat' data structure used in
> compatibility xstat
> +   functions.  */
> +
> +#include <bits/wordsize.h>
> +
> +#if __WORDSIZE == 64
> +# define _STAT_VER_KERNEL	0
> +# define _STAT_VER_LINUX	1
> +# define _STAT_VER		_STAT_VER_LINUX
> +#else
> +# define _STAT_VER_LINUX_OLD	1
> +# define _STAT_VER_KERNEL	1
> +# define _STAT_VER_SVR4		2
> +# define _STAT_VER_LINUX	3
> +# define _STAT_VER		_STAT_VER_LINUX
> +#endif
> diff --git a/sysdeps/unix/sysv/linux/sh/le/libc.abilist
> b/sysdeps/unix/sysv/linux/sh/le/libc.abilist index
> 182970a708..e2ae13d4fa 100644 ---
> a/sysdeps/unix/sysv/linux/sh/le/libc.abilist +++
> b/sysdeps/unix/sysv/linux/sh/le/libc.abilist @@ -2067,6 +2067,14 @@
> GLIBC_2.32 sigabbrev_np F GLIBC_2.32 sigdescr_np F
>  GLIBC_2.32 strerrordesc_np F
>  GLIBC_2.32 strerrorname_np F
> +GLIBC_2.33 fstat F
> +GLIBC_2.33 fstat64 F
> +GLIBC_2.33 fstatat F
> +GLIBC_2.33 fstatat64 F
> +GLIBC_2.33 lstat F
> +GLIBC_2.33 lstat64 F
> +GLIBC_2.33 stat F
> +GLIBC_2.33 stat64 F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/sparc/bits/stat.h
> b/sysdeps/unix/sysv/linux/sparc/bits/stat.h index
> 7379f2232d..7af17b5c40 100644 ---
> a/sysdeps/unix/sysv/linux/sparc/bits/stat.h +++
> b/sysdeps/unix/sysv/linux/sparc/bits/stat.h @@ -22,13 +22,6 @@
>  #ifndef _BITS_STAT_H
>  #define _BITS_STAT_H	1
>  
> -/* Versions of the `struct stat' data structure.  */
> -#define _STAT_VER_LINUX_OLD	1
> -#define _STAT_VER_KERNEL	1
> -#define _STAT_VER_SVR4		2
> -#define _STAT_VER_LINUX		3
> -#define _STAT_VER		_STAT_VER_LINUX	/* The one
> defined below.  */ -
>  /* Versions of the `xmknod' interface.  */
>  #define _MKNOD_VER_LINUX	1
>  #define _MKNOD_VER_SVR4		2
> diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
> b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist index
> a2521c3ee3..886e01960f 100644 ---
> a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist +++
> b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist @@ -2191,6
> +2191,14 @@ GLIBC_2.32 sigabbrev_np F GLIBC_2.32 sigdescr_np F
>  GLIBC_2.32 strerrordesc_np F
>  GLIBC_2.32 strerrorname_np F
> +GLIBC_2.33 fstat F
> +GLIBC_2.33 fstat64 F
> +GLIBC_2.33 fstatat F
> +GLIBC_2.33 fstatat64 F
> +GLIBC_2.33 lstat F
> +GLIBC_2.33 lstat64 F
> +GLIBC_2.33 stat F
> +GLIBC_2.33 stat64 F
>  GLIBC_2.4 _IO_fprintf F
>  GLIBC_2.4 _IO_printf F
>  GLIBC_2.4 _IO_sprintf F
> diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
> b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist index
> d8188903f9..33b068201a 100644 ---
> a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist +++
> b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist @@ -2118,6
> +2118,14 @@ GLIBC_2.32 sigabbrev_np F GLIBC_2.32 sigdescr_np F
>  GLIBC_2.32 strerrordesc_np F
>  GLIBC_2.32 strerrorname_np F
> +GLIBC_2.33 fstat F
> +GLIBC_2.33 fstat64 F
> +GLIBC_2.33 fstatat F
> +GLIBC_2.33 fstatat64 F
> +GLIBC_2.33 lstat F
> +GLIBC_2.33 lstat64 F
> +GLIBC_2.33 stat F
> +GLIBC_2.33 stat64 F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/sparc/xstatver.h
> b/sysdeps/unix/sysv/linux/sparc/xstatver.h new file mode 100644
> index 0000000000..ae92b530e7
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/sparc/xstatver.h
> @@ -0,0 +1,7 @@
> +/* Versions of the 'struct stat' data structure used in
> compatibility xstat
> +   functions.  */
> +#define _STAT_VER_LINUX_OLD	1
> +#define _STAT_VER_KERNEL	1
> +#define _STAT_VER_SVR4		2
> +#define _STAT_VER_LINUX		3
> +#define _STAT_VER		_STAT_VER_LINUX	/* The one
> defined below.  */ diff --git
> a/sysdeps/unix/sysv/linux/x86/bits/stat.h
> b/sysdeps/unix/sysv/linux/x86/bits/stat.h index
> 25dec69dda..f132569e9d 100644 ---
> a/sysdeps/unix/sysv/linux/x86/bits/stat.h +++
> b/sysdeps/unix/sysv/linux/x86/bits/stat.h @@ -24,25 +24,15 @@ 
>  /* Versions of the `struct stat' data structure.  */
>  #ifndef __x86_64__
> -# define _STAT_VER_LINUX_OLD	1
> -# define _STAT_VER_KERNEL	1
> -# define _STAT_VER_SVR4		2
> -# define _STAT_VER_LINUX	3
> -
>  /* i386 versions of the `xmknod' interface.  */
>  # define _MKNOD_VER_LINUX	1
>  # define _MKNOD_VER_SVR4	2
>  # define _MKNOD_VER		_MKNOD_VER_LINUX /* The bits
> defined below.  */ #else
> -# define _STAT_VER_KERNEL	0
> -# define _STAT_VER_LINUX	1
> -
>  /* x86-64 versions of the `xmknod' interface.  */
>  # define _MKNOD_VER_LINUX	0
>  #endif
>  
> -#define _STAT_VER		_STAT_VER_LINUX
> -
>  struct stat
>    {
>      __dev_t st_dev;		/* Device.  */
> diff --git a/sysdeps/unix/sysv/linux/x86/xstatver.h
> b/sysdeps/unix/sysv/linux/x86/xstatver.h new file mode 100644
> index 0000000000..6f047a346d
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/x86/xstatver.h
> @@ -0,0 +1,13 @@
> +/* Versions of the 'struct stat' data structure used in
> compatibility xstat
> +   functions.  */
> +#ifndef __x86_64__
> +# define _STAT_VER_LINUX_OLD	1
> +# define _STAT_VER_KERNEL	1
> +# define _STAT_VER_SVR4		2
> +# define _STAT_VER_LINUX	3
> +#else
> +# define _STAT_VER_KERNEL	0
> +# define _STAT_VER_LINUX	1
> +#endif
> +#define _STAT_VER		_STAT_VER_LINUX
> +
> diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
> b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist index
> 1a96103c68..f767bdde24 100644 ---
> a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist +++
> b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist @@ -2076,6 +2076,14
> @@ GLIBC_2.32 sigabbrev_np F GLIBC_2.32 sigdescr_np F
>  GLIBC_2.32 strerrordesc_np F
>  GLIBC_2.32 strerrorname_np F
> +GLIBC_2.33 fstat F
> +GLIBC_2.33 fstat64 F
> +GLIBC_2.33 fstatat F
> +GLIBC_2.33 fstatat64 F
> +GLIBC_2.33 lstat F
> +GLIBC_2.33 lstat64 F
> +GLIBC_2.33 stat F
> +GLIBC_2.33 stat64 F
>  GLIBC_2.4 __confstr_chk F
>  GLIBC_2.4 __fgets_chk F
>  GLIBC_2.4 __fgets_unlocked_chk F
> diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
> b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist index
> 35745a75b6..535862a51e 100644 ---
> a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist +++
> b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist @@ -2173,3 +2173,11
> @@ GLIBC_2.32 sigabbrev_np F GLIBC_2.32 sigdescr_np F
>  GLIBC_2.32 strerrordesc_np F
>  GLIBC_2.32 strerrorname_np F
> +GLIBC_2.33 fstat F
> +GLIBC_2.33 fstat64 F
> +GLIBC_2.33 fstatat F
> +GLIBC_2.33 fstatat64 F
> +GLIBC_2.33 lstat F
> +GLIBC_2.33 lstat64 F
> +GLIBC_2.33 stat F
> +GLIBC_2.33 stat64 F
> diff --git a/sysdeps/unix/sysv/linux/xstatver.h
> b/sysdeps/unix/sysv/linux/xstatver.h new file mode 100644
> index 0000000000..59dba71dd1
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/xstatver.h
> @@ -0,0 +1,7 @@
> +/* Versions of the 'struct stat' data structure used in
> compatibility xstat
> +   functions.  */
> +#define _STAT_VER_LINUX_OLD	1
> +#define _STAT_VER_KERNEL	1
> +#define _STAT_VER_SVR4		2
> +#define _STAT_VER_LINUX		3
> +#define _STAT_VER		_STAT_VER_LINUX




Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
diff mbox series

Patch

diff --git a/include/sys/stat.h b/include/sys/stat.h
index f8847cf73e..0be918a7a7 100644
--- a/include/sys/stat.h
+++ b/include/sys/stat.h
@@ -2,10 +2,26 @@ 
 #include <io/sys/stat.h>
 
 #ifndef _ISOMAC
+# include <xstatver.h>
+
 /* Now define the internal interfaces. */
 extern int __stat (const char *__file, struct stat *__buf);
+extern int __stat64 (const char *__file, struct stat64 *__buf);
 extern int __fstat (int __fd, struct stat *__buf);
+extern int __fstat64 (int __fd, struct stat64 *__buf);
 extern int __lstat (const char *__file, struct stat *__buf);
+extern int __lstat64 (const char *__file, struct stat64 *__buf);
+extern int __fstatat (int dirfd, const char *pathname, struct stat *buf,
+		      int flags);
+extern int __fstatat64 (int dirfd, const char *pathname, struct stat64 *buf,
+			int flags);
+# if IS_IN (libc) || (IS_IN (rtld) && !defined NO_RTLD_HIDDEN)
+hidden_proto (__stat64)
+hidden_proto (__fstat64)
+hidden_proto (__lstat64)
+hidden_proto (__fstatat64)
+# endif
+
 extern int __chmod (const char *__file, __mode_t __mode);
 libc_hidden_proto (__chmod)
 extern int __fchmod (int __fd, __mode_t __mode);
@@ -13,20 +29,9 @@  libc_hidden_proto (fchmodat)
 extern __mode_t __umask (__mode_t __mask);
 extern int __mkdir (const char *__path, __mode_t __mode);
 libc_hidden_proto (__mkdir)
+
 extern int __mknod (const char *__path,
 		    __mode_t __mode, __dev_t __dev);
-#if IS_IN (libc) || (IS_IN (rtld) && !defined NO_RTLD_HIDDEN)
-hidden_proto (__fxstat)
-hidden_proto (__fxstat64)
-hidden_proto (__lxstat)
-hidden_proto (__lxstat64)
-hidden_proto (__xstat)
-hidden_proto (__xstat64)
-#endif
-extern __inline__ int __stat (const char *__path, struct stat *__statbuf)
-{
-  return __xstat (_STAT_VER, __path, __statbuf);
-}
 libc_hidden_proto (__xmknod)
 extern __inline__ int __mknod (const char *__path, __mode_t __mode,
 			       __dev_t __dev)
@@ -35,32 +40,47 @@  extern __inline__ int __mknod (const char *__path, __mode_t __mode,
 }
 libc_hidden_proto (__xmknodat)
 
-libc_hidden_proto (__fxstatat)
-libc_hidden_proto (__fxstatat64)
-
-# if IS_IN (rtld) && !defined NO_RTLD_HIDDEN
-extern __typeof (__fxstatat64) __fxstatat64 attribute_hidden;
+int __fxstat (int __ver, int __fildes, struct stat *__stat_buf);
+int __xstat (int __ver, const char *__filename,
+	     struct stat *__stat_buf);
+int __lxstat (int __ver, const char *__filename, struct stat *__stat_buf);
+int __fxstatat (int __ver, int __fildes, const char *__filename,
+		struct stat *__stat_buf, int __flag);
+int __fxstat64 (int ver, int __fildes, struct stat64 *__stat_buf);
+int __xstat64 (int ver, const char *__filename, struct stat64 *__stat_buf);
+int __lxstat64 (int ver, const char *__filename, struct stat64 *__stat_buf);
+int __fxstatat64 (int ver, int __fildes, const char *__filename,
+		  struct stat64 *__stat_buf, int __flag);
+libc_hidden_proto (__fxstat);
+libc_hidden_proto (__xstat);
+libc_hidden_proto (__lxstat);
+libc_hidden_proto (__fxstatat);
+# if IS_IN (libc) || (IS_IN (rtld) && !defined NO_RTLD_HIDDEN)
+hidden_proto (__fxstat64);
+hidden_proto (__xstat64);
+hidden_proto (__lxstat64);
+hidden_proto (__fxstatat64);
 # endif
 
-/* The `stat', `fstat', `lstat' functions have to be handled special since
-   even while not compiling the library with optimization calls to these
-   functions in the shared library must reference the `xstat' etc functions.
-   We have to use macros but we cannot define them in the normal headers
-   since on user level we must use real functions.  */
-#define stat(fname, buf) __xstat (_STAT_VER, fname, buf)
-#define lstat(fname, buf)  __lxstat (_STAT_VER, fname, buf)
-#define __lstat(fname, buf)  __lxstat (_STAT_VER, fname, buf)
-#define lstat64(fname, buf)  __lxstat64 (_STAT_VER, fname, buf)
-#define __lstat64(fname, buf)  __lxstat64 (_STAT_VER, fname, buf)
-#define stat64(fname, buf) __xstat64 (_STAT_VER, fname, buf)
-#define __stat64(fname, buf) __xstat64 (_STAT_VER, fname, buf)
-#define fstat64(fd, buf) __fxstat64 (_STAT_VER, fd, buf)
-#define __fstat64(fd, buf) __fxstat64 (_STAT_VER, fd, buf)
-#define fstat(fd, buf) __fxstat (_STAT_VER, fd, buf)
-#define __fstat(fd, buf) __fxstat (_STAT_VER, fd, buf)
-#define __fstatat(dfd, fname, buf, flag) \
-  __fxstatat (_STAT_VER, dfd, fname, buf, flag)
-#define __fstatat64(dfd, fname, buf, flag) \
-  __fxstatat64 (_STAT_VER, dfd, fname, buf, flag)
+# ifdef NO_RTLD_HIDDEN
+/* These are still required for Hurd.  */
+#  define stat(fname, buf) __xstat (_STAT_VER, fname, buf)
+#  define lstat(fname, buf)  __lxstat (_STAT_VER, fname, buf)
+#  define __lstat(fname, buf)  __lxstat (_STAT_VER, fname, buf)
+#  define lstat64(fname, buf)  __lxstat64 (_STAT_VER, fname, buf)
+#  define __lstat64(fname, buf)  __lxstat64 (_STAT_VER, fname, buf)
+#  define stat64(fname, buf) __xstat64 (_STAT_VER, fname, buf)
+#  define __stat64(fname, buf) __xstat64 (_STAT_VER, fname, buf)
+#  define fstat64(fd, buf) __fxstat64 (_STAT_VER, fd, buf)
+#  define __fstat64(fd, buf) __fxstat64 (_STAT_VER, fd, buf)
+#  define fstat(fd, buf) __fxstat (_STAT_VER, fd, buf)
+#  define __fstat(fd, buf) __fxstat (_STAT_VER, fd, buf)
+#  define __fstatat(dfd, fname, buf, flag) \
+    __fxstatat (_STAT_VER, dfd, fname, buf, flag)
+#  define __fstatat64(dfd, fname, buf, flag) \
+    __fxstatat64 (_STAT_VER, dfd, fname, buf, flag)
+# endif /* NO_RTLD_HIDDEN  */
+
 #endif
+
 #endif
diff --git a/io/Makefile b/io/Makefile
index cf380f3516..cee356b666 100644
--- a/io/Makefile
+++ b/io/Makefile
@@ -60,8 +60,7 @@  routines :=								\
 # These routines will be omitted from the libc shared object.
 # Instead the static object files will be included in a special archive
 # linked against when the shared library will be used.
-static-only-routines = stat fstat lstat stat64 fstat64 lstat64	\
-		       fstatat fstatat64 mknod mknodat
+static-only-routines = mknod mknodat
 
 others		:= pwd
 test-srcs	:= ftwtest
@@ -78,6 +77,7 @@  tests		:= test-utime test-stat test-stat2 test-lfs tst-getcwd \
 
 # Likewise for statx, but we do not need static linking here.
 tests-internal += tst-statx
+tests-static += tst-statx
 
 ifeq ($(run-built-tests),yes)
 tests-special += $(objpfx)ftwtest.out
diff --git a/io/Versions b/io/Versions
index ee468055ff..f6db0e84ad 100644
--- a/io/Versions
+++ b/io/Versions
@@ -132,6 +132,9 @@  libc {
     fcntl64;
     statx;
   }
+  GLIBC_2.33 {
+    stat; stat64; fstat; fstat64; lstat; lstat64; fstatat; fstatat64;
+  }
   GLIBC_PRIVATE {
     __libc_fcntl64;
     __fcntl_nocancel;
@@ -141,5 +144,6 @@  libc {
     __file_change_detection_for_stat;
     __file_change_detection_for_path;
     __file_change_detection_for_fp;
+    __fstat64;
   }
 }
diff --git a/io/fstat.c b/io/fstat.c
index 6ce077dc4a..faadd75e31 100644
--- a/io/fstat.c
+++ b/io/fstat.c
@@ -1,4 +1,5 @@ 
-/* Copyright (C) 1996-2020 Free Software Foundation, Inc.
+/* Get file status.
+   Copyright (C) 1996-2020 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -6,23 +7,6 @@ 
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
-   In addition to the permissions in the GNU Lesser General Public
-   License, the Free Software Foundation gives you unlimited
-   permission to link the compiled version of this file with other
-   programs, and to distribute those programs without any restriction
-   coming from the use of this file. (The GNU Lesser General Public
-   License restrictions do apply in other respects; for example, they
-   cover modification of the file, and distribution when not linked
-   into another program.)
-
-   Note that people who make modified versions of this file are not
-   obligated to grant this special exception for their modified
-   versions; it is their choice whether to do so. The GNU Lesser
-   General Public License gives permission to release a modified
-   version without this exception; this exception also makes it
-   possible to release a modified version which carries forward this
-   exception.
-
    The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
@@ -34,22 +18,11 @@ 
 
 #include <sys/stat.h>
 
-/* This definition is only used if inlining fails for this function; see
-   the last page of <sys/stat.h>.  The real work is done by the `x'
-   function which is passed a version number argument.  We arrange in the
-   makefile that when not inlined this function is always statically
-   linked; that way a dynamically-linked executable always encodes the
-   version number corresponding to the data structures it uses, so the `x'
-   functions in the shared library can adapt without needing to recompile
-   all callers.  */
-
-#undef fstat
 #undef __fstat
 int
-attribute_hidden
 __fstat (int fd, struct stat *buf)
 {
   return __fxstat (_STAT_VER, fd, buf);
 }
 
-weak_hidden_alias (__fstat, fstat)
+weak_alias (__fstat, fstat)
diff --git a/io/fstat64.c b/io/fstat64.c
index c4dd3acd60..b1fc17e5bf 100644
--- a/io/fstat64.c
+++ b/io/fstat64.c
@@ -1,4 +1,5 @@ 
-/* Copyright (C) 1996-2020 Free Software Foundation, Inc.
+/* Get file status.
+   Copyright (C) 1996-2020 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -6,23 +7,6 @@ 
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
-   In addition to the permissions in the GNU Lesser General Public
-   License, the Free Software Foundation gives you unlimited
-   permission to link the compiled version of this file with other
-   programs, and to distribute those programs without any restriction
-   coming from the use of this file. (The GNU Lesser General Public
-   License restrictions do apply in other respects; for example, they
-   cover modification of the file, and distribution when not linked
-   into another program.)
-
-   Note that people who make modified versions of this file are not
-   obligated to grant this special exception for their modified
-   versions; it is their choice whether to do so. The GNU Lesser
-   General Public License gives permission to release a modified
-   version without this exception; this exception also makes it
-   possible to release a modified version which carries forward this
-   exception.
-
    The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
@@ -34,19 +18,11 @@ 
 
 #include <sys/stat.h>
 
-/* This definition is only used if inlining fails for this function; see
-   the last page of <sys/stat.h>.  The real work is done by the `x'
-   function which is passed a version number argument.  We arrange in the
-   makefile that when not inlined this function is always statically
-   linked; that way a dynamically-linked executable always encodes the
-   version number corresponding to the data structures it uses, so the `x'
-   functions in the shared library can adapt without needing to recompile
-   all callers.  */
-
-#undef fstat64
+#undef __fstat64
 int
-attribute_hidden
-fstat64 (int fd, struct stat64 *buf)
+__fstat64 (int fd, struct stat64 *buf)
 {
   return __fxstat64 (_STAT_VER, fd, buf);
 }
+hidden_def (__fstat64)
+weak_alias (__fstat64, fstat64)
diff --git a/io/fstatat.c b/io/fstatat.c
index edc773487a..12443c2ff4 100644
--- a/io/fstatat.c
+++ b/io/fstatat.c
@@ -1,4 +1,5 @@ 
-/* Copyright (C) 2005-2020 Free Software Foundation, Inc.
+/* Get file status.
+   Copyright (C) 2005-2020 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -6,23 +7,6 @@ 
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
-   In addition to the permissions in the GNU Lesser General Public
-   License, the Free Software Foundation gives you unlimited
-   permission to link the compiled version of this file with other
-   programs, and to distribute those programs without any restriction
-   coming from the use of this file. (The GNU Lesser General Public
-   License restrictions do apply in other respects; for example, they
-   cover modification of the file, and distribution when not linked
-   into another program.)
-
-   Note that people who make modified versions of this file are not
-   obligated to grant this special exception for their modified
-   versions; it is their choice whether to do so. The GNU Lesser
-   General Public License gives permission to release a modified
-   version without this exception; this exception also makes it
-   possible to release a modified version which carries forward this
-   exception.
-
    The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
@@ -34,19 +18,11 @@ 
 
 #include <sys/stat.h>
 
-/* This definition is only used if inlining fails for this function; see
-   the last page of <sys/stat.h>.  The real work is done by the `x'
-   function which is passed a version number argument.  We arrange in the
-   makefile that when not inlined this function is always statically
-   linked; that way a dynamically-linked executable always encodes the
-   version number corresponding to the data structures it uses, so the `x'
-   functions in the shared library can adapt without needing to recompile
-   all callers.  */
-
-#undef fstatat
+#undef __fstatat
 int
-attribute_hidden
-fstatat (int fd, const char *file, struct stat *buf, int flag)
+__fstatat (int fd, const char *file, struct stat *buf, int flag)
 {
   return __fxstatat (_STAT_VER, fd, file, buf, flag);
 }
+
+weak_alias (__fstatat, fstatat)
diff --git a/io/fstatat64.c b/io/fstatat64.c
index b57133bd90..5ba4cdf68a 100644
--- a/io/fstatat64.c
+++ b/io/fstatat64.c
@@ -1,4 +1,5 @@ 
-/* Copyright (C) 2005-2020 Free Software Foundation, Inc.
+/* Get file status.
+   Copyright (C) 2005-2020 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -6,23 +7,6 @@ 
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
-   In addition to the permissions in the GNU Lesser General Public
-   License, the Free Software Foundation gives you unlimited
-   permission to link the compiled version of this file with other
-   programs, and to distribute those programs without any restriction
-   coming from the use of this file. (The GNU Lesser General Public
-   License restrictions do apply in other respects; for example, they
-   cover modification of the file, and distribution when not linked
-   into another program.)
-
-   Note that people who make modified versions of this file are not
-   obligated to grant this special exception for their modified
-   versions; it is their choice whether to do so. The GNU Lesser
-   General Public License gives permission to release a modified
-   version without this exception; this exception also makes it
-   possible to release a modified version which carries forward this
-   exception.
-
    The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
@@ -34,19 +18,11 @@ 
 
 #include <sys/stat.h>
 
-/* This definition is only used if inlining fails for this function; see
-   the last page of <sys/stat.h>.  The real work is done by the `x'
-   function which is passed a version number argument.  We arrange in the
-   makefile that when not inlined this function is always statically
-   linked; that way a dynamically-linked executable always encodes the
-   version number corresponding to the data structures it uses, so the `x'
-   functions in the shared library can adapt without needing to recompile
-   all callers.  */
-
-#undef fstatat64
+#undef __fstatat64
 int
-attribute_hidden
-fstatat64 (int fd, const char *file, struct stat64 *buf, int flag)
+__fstatat64 (int fd, const char *file, struct stat64 *buf, int flag)
 {
   return __fxstatat64 (_STAT_VER, fd, file, buf, flag);
 }
+hidden_def (__fstatat64)
+weak_alias (__fstatat64, fstatat64)
diff --git a/io/lstat.c b/io/lstat.c
index 7134741106..2a046c05e1 100644
--- a/io/lstat.c
+++ b/io/lstat.c
@@ -1,4 +1,5 @@ 
-/* Copyright (C) 1996-2020 Free Software Foundation, Inc.
+/* Get file status.
+   Copyright (C) 1996-2020 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -6,23 +7,6 @@ 
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
-   In addition to the permissions in the GNU Lesser General Public
-   License, the Free Software Foundation gives you unlimited
-   permission to link the compiled version of this file with other
-   programs, and to distribute those programs without any restriction
-   coming from the use of this file. (The GNU Lesser General Public
-   License restrictions do apply in other respects; for example, they
-   cover modification of the file, and distribution when not linked
-   into another program.)
-
-   Note that people who make modified versions of this file are not
-   obligated to grant this special exception for their modified
-   versions; it is their choice whether to do so. The GNU Lesser
-   General Public License gives permission to release a modified
-   version without this exception; this exception also makes it
-   possible to release a modified version which carries forward this
-   exception.
-
    The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
@@ -34,22 +18,11 @@ 
 
 #include <sys/stat.h>
 
-/* This definition is only used if inlining fails for this function; see
-   the last page of <sys/stat.h>.  The real work is done by the `x'
-   function which is passed a version number argument.  We arrange in the
-   makefile that when not inlined this function is always statically
-   linked; that way a dynamically-linked executable always encodes the
-   version number corresponding to the data structures it uses, so the `x'
-   functions in the shared library can adapt without needing to recompile
-   all callers.  */
-
-#undef lstat
 #undef __lstat
 int
-attribute_hidden
 __lstat (const char *file, struct stat *buf)
 {
   return __lxstat (_STAT_VER, file, buf);
 }
 
-weak_hidden_alias (__lstat, lstat)
+weak_alias (__lstat, lstat)
diff --git a/io/lstat64.c b/io/lstat64.c
index a890da71a8..a73c5a2541 100644
--- a/io/lstat64.c
+++ b/io/lstat64.c
@@ -1,4 +1,5 @@ 
-/* Copyright (C) 1996-2020 Free Software Foundation, Inc.
+/* Get file status.
+   Copyright (C) 1996-2020 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -6,23 +7,6 @@ 
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
-   In addition to the permissions in the GNU Lesser General Public
-   License, the Free Software Foundation gives you unlimited
-   permission to link the compiled version of this file with other
-   programs, and to distribute those programs without any restriction
-   coming from the use of this file. (The GNU Lesser General Public
-   License restrictions do apply in other respects; for example, they
-   cover modification of the file, and distribution when not linked
-   into another program.)
-
-   Note that people who make modified versions of this file are not
-   obligated to grant this special exception for their modified
-   versions; it is their choice whether to do so. The GNU Lesser
-   General Public License gives permission to release a modified
-   version without this exception; this exception also makes it
-   possible to release a modified version which carries forward this
-   exception.
-
    The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
@@ -34,19 +18,11 @@ 
 
 #include <sys/stat.h>
 
-/* This definition is only used if inlining fails for this function; see
-   the last page of <sys/stat.h>.  The real work is done by the `x'
-   function which is passed a version number argument.  We arrange in the
-   makefile that when not inlined this function is always statically
-   linked; that way a dynamically-linked executable always encodes the
-   version number corresponding to the data structures it uses, so the `x'
-   functions in the shared library can adapt without needing to recompile
-   all callers.  */
-
-#undef lstat64
+#undef __lstat64
 int
-attribute_hidden
-lstat64 (const char *file, struct stat64 *buf)
+__lstat64 (const char *file, struct stat64 *buf)
 {
   return __lxstat64 (_STAT_VER, file, buf);
 }
+hidden_def (__lstat64)
+weak_alias (__lstat64, lstat64)
diff --git a/io/stat.c b/io/stat.c
index 8c3cd877c8..b3d06107e3 100644
--- a/io/stat.c
+++ b/io/stat.c
@@ -1,4 +1,5 @@ 
-/* Copyright (C) 1996-2020 Free Software Foundation, Inc.
+/* Get file status.
+   Copyright (C) 1996-2020 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -6,23 +7,6 @@ 
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
-   In addition to the permissions in the GNU Lesser General Public
-   License, the Free Software Foundation gives you unlimited
-   permission to link the compiled version of this file with other
-   programs, and to distribute those programs without any restriction
-   coming from the use of this file. (The GNU Lesser General Public
-   License restrictions do apply in other respects; for example, they
-   cover modification of the file, and distribution when not linked
-   into another program.)
-
-   Note that people who make modified versions of this file are not
-   obligated to grant this special exception for their modified
-   versions; it is their choice whether to do so. The GNU Lesser
-   General Public License gives permission to release a modified
-   version without this exception; this exception also makes it
-   possible to release a modified version which carries forward this
-   exception.
-
    The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
@@ -34,21 +18,11 @@ 
 
 #include <sys/stat.h>
 
-/* This definition is only used if inlining fails for this function; see
-   the last page of <sys/stat.h>.  The real work is done by the `x'
-   function which is passed a version number argument.  We arrange in the
-   makefile that when not inlined this function is always statically
-   linked; that way a dynamically-linked executable always encodes the
-   version number corresponding to the data structures it uses, so the `x'
-   functions in the shared library can adapt without needing to recompile
-   all callers.  */
-
-#undef stat
+#undef __stat
 int
-attribute_hidden
 __stat (const char *file, struct stat *buf)
 {
   return __xstat (_STAT_VER, file, buf);
 }
 
-weak_hidden_alias (__stat, stat)
+weak_alias (__stat, stat)
diff --git a/io/stat64.c b/io/stat64.c
index 8b6b662f3a..41e8905c4e 100644
--- a/io/stat64.c
+++ b/io/stat64.c
@@ -1,4 +1,5 @@ 
-/* Copyright (C) 1996-2020 Free Software Foundation, Inc.
+/* Get file status.
+   Copyright (C) 1996-2020 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -6,23 +7,6 @@ 
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
-   In addition to the permissions in the GNU Lesser General Public
-   License, the Free Software Foundation gives you unlimited
-   permission to link the compiled version of this file with other
-   programs, and to distribute those programs without any restriction
-   coming from the use of this file. (The GNU Lesser General Public
-   License restrictions do apply in other respects; for example, they
-   cover modification of the file, and distribution when not linked
-   into another program.)
-
-   Note that people who make modified versions of this file are not
-   obligated to grant this special exception for their modified
-   versions; it is their choice whether to do so. The GNU Lesser
-   General Public License gives permission to release a modified
-   version without this exception; this exception also makes it
-   possible to release a modified version which carries forward this
-   exception.
-
    The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
@@ -34,19 +18,11 @@ 
 
 #include <sys/stat.h>
 
-/* This definition is only used if inlining fails for this function; see
-   the last page of <sys/stat.h>.  The real work is done by the `x'
-   function which is passed a version number argument.  We arrange in the
-   makefile that when not inlined this function is always statically
-   linked; that way a dynamically-linked executable always encodes the
-   version number corresponding to the data structures it uses, so the `x'
-   functions in the shared library can adapt without needing to recompile
-   all callers.  */
-
-#undef stat64
+#undef __stat64
 int
-attribute_hidden
-stat64 (const char *file, struct stat64 *buf)
+__stat64 (const char *file, struct stat64 *buf)
 {
   return __xstat64 (_STAT_VER, file, buf);
 }
+hidden_def (__stat64)
+weak_alias (__stat64, stat64)
diff --git a/io/sys/stat.h b/io/sys/stat.h
index ce014d03a5..83cf253c72 100644
--- a/io/sys/stat.h
+++ b/io/sys/stat.h
@@ -368,73 +368,10 @@  extern int utimensat (int __fd, const char *__path,
 extern int futimens (int __fd, const struct timespec __times[2]) __THROW;
 #endif
 
-/* To allow the `struct stat' structure and the file type `mode_t'
-   bits to vary without changing shared library major version number,
-   the `stat' family of functions and `mknod' are in fact inline
-   wrappers around calls to `xstat', `fxstat', `lxstat', and `xmknod',
-   which all take a leading version-number argument designating the
-   data structure and bits used.  <bits/stat.h> defines _STAT_VER with
-   the version number corresponding to `struct stat' as defined in
-   that file; and _MKNOD_VER with the version number corresponding to
-   the S_IF* macros defined therein.  It is arranged that when not
-   inlined these function are always statically linked; that way a
-   dynamically-linked executable always encodes the version number
-   corresponding to the data structures it uses, so the `x' functions
-   in the shared library can adapt without needing to recompile all
-   callers.  */
-
-#ifndef _STAT_VER
-# define _STAT_VER	0
-#endif
 #ifndef _MKNOD_VER
 # define _MKNOD_VER	0
 #endif
 
-/* Wrappers for stat and mknod system calls.  */
-#ifndef __USE_FILE_OFFSET64
-extern int __fxstat (int __ver, int __fildes, struct stat *__stat_buf)
-     __THROW __nonnull ((3));
-extern int __xstat (int __ver, const char *__filename,
-		    struct stat *__stat_buf) __THROW __nonnull ((2, 3));
-extern int __lxstat (int __ver, const char *__filename,
-		     struct stat *__stat_buf) __THROW __nonnull ((2, 3));
-extern int __fxstatat (int __ver, int __fildes, const char *__filename,
-		       struct stat *__stat_buf, int __flag)
-     __THROW __nonnull ((3, 4));
-#else
-# ifdef __REDIRECT_NTH
-extern int __REDIRECT_NTH (__fxstat, (int __ver, int __fildes,
-				      struct stat *__stat_buf), __fxstat64)
-     __nonnull ((3));
-extern int __REDIRECT_NTH (__xstat, (int __ver, const char *__filename,
-				     struct stat *__stat_buf), __xstat64)
-     __nonnull ((2, 3));
-extern int __REDIRECT_NTH (__lxstat, (int __ver, const char *__filename,
-				      struct stat *__stat_buf), __lxstat64)
-     __nonnull ((2, 3));
-extern int __REDIRECT_NTH (__fxstatat, (int __ver, int __fildes,
-					const char *__filename,
-					struct stat *__stat_buf, int __flag),
-			   __fxstatat64) __nonnull ((3, 4));
-
-# else
-#  define __fxstat __fxstat64
-#  define __xstat __xstat64
-#  define __lxstat __lxstat64
-# endif
-#endif
-
-#ifdef __USE_LARGEFILE64
-extern int __fxstat64 (int __ver, int __fildes, struct stat64 *__stat_buf)
-     __THROW __nonnull ((3));
-extern int __xstat64 (int __ver, const char *__filename,
-		      struct stat64 *__stat_buf) __THROW __nonnull ((2, 3));
-extern int __lxstat64 (int __ver, const char *__filename,
-		       struct stat64 *__stat_buf) __THROW __nonnull ((2, 3));
-extern int __fxstatat64 (int __ver, int __fildes, const char *__filename,
-			 struct stat64 *__stat_buf, int __flag)
-     __THROW __nonnull ((3, 4));
-#endif
 extern int __xmknod (int __ver, const char *__path, __mode_t __mode,
 		     __dev_t *__dev) __THROW __nonnull ((2, 4));
 
@@ -447,37 +384,6 @@  extern int __xmknodat (int __ver, int __fd, const char *__path,
 #endif
 
 #ifdef __USE_EXTERN_INLINES
-/* Inlined versions of the real stat and mknod functions.  */
-
-__extern_inline int
-__NTH (stat (const char *__path, struct stat *__statbuf))
-{
-  return __xstat (_STAT_VER, __path, __statbuf);
-}
-
-# if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
-__extern_inline int
-__NTH (lstat (const char *__path, struct stat *__statbuf))
-{
-  return __lxstat (_STAT_VER, __path, __statbuf);
-}
-# endif
-
-__extern_inline int
-__NTH (fstat (int __fd, struct stat *__statbuf))
-{
-  return __fxstat (_STAT_VER, __fd, __statbuf);
-}
-
-# ifdef __USE_ATFILE
-__extern_inline int
-__NTH (fstatat (int __fd, const char *__filename, struct stat *__statbuf,
-		int __flag))
-{
-  return __fxstatat (_STAT_VER, __fd, __filename, __statbuf, __flag);
-}
-# endif
-
 # ifdef __USE_MISC
 __extern_inline int
 __NTH (mknod (const char *__path, __mode_t __mode, __dev_t __dev))
@@ -494,41 +400,6 @@  __NTH (mknodat (int __fd, const char *__path, __mode_t __mode,
   return __xmknodat (_MKNOD_VER, __fd, __path, __mode, &__dev);
 }
 # endif
-
-# if defined __USE_LARGEFILE64 \
-  && (! defined __USE_FILE_OFFSET64 \
-      || (defined __REDIRECT_NTH && defined __OPTIMIZE__))
-__extern_inline int
-__NTH (stat64 (const char *__path, struct stat64 *__statbuf))
-{
-  return __xstat64 (_STAT_VER, __path, __statbuf);
-}
-
-#  if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
-__extern_inline int
-__NTH (lstat64 (const char *__path, struct stat64 *__statbuf))
-{
-  return __lxstat64 (_STAT_VER, __path, __statbuf);
-}
-#  endif
-
-__extern_inline int
-__NTH (fstat64 (int __fd, struct stat64 *__statbuf))
-{
-  return __fxstat64 (_STAT_VER, __fd, __statbuf);
-}
-
-#  ifdef __USE_ATFILE
-__extern_inline int
-__NTH (fstatat64 (int __fd, const char *__filename, struct stat64 *__statbuf,
-		  int __flag))
-{
-  return __fxstatat64 (_STAT_VER, __fd, __filename, __statbuf, __flag);
-}
-#  endif
-
-# endif
-
 #endif
 
 __END_DECLS
diff --git a/nscd/gai.c b/nscd/gai.c
index 2e19530102..b0058bc873 100644
--- a/nscd/gai.c
+++ b/nscd/gai.c
@@ -16,6 +16,7 @@ 
    along with this program; if not, see <https://www.gnu.org/licenses/>.  */
 
 #include <alloca.h>
+#include <sys/stat.h>
 
 /* This file uses the getaddrinfo code but it compiles it without NSCD
    support.  We just need a few symbol renames.  */
@@ -32,6 +33,10 @@ 
 #define __libc_use_alloca(size) (size <= __MAX_ALLOCA_CUTOFF)
 #define __getifaddrs getifaddrs
 #define __freeifaddrs freeifaddrs
+#undef __fstat64
+#define __fstat64 fstat64
+#undef __stat64
+#define __stat64 stat64
 
 /* We are nscd, so we don't want to be talking to ourselves.  */
 #undef  USE_NSCD
diff --git a/sysdeps/generic/xstatver.h b/sysdeps/generic/xstatver.h
new file mode 100644
index 0000000000..d727c98a16
--- /dev/null
+++ b/sysdeps/generic/xstatver.h
@@ -0,0 +1,3 @@ 
+/* Versions of the 'struct stat' data structure used in compatibility xstat
+   functions.  */
+#define _STAT_VER 0
diff --git a/sysdeps/mach/hurd/i386/libc.abilist b/sysdeps/mach/hurd/i386/libc.abilist
index 5f6154d518..74a4ed5c1d 100644
--- a/sysdeps/mach/hurd/i386/libc.abilist
+++ b/sysdeps/mach/hurd/i386/libc.abilist
@@ -2192,6 +2192,14 @@  GLIBC_2.32 thrd_current F
 GLIBC_2.32 thrd_equal F
 GLIBC_2.32 thrd_sleep F
 GLIBC_2.32 thrd_yield F
+GLIBC_2.33 fstat F
+GLIBC_2.33 fstat64 F
+GLIBC_2.33 fstatat F
+GLIBC_2.33 fstatat64 F
+GLIBC_2.33 lstat F
+GLIBC_2.33 lstat64 F
+GLIBC_2.33 stat F
+GLIBC_2.33 stat64 F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index 82c898fe35..ad4923ddbc 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -2138,7 +2138,7 @@  static void
 gaiconf_reload (void)
 {
   struct stat64 st;
-  if (stat64 (GAICONF_FNAME, &st) != 0
+  if (__stat64 (GAICONF_FNAME, &st) != 0
       || !check_gaiconf_mtime (&st))
     gaiconf_init ();
 }
diff --git a/sysdeps/unix/sysv/linux/aarch64/libc.abilist b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
index 6cd61988b4..03e4ae9296 100644
--- a/sysdeps/unix/sysv/linux/aarch64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
@@ -2160,3 +2160,11 @@  GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 fstat F
+GLIBC_2.33 fstat64 F
+GLIBC_2.33 fstatat F
+GLIBC_2.33 fstatat64 F
+GLIBC_2.33 lstat F
+GLIBC_2.33 lstat64 F
+GLIBC_2.33 stat F
+GLIBC_2.33 stat64 F
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/stat.h b/sysdeps/unix/sysv/linux/alpha/bits/stat.h
index 0064ca09ff..1fc27936b9 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/stat.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/stat.h
@@ -22,15 +22,6 @@ 
 #ifndef _BITS_STAT_H
 #define _BITS_STAT_H	1
 
-/* Versions of the `struct stat' data structure.  */
-#define _STAT_VER_KERNEL	0
-#define _STAT_VER_GLIBC2	1
-#define _STAT_VER_GLIBC2_1	2
-#define _STAT_VER_KERNEL64	3
-#define _STAT_VER_GLIBC2_3_4	3
-#define _STAT_VER_LINUX		3
-#define _STAT_VER		_STAT_VER_LINUX
-
 /* Versions of the `xmknod' interface.  */
 #define _MKNOD_VER_LINUX	0
 
diff --git a/sysdeps/unix/sysv/linux/alpha/libc.abilist b/sysdeps/unix/sysv/linux/alpha/libc.abilist
index 8edb5deea1..5b752ef4a8 100644
--- a/sysdeps/unix/sysv/linux/alpha/libc.abilist
+++ b/sysdeps/unix/sysv/linux/alpha/libc.abilist
@@ -2242,6 +2242,14 @@  GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 fstat F
+GLIBC_2.33 fstat64 F
+GLIBC_2.33 fstatat F
+GLIBC_2.33 fstatat64 F
+GLIBC_2.33 lstat F
+GLIBC_2.33 lstat64 F
+GLIBC_2.33 stat F
+GLIBC_2.33 stat64 F
 GLIBC_2.4 _IO_fprintf F
 GLIBC_2.4 _IO_printf F
 GLIBC_2.4 _IO_sprintf F
diff --git a/sysdeps/unix/sysv/linux/alpha/xstatver.h b/sysdeps/unix/sysv/linux/alpha/xstatver.h
new file mode 100644
index 0000000000..bbb9469617
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/xstatver.h
@@ -0,0 +1,9 @@ 
+/* Versions of the 'struct stat' data structure used in compatibility xstat
+   functions.  */
+#define _STAT_VER_KERNEL	0
+#define _STAT_VER_GLIBC2	1
+#define _STAT_VER_GLIBC2_1	2
+#define _STAT_VER_KERNEL64	3
+#define _STAT_VER_GLIBC2_3_4	3
+#define _STAT_VER_LINUX		3
+#define _STAT_VER		_STAT_VER_LINUX
diff --git a/sysdeps/unix/sysv/linux/arc/libc.abilist b/sysdeps/unix/sysv/linux/arc/libc.abilist
index df13f49e15..925b532383 100644
--- a/sysdeps/unix/sysv/linux/arc/libc.abilist
+++ b/sysdeps/unix/sysv/linux/arc/libc.abilist
@@ -1920,3 +1920,11 @@  GLIBC_2.32 wprintf F
 GLIBC_2.32 write F
 GLIBC_2.32 writev F
 GLIBC_2.32 wscanf F
+GLIBC_2.33 fstat F
+GLIBC_2.33 fstat64 F
+GLIBC_2.33 fstatat F
+GLIBC_2.33 fstatat64 F
+GLIBC_2.33 lstat F
+GLIBC_2.33 lstat64 F
+GLIBC_2.33 stat F
+GLIBC_2.33 stat64 F
diff --git a/sysdeps/unix/sysv/linux/arm/le/libc.abilist b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
index a83cc81958..a4c1a7c03c 100644
--- a/sysdeps/unix/sysv/linux/arm/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
@@ -141,6 +141,14 @@  GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 fstat F
+GLIBC_2.33 fstat64 F
+GLIBC_2.33 fstatat F
+GLIBC_2.33 fstatat64 F
+GLIBC_2.33 lstat F
+GLIBC_2.33 lstat64 F
+GLIBC_2.33 stat F
+GLIBC_2.33 stat64 F
 GLIBC_2.4 _Exit F
 GLIBC_2.4 _IO_2_1_stderr_ D 0xa0
 GLIBC_2.4 _IO_2_1_stdin_ D 0xa0
diff --git a/sysdeps/unix/sysv/linux/bits/stat.h b/sysdeps/unix/sysv/linux/bits/stat.h
index 240628a6f4..b542623208 100644
--- a/sysdeps/unix/sysv/linux/bits/stat.h
+++ b/sysdeps/unix/sysv/linux/bits/stat.h
@@ -23,12 +23,6 @@ 
 #define _BITS_STAT_H	1
 
 /* Versions of the `struct stat' data structure.  */
-#define _STAT_VER_LINUX_OLD	1
-#define _STAT_VER_KERNEL	1
-#define _STAT_VER_SVR4		2
-#define _STAT_VER_LINUX		3
-#define _STAT_VER		_STAT_VER_LINUX	/* The one defined below.  */
-
 /* Versions of the `xmknod' interface.  */
 #define _MKNOD_VER_LINUX	1
 #define _MKNOD_VER_SVR4		2
diff --git a/sysdeps/unix/sysv/linux/csky/libc.abilist b/sysdeps/unix/sysv/linux/csky/libc.abilist
index 32887b1c58..799873e189 100644
--- a/sysdeps/unix/sysv/linux/csky/libc.abilist
+++ b/sysdeps/unix/sysv/linux/csky/libc.abilist
@@ -2104,3 +2104,11 @@  GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 fstat F
+GLIBC_2.33 fstat64 F
+GLIBC_2.33 fstatat F
+GLIBC_2.33 fstatat64 F
+GLIBC_2.33 lstat F
+GLIBC_2.33 lstat64 F
+GLIBC_2.33 stat F
+GLIBC_2.33 stat64 F
diff --git a/sysdeps/unix/sysv/linux/generic/bits/stat.h b/sysdeps/unix/sysv/linux/generic/bits/stat.h
index 8d0980f0f5..35e14a47c6 100644
--- a/sysdeps/unix/sysv/linux/generic/bits/stat.h
+++ b/sysdeps/unix/sysv/linux/generic/bits/stat.h
@@ -26,17 +26,6 @@ 
 #include <bits/endian.h>
 #include <bits/wordsize.h>
 
-/* 64-bit libc uses the kernel's 'struct stat', accessed via the
-   stat() syscall; 32-bit libc uses the kernel's 'struct stat64'
-   and accesses it via the stat64() syscall.  All the various
-   APIs offered by libc use the kernel shape for their struct stat
-   structure; the only difference is that 32-bit programs not
-   using __USE_FILE_OFFSET64 only see the low 32 bits of some
-   of the fields (specifically st_ino, st_size, and st_blocks).  */
-#define _STAT_VER_KERNEL	0
-#define _STAT_VER_LINUX		0
-#define _STAT_VER		_STAT_VER_KERNEL
-
 /* Versions of the `xmknod' interface.  */
 #define _MKNOD_VER_LINUX	0
 
diff --git a/sysdeps/unix/sysv/linux/generic/xstatver.h b/sysdeps/unix/sysv/linux/generic/xstatver.h
new file mode 100644
index 0000000000..8675db494c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/generic/xstatver.h
@@ -0,0 +1,5 @@ 
+/* Versions of the 'struct stat' data structure used in compatibility xstat
+   functions.  */
+#define _STAT_VER_KERNEL	0
+#define _STAT_VER_LINUX		0
+#define _STAT_VER		_STAT_VER_KERNEL
diff --git a/sysdeps/unix/sysv/linux/hppa/libc.abilist b/sysdeps/unix/sysv/linux/hppa/libc.abilist
index baf425072b..95c7bf4f06 100644
--- a/sysdeps/unix/sysv/linux/hppa/libc.abilist
+++ b/sysdeps/unix/sysv/linux/hppa/libc.abilist
@@ -2063,6 +2063,14 @@  GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 fstat F
+GLIBC_2.33 fstat64 F
+GLIBC_2.33 fstatat F
+GLIBC_2.33 fstatat64 F
+GLIBC_2.33 lstat F
+GLIBC_2.33 lstat64 F
+GLIBC_2.33 stat F
+GLIBC_2.33 stat64 F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/i386/libc.abilist b/sysdeps/unix/sysv/linux/i386/libc.abilist
index 8b0242a9b1..e7cf5cdb98 100644
--- a/sysdeps/unix/sysv/linux/i386/libc.abilist
+++ b/sysdeps/unix/sysv/linux/i386/libc.abilist
@@ -2229,6 +2229,14 @@  GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 fstat F
+GLIBC_2.33 fstat64 F
+GLIBC_2.33 fstatat F
+GLIBC_2.33 fstatat64 F
+GLIBC_2.33 lstat F
+GLIBC_2.33 lstat64 F
+GLIBC_2.33 stat F
+GLIBC_2.33 stat64 F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/ia64/bits/stat.h b/sysdeps/unix/sysv/linux/ia64/bits/stat.h
index 608e988ae6..8ec2e4c81f 100644
--- a/sysdeps/unix/sysv/linux/ia64/bits/stat.h
+++ b/sysdeps/unix/sysv/linux/ia64/bits/stat.h
@@ -22,11 +22,6 @@ 
 #ifndef _BITS_STAT_H
 #define _BITS_STAT_H	1
 
-/* Versions of the `struct stat' data structure.  */
-#define _STAT_VER_KERNEL	0
-#define _STAT_VER_LINUX		1
-#define _STAT_VER		_STAT_VER_LINUX
-
 /* Versions of the `xmknod' interface.  */
 #define _MKNOD_VER_LINUX	0
 
diff --git a/sysdeps/unix/sysv/linux/ia64/libc.abilist b/sysdeps/unix/sysv/linux/ia64/libc.abilist
index b6ba86dbe9..beeb905efd 100644
--- a/sysdeps/unix/sysv/linux/ia64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/ia64/libc.abilist
@@ -2095,6 +2095,14 @@  GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 fstat F
+GLIBC_2.33 fstat64 F
+GLIBC_2.33 fstatat F
+GLIBC_2.33 fstatat64 F
+GLIBC_2.33 lstat F
+GLIBC_2.33 lstat64 F
+GLIBC_2.33 stat F
+GLIBC_2.33 stat64 F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/ia64/xstatver.h b/sysdeps/unix/sysv/linux/ia64/xstatver.h
new file mode 100644
index 0000000000..4f02f697ad
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/ia64/xstatver.h
@@ -0,0 +1,5 @@ 
+/* Versions of the 'struct stat' data structure used in compatibility xstat
+   functions.  */
+#define _STAT_VER_KERNEL	0
+#define _STAT_VER_LINUX		1
+#define _STAT_VER		_STAT_VER_LINUX
diff --git a/sysdeps/unix/sysv/linux/m68k/bits/stat.h b/sysdeps/unix/sysv/linux/m68k/bits/stat.h
index 453dcac709..bf41776e6c 100644
--- a/sysdeps/unix/sysv/linux/m68k/bits/stat.h
+++ b/sysdeps/unix/sysv/linux/m68k/bits/stat.h
@@ -22,13 +22,6 @@ 
 #ifndef _BITS_STAT_H
 #define _BITS_STAT_H	1
 
-/* Versions of the `struct stat' data structure.  */
-#define _STAT_VER_LINUX_OLD	1
-#define _STAT_VER_KERNEL	1
-#define _STAT_VER_SVR4		2
-#define _STAT_VER_LINUX		3
-#define _STAT_VER		_STAT_VER_LINUX	/* The one defined below.  */
-
 /* Versions of the `xmknod' interface.  */
 #define _MKNOD_VER_LINUX	1
 #define _MKNOD_VER_SVR4		2
diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
index 2d726097ca..ed34e1fc82 100644
--- a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
@@ -2175,6 +2175,14 @@  GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 fstat F
+GLIBC_2.33 fstat64 F
+GLIBC_2.33 fstatat F
+GLIBC_2.33 fstatat64 F
+GLIBC_2.33 lstat F
+GLIBC_2.33 lstat64 F
+GLIBC_2.33 stat F
+GLIBC_2.33 stat64 F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/m68k/xstatver.h b/sysdeps/unix/sysv/linux/m68k/xstatver.h
new file mode 100644
index 0000000000..59dba71dd1
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/xstatver.h
@@ -0,0 +1,7 @@ 
+/* Versions of the 'struct stat' data structure used in compatibility xstat
+   functions.  */
+#define _STAT_VER_LINUX_OLD	1
+#define _STAT_VER_KERNEL	1
+#define _STAT_VER_SVR4		2
+#define _STAT_VER_LINUX		3
+#define _STAT_VER		_STAT_VER_LINUX
diff --git a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
index 7c78649e03..e00f5115b2 100644
--- a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
@@ -2155,3 +2155,11 @@  GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 fstat F
+GLIBC_2.33 fstat64 F
+GLIBC_2.33 fstatat F
+GLIBC_2.33 fstatat64 F
+GLIBC_2.33 lstat F
+GLIBC_2.33 lstat64 F
+GLIBC_2.33 stat F
+GLIBC_2.33 stat64 F
diff --git a/sysdeps/unix/sysv/linux/microblaze/bits/stat.h b/sysdeps/unix/sysv/linux/microblaze/bits/stat.h
index c5817e5b77..51316a8c1b 100644
--- a/sysdeps/unix/sysv/linux/microblaze/bits/stat.h
+++ b/sysdeps/unix/sysv/linux/microblaze/bits/stat.h
@@ -23,13 +23,6 @@ 
 #ifndef _BITS_STAT_H
 #define _BITS_STAT_H	1
 
-/* Versions of the `struct stat' data structure.  */
-#define _STAT_VER_LINUX_OLD    1
-#define _STAT_VER_KERNEL       1
-#define _STAT_VER_SVR4         2
-#define _STAT_VER_LINUX        3
-#define _STAT_VER              _STAT_VER_LINUX  /* The one defined below.  */
-
 /* Versions of the `xmknod' interface.  */
 #define _MKNOD_VER_LINUX       1
 #define _MKNOD_VER_SVR4        2
diff --git a/sysdeps/unix/sysv/linux/microblaze/xstatver.h b/sysdeps/unix/sysv/linux/microblaze/xstatver.h
new file mode 100644
index 0000000000..bddaa0d5ec
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/microblaze/xstatver.h
@@ -0,0 +1,7 @@ 
+/* Versions of the 'struct stat' data structure used in compatibility xstat
+   functions.  */
+#define _STAT_VER_LINUX_OLD    1
+#define _STAT_VER_KERNEL       1
+#define _STAT_VER_SVR4         2
+#define _STAT_VER_LINUX        3
+#define _STAT_VER              _STAT_VER_LINUX  /* The one defined below.  */
diff --git a/sysdeps/unix/sysv/linux/mips/bits/stat.h b/sysdeps/unix/sysv/linux/mips/bits/stat.h
index b0e6726655..cfeb4ce6a4 100644
--- a/sysdeps/unix/sysv/linux/mips/bits/stat.h
+++ b/sysdeps/unix/sysv/linux/mips/bits/stat.h
@@ -24,13 +24,6 @@ 
 
 #include <sgidefs.h>
 
-/* Versions of the `struct stat' data structure.  */
-#define _STAT_VER_LINUX_OLD	1
-#define _STAT_VER_KERNEL	1
-#define _STAT_VER_SVR4		2
-#define _STAT_VER_LINUX		3
-#define _STAT_VER		_STAT_VER_LINUX /* The one defined below.  */
-
 /* Versions of the `xmknod' interface.  */
 #define _MKNOD_VER_LINUX	1
 #define _MKNOD_VER_SVR4		2
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
index 9fa655b3a5..fe9ba4e982 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
@@ -2146,6 +2146,14 @@  GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 fstat F
+GLIBC_2.33 fstat64 F
+GLIBC_2.33 fstatat F
+GLIBC_2.33 fstatat64 F
+GLIBC_2.33 lstat F
+GLIBC_2.33 lstat64 F
+GLIBC_2.33 stat F
+GLIBC_2.33 stat64 F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
index de990933cf..e67591e710 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
@@ -2152,6 +2152,14 @@  GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 fstat F
+GLIBC_2.33 fstat64 F
+GLIBC_2.33 fstatat F
+GLIBC_2.33 fstatat64 F
+GLIBC_2.33 lstat F
+GLIBC_2.33 lstat64 F
+GLIBC_2.33 stat F
+GLIBC_2.33 stat64 F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
index 754491f209..e4eb9e6bbf 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
@@ -2146,6 +2146,14 @@  GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 fstat F
+GLIBC_2.33 fstat64 F
+GLIBC_2.33 fstatat F
+GLIBC_2.33 fstatat64 F
+GLIBC_2.33 lstat F
+GLIBC_2.33 lstat64 F
+GLIBC_2.33 stat F
+GLIBC_2.33 stat64 F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/mips/xstatver.h b/sysdeps/unix/sysv/linux/mips/xstatver.h
new file mode 100644
index 0000000000..59dba71dd1
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/xstatver.h
@@ -0,0 +1,7 @@ 
+/* Versions of the 'struct stat' data structure used in compatibility xstat
+   functions.  */
+#define _STAT_VER_LINUX_OLD	1
+#define _STAT_VER_KERNEL	1
+#define _STAT_VER_SVR4		2
+#define _STAT_VER_LINUX		3
+#define _STAT_VER		_STAT_VER_LINUX
diff --git a/sysdeps/unix/sysv/linux/nios2/libc.abilist b/sysdeps/unix/sysv/linux/nios2/libc.abilist
index 36a875115c..0878998441 100644
--- a/sysdeps/unix/sysv/linux/nios2/libc.abilist
+++ b/sysdeps/unix/sysv/linux/nios2/libc.abilist
@@ -2193,3 +2193,11 @@  GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 fstat F
+GLIBC_2.33 fstat64 F
+GLIBC_2.33 fstatat F
+GLIBC_2.33 fstatat64 F
+GLIBC_2.33 lstat F
+GLIBC_2.33 lstat64 F
+GLIBC_2.33 stat F
+GLIBC_2.33 stat64 F
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/stat.h b/sysdeps/unix/sysv/linux/powerpc/bits/stat.h
index 61781bd902..40ea9a96d4 100644
--- a/sysdeps/unix/sysv/linux/powerpc/bits/stat.h
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/stat.h
@@ -24,17 +24,6 @@ 
 
 #include <bits/wordsize.h>
 
-/* Versions of the `struct stat' data structure.  */
-#define _STAT_VER_LINUX_OLD	1
-#define _STAT_VER_KERNEL	1
-#define _STAT_VER_SVR4		2
-#define _STAT_VER_LINUX	  3
-#if __WORDSIZE == 32
-# define _STAT_VER		_STAT_VER_LINUX
-#else
-# define _STAT_VER		_STAT_VER_KERNEL
-#endif
-
 /* Versions of the `xmknod' interface.  */
 #define _MKNOD_VER_LINUX	1
 #define _MKNOD_VER_SVR4		2
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
index 6de9bed51d..993c957e8e 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
@@ -2202,6 +2202,14 @@  GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 fstat F
+GLIBC_2.33 fstat64 F
+GLIBC_2.33 fstatat F
+GLIBC_2.33 fstatat64 F
+GLIBC_2.33 lstat F
+GLIBC_2.33 lstat64 F
+GLIBC_2.33 stat F
+GLIBC_2.33 stat64 F
 GLIBC_2.4 _IO_fprintf F
 GLIBC_2.4 _IO_printf F
 GLIBC_2.4 _IO_sprintf F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
index 92114806ac..25a8e828e9 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
@@ -2065,6 +2065,14 @@  GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 fstat F
+GLIBC_2.33 fstat64 F
+GLIBC_2.33 fstatat F
+GLIBC_2.33 fstatat64 F
+GLIBC_2.33 lstat F
+GLIBC_2.33 lstat64 F
+GLIBC_2.33 stat F
+GLIBC_2.33 stat64 F
 GLIBC_2.4 _IO_fprintf F
 GLIBC_2.4 _IO_printf F
 GLIBC_2.4 _IO_sprintf F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
index b01fdcfae1..46ae28e552 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
@@ -2355,3 +2355,11 @@  GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 fstat F
+GLIBC_2.33 fstat64 F
+GLIBC_2.33 fstatat F
+GLIBC_2.33 fstatat64 F
+GLIBC_2.33 lstat F
+GLIBC_2.33 lstat64 F
+GLIBC_2.33 stat F
+GLIBC_2.33 stat64 F
diff --git a/sysdeps/unix/sysv/linux/powerpc/xstatver.h b/sysdeps/unix/sysv/linux/powerpc/xstatver.h
new file mode 100644
index 0000000000..1656e2f7e4
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/xstatver.h
@@ -0,0 +1,11 @@ 
+/* Versions of the 'struct stat' data structure used in compatibility xstat
+   functions.  */
+#define _STAT_VER_LINUX_OLD	1
+#define _STAT_VER_KERNEL	1
+#define _STAT_VER_SVR4		2
+#define _STAT_VER_LINUX	  3
+#if __WORDSIZE == 32
+# define _STAT_VER		_STAT_VER_LINUX
+#else
+# define _STAT_VER		_STAT_VER_KERNEL
+#endif
diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
index 45cbeb1d98..1044aa6be2 100644
--- a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
@@ -2122,3 +2122,11 @@  GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 fstat F
+GLIBC_2.33 fstat64 F
+GLIBC_2.33 fstatat F
+GLIBC_2.33 fstatat64 F
+GLIBC_2.33 lstat F
+GLIBC_2.33 lstat64 F
+GLIBC_2.33 stat F
+GLIBC_2.33 stat64 F
diff --git a/sysdeps/unix/sysv/linux/s390/bits/stat.h b/sysdeps/unix/sysv/linux/s390/bits/stat.h
index b383a98692..d12055529a 100644
--- a/sysdeps/unix/sysv/linux/s390/bits/stat.h
+++ b/sysdeps/unix/sysv/linux/s390/bits/stat.h
@@ -25,21 +25,9 @@ 
 #include <bits/wordsize.h>
 
 #if __WORDSIZE == 64
-/* Versions of the `struct stat' data structure.  */
-# define _STAT_VER_KERNEL	0
-# define _STAT_VER_LINUX	1
-# define _STAT_VER		_STAT_VER_LINUX
-
 /* Versions of the `xmknod' interface.	*/
 #define _MKNOD_VER_LINUX	0
 #else
-/* Versions of the `struct stat' data structure.  */
-# define _STAT_VER_LINUX_OLD	1
-# define _STAT_VER_KERNEL	1
-# define _STAT_VER_SVR4		2
-# define _STAT_VER_LINUX	3
-# define _STAT_VER		_STAT_VER_LINUX
-
 /* Versions of the `xmknod' interface.  */
 # define _MKNOD_VER_LINUX	1
 # define _MKNOD_VER_SVR4	2
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
index d0752dba6c..6b1fa7e67f 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
@@ -2200,6 +2200,14 @@  GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 fstat F
+GLIBC_2.33 fstat64 F
+GLIBC_2.33 fstatat F
+GLIBC_2.33 fstatat64 F
+GLIBC_2.33 lstat F
+GLIBC_2.33 lstat64 F
+GLIBC_2.33 stat F
+GLIBC_2.33 stat64 F
 GLIBC_2.4 _IO_fprintf F
 GLIBC_2.4 _IO_printf F
 GLIBC_2.4 _IO_sprintf F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
index af5f14d1c6..0aec094e7b 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
@@ -2101,6 +2101,14 @@  GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 fstat F
+GLIBC_2.33 fstat64 F
+GLIBC_2.33 fstatat F
+GLIBC_2.33 fstatat64 F
+GLIBC_2.33 lstat F
+GLIBC_2.33 lstat64 F
+GLIBC_2.33 stat F
+GLIBC_2.33 stat64 F
 GLIBC_2.4 _IO_fprintf F
 GLIBC_2.4 _IO_printf F
 GLIBC_2.4 _IO_sprintf F
diff --git a/sysdeps/unix/sysv/linux/s390/xstatver.h b/sysdeps/unix/sysv/linux/s390/xstatver.h
new file mode 100644
index 0000000000..5ad0db2797
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/xstatver.h
@@ -0,0 +1,16 @@ 
+/* Versions of the 'struct stat' data structure used in compatibility xstat
+   functions.  */
+
+#include <bits/wordsize.h>
+
+#if __WORDSIZE == 64
+# define _STAT_VER_KERNEL	0
+# define _STAT_VER_LINUX	1
+# define _STAT_VER		_STAT_VER_LINUX
+#else
+# define _STAT_VER_LINUX_OLD	1
+# define _STAT_VER_KERNEL	1
+# define _STAT_VER_SVR4		2
+# define _STAT_VER_LINUX	3
+# define _STAT_VER		_STAT_VER_LINUX
+#endif
diff --git a/sysdeps/unix/sysv/linux/sh/le/libc.abilist b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
index 182970a708..e2ae13d4fa 100644
--- a/sysdeps/unix/sysv/linux/sh/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
@@ -2067,6 +2067,14 @@  GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 fstat F
+GLIBC_2.33 fstat64 F
+GLIBC_2.33 fstatat F
+GLIBC_2.33 fstatat64 F
+GLIBC_2.33 lstat F
+GLIBC_2.33 lstat64 F
+GLIBC_2.33 stat F
+GLIBC_2.33 stat64 F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/stat.h b/sysdeps/unix/sysv/linux/sparc/bits/stat.h
index 7379f2232d..7af17b5c40 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/stat.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/stat.h
@@ -22,13 +22,6 @@ 
 #ifndef _BITS_STAT_H
 #define _BITS_STAT_H	1
 
-/* Versions of the `struct stat' data structure.  */
-#define _STAT_VER_LINUX_OLD	1
-#define _STAT_VER_KERNEL	1
-#define _STAT_VER_SVR4		2
-#define _STAT_VER_LINUX		3
-#define _STAT_VER		_STAT_VER_LINUX	/* The one defined below.  */
-
 /* Versions of the `xmknod' interface.  */
 #define _MKNOD_VER_LINUX	1
 #define _MKNOD_VER_SVR4		2
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
index a2521c3ee3..886e01960f 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
@@ -2191,6 +2191,14 @@  GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 fstat F
+GLIBC_2.33 fstat64 F
+GLIBC_2.33 fstatat F
+GLIBC_2.33 fstatat64 F
+GLIBC_2.33 lstat F
+GLIBC_2.33 lstat64 F
+GLIBC_2.33 stat F
+GLIBC_2.33 stat64 F
 GLIBC_2.4 _IO_fprintf F
 GLIBC_2.4 _IO_printf F
 GLIBC_2.4 _IO_sprintf F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
index d8188903f9..33b068201a 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
@@ -2118,6 +2118,14 @@  GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 fstat F
+GLIBC_2.33 fstat64 F
+GLIBC_2.33 fstatat F
+GLIBC_2.33 fstatat64 F
+GLIBC_2.33 lstat F
+GLIBC_2.33 lstat64 F
+GLIBC_2.33 stat F
+GLIBC_2.33 stat64 F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/sparc/xstatver.h b/sysdeps/unix/sysv/linux/sparc/xstatver.h
new file mode 100644
index 0000000000..ae92b530e7
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/xstatver.h
@@ -0,0 +1,7 @@ 
+/* Versions of the 'struct stat' data structure used in compatibility xstat
+   functions.  */
+#define _STAT_VER_LINUX_OLD	1
+#define _STAT_VER_KERNEL	1
+#define _STAT_VER_SVR4		2
+#define _STAT_VER_LINUX		3
+#define _STAT_VER		_STAT_VER_LINUX	/* The one defined below.  */
diff --git a/sysdeps/unix/sysv/linux/x86/bits/stat.h b/sysdeps/unix/sysv/linux/x86/bits/stat.h
index 25dec69dda..f132569e9d 100644
--- a/sysdeps/unix/sysv/linux/x86/bits/stat.h
+++ b/sysdeps/unix/sysv/linux/x86/bits/stat.h
@@ -24,25 +24,15 @@ 
 
 /* Versions of the `struct stat' data structure.  */
 #ifndef __x86_64__
-# define _STAT_VER_LINUX_OLD	1
-# define _STAT_VER_KERNEL	1
-# define _STAT_VER_SVR4		2
-# define _STAT_VER_LINUX	3
-
 /* i386 versions of the `xmknod' interface.  */
 # define _MKNOD_VER_LINUX	1
 # define _MKNOD_VER_SVR4	2
 # define _MKNOD_VER		_MKNOD_VER_LINUX /* The bits defined below.  */
 #else
-# define _STAT_VER_KERNEL	0
-# define _STAT_VER_LINUX	1
-
 /* x86-64 versions of the `xmknod' interface.  */
 # define _MKNOD_VER_LINUX	0
 #endif
 
-#define _STAT_VER		_STAT_VER_LINUX
-
 struct stat
   {
     __dev_t st_dev;		/* Device.  */
diff --git a/sysdeps/unix/sysv/linux/x86/xstatver.h b/sysdeps/unix/sysv/linux/x86/xstatver.h
new file mode 100644
index 0000000000..6f047a346d
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86/xstatver.h
@@ -0,0 +1,13 @@ 
+/* Versions of the 'struct stat' data structure used in compatibility xstat
+   functions.  */
+#ifndef __x86_64__
+# define _STAT_VER_LINUX_OLD	1
+# define _STAT_VER_KERNEL	1
+# define _STAT_VER_SVR4		2
+# define _STAT_VER_LINUX	3
+#else
+# define _STAT_VER_KERNEL	0
+# define _STAT_VER_LINUX	1
+#endif
+#define _STAT_VER		_STAT_VER_LINUX
+
diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
index 1a96103c68..f767bdde24 100644
--- a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
@@ -2076,6 +2076,14 @@  GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 fstat F
+GLIBC_2.33 fstat64 F
+GLIBC_2.33 fstatat F
+GLIBC_2.33 fstatat64 F
+GLIBC_2.33 lstat F
+GLIBC_2.33 lstat64 F
+GLIBC_2.33 stat F
+GLIBC_2.33 stat64 F
 GLIBC_2.4 __confstr_chk F
 GLIBC_2.4 __fgets_chk F
 GLIBC_2.4 __fgets_unlocked_chk F
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
index 35745a75b6..535862a51e 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
@@ -2173,3 +2173,11 @@  GLIBC_2.32 sigabbrev_np F
 GLIBC_2.32 sigdescr_np F
 GLIBC_2.32 strerrordesc_np F
 GLIBC_2.32 strerrorname_np F
+GLIBC_2.33 fstat F
+GLIBC_2.33 fstat64 F
+GLIBC_2.33 fstatat F
+GLIBC_2.33 fstatat64 F
+GLIBC_2.33 lstat F
+GLIBC_2.33 lstat64 F
+GLIBC_2.33 stat F
+GLIBC_2.33 stat64 F
diff --git a/sysdeps/unix/sysv/linux/xstatver.h b/sysdeps/unix/sysv/linux/xstatver.h
new file mode 100644
index 0000000000..59dba71dd1
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/xstatver.h
@@ -0,0 +1,7 @@ 
+/* Versions of the 'struct stat' data structure used in compatibility xstat
+   functions.  */
+#define _STAT_VER_LINUX_OLD	1
+#define _STAT_VER_KERNEL	1
+#define _STAT_VER_SVR4		2
+#define _STAT_VER_LINUX		3
+#define _STAT_VER		_STAT_VER_LINUX