Patchwork [08/12] Use clock_gettime to implement gettimeofday.

login
register
mail settings
Submitter Zack Weinberg
Date Aug. 20, 2019, 1:21 p.m.
Message ID <20190820132152.24100-9-zackw@panix.com>
Download mbox | patch
Permalink /patch/34193/
State New
Headers show

Comments

Zack Weinberg - Aug. 20, 2019, 1:21 p.m.
Abstractly, this is the same change as using clock_gettime to
implement time, but the vestigial “get time zone” feature of
gettimeofday complicates matters a little.  Unlike settimeofday, there
are *no* known uses of this feature that are not bugs, so it is simply
dummied out.  (The per-process timezone support in ‘localtime’ and
friends is unrelated, and the programs that set the kernel’s offset
between the hardware clock and UTC do not need to read it back.)

Henceforth, if gettimeofday’s ‘struct timezone’ argument is not NULL,
it will write zeroes to both fields.  Any program that is actually
looking at this data will thus think it is running in UTC, which is
probably more correct than whatever it was doing before.

Hurd having already been converted, this patch only affects Linux and
hypothetical future ports.  Most Linux ports supplied a vDSO symbol
for gettimeofday, and some wrapped that with an ifunc, so this patch
deletes a lot of code.  For ease of future edits to the many copies of
_libc_vdso_platform_setup, the variable ‘p’ in each is now declared
separately from any use of it.

As with settimeofday, the alpha-linux-gnu configuration has two
versions, GLIBC_2.0 and GLIBC_2.1, with the older symbol using 32-bit
time_t (yes, really) and the same solution is implemented here.

__gettimeofday is no longer called by anyone, so remove its internal
prototype and its entries in Versions and .abilist files.  (It would
have been a GLIBC_PRIVATE symbol if the GLIBC_PRIVATE convention had
been invented back in the days of 2.0.)

	* time/gettimeofday.c: No longer a stub implementation.
	Call __clock_gettime.  If ‘tz’ argument is not NULL, clear the
	object it points to.  Remove libc_hidden_def for __gettimeofday
	and libc_hidden_weak for gettimeofday.  Optionally override the
	default symbol version for gettimeofday.
	* include/sys/time.h: Remove internal prototype and libc_hidden_proto
        for __gettimeofday, and libc_hidden_proto for gettimeofday.
	* time/Versions
	* sysdeps/unix/sysv/linux/alpha/Versions
	* sysdeps/**/libc.abilist: Remove entry for __gettimeofday.

	* sysdeps/unix/sysv/linux/aarch64/init-first.c
	* sysdeps/unix/sysv/linux/arm/init-first.c
	* sysdeps/unix/sysv/linux/mips/init-first.c
	* sysdeps/unix/sysv/linux/powerpc/init-first.c
	* sysdeps/unix/sysv/linux/riscv/init-first.c
	* sysdeps/unix/sysv/linux/s390/init-first.c
	* sysdeps/unix/sysv/linux/sparc/init-first.c:
	Do not define nor initialize VDSO_SYMBOL(gettimeofday).

	* sysdeps/unix/sysv/linux/aarch64/libc-vdso.h
	* sysdeps/unix/sysv/linux/arm/libc-vdso.h
	* sysdeps/unix/sysv/linux/mips/libc-vdso.h
	* sysdeps/unix/sysv/linux/powerpc/libc-vdso.h
	* sysdeps/unix/sysv/linux/riscv/libc-vdso.h
	* sysdeps/unix/sysv/linux/s390/libc-vdso.h
	* sysdeps/unix/sysv/linux/sparc/libc-vdso.h:
	Do not declare VDSO_SYMBOL(gettimeofday).

	* sysdeps/unix/syscalls.list: Remove entry for gettimeofday.
	* sysdeps/unix/sysv/linux/alpha/syscalls.list:
	Remove entries for gettimeofday and osf_gettimeofday.
	* sysdeps/unix/sysv/linux/x86_64/x32/syscalls.list:
	Remove entry for gettimeofday.

	* sysdeps/posix/gettimeofday.c
	* sysdeps/unix/sysv/linux/aarch64/gettimeofday.c
	* sysdeps/unix/sysv/linux/gettimeofday.c
	* sysdeps/unix/sysv/linux/i386/gettimeofday.c
	* sysdeps/unix/sysv/linux/powerpc/gettimeofday.c
	* sysdeps/unix/sysv/linux/x86/gettimeofday.c: Delete file.

	* sysdeps/unix/sysv/linux/alpha/osf_gettimeofday.c:
	New file, defines gettimeofday@GLIBC_2.0.
	* sysdeps/unix/sysv/linux/alpha/gettimeofday.c
	New file, defines gettimeofday@@GLIBC_2.1.

	* sysdeps/unix/make-syscalls.sh: Change an example in a comment
	from referring to gettimeofday, to referring to sigaction.
---
 include/sys/time.h                            |  4 -
 sysdeps/mach/hurd/i386/libc.abilist           |  1 -
 sysdeps/posix/gettimeofday.c                  | 67 ---------------
 sysdeps/unix/make-syscalls.sh                 |  2 +-
 sysdeps/unix/syscalls.list                    |  1 -
 .../unix/sysv/linux/aarch64/gettimeofday.c    | 71 ----------------
 sysdeps/unix/sysv/linux/aarch64/init-first.c  |  7 +-
 sysdeps/unix/sysv/linux/aarch64/libc-vdso.h   |  2 -
 sysdeps/unix/sysv/linux/aarch64/libc.abilist  |  1 -
 sysdeps/unix/sysv/linux/alpha/Versions        |  1 -
 .../sysv/linux/{i386 => alpha}/gettimeofday.c | 25 ++----
 sysdeps/unix/sysv/linux/alpha/libc.abilist    |  2 -
 .../unix/sysv/linux/alpha/osf_gettimeofday.c  | 66 ++++++++++++++
 sysdeps/unix/sysv/linux/alpha/syscalls.list   |  2 -
 sysdeps/unix/sysv/linux/arm/init-first.c      |  7 +-
 sysdeps/unix/sysv/linux/arm/libc-vdso.h       |  2 -
 sysdeps/unix/sysv/linux/arm/libc.abilist      |  1 -
 sysdeps/unix/sysv/linux/csky/libc.abilist     |  1 -
 sysdeps/unix/sysv/linux/gettimeofday.c        | 39 ---------
 sysdeps/unix/sysv/linux/hppa/libc.abilist     |  1 -
 sysdeps/unix/sysv/linux/i386/libc.abilist     |  1 -
 sysdeps/unix/sysv/linux/ia64/libc.abilist     |  1 -
 .../sysv/linux/m68k/coldfire/libc.abilist     |  1 -
 .../unix/sysv/linux/m68k/m680x0/libc.abilist  |  1 -
 .../unix/sysv/linux/microblaze/libc.abilist   |  1 -
 sysdeps/unix/sysv/linux/mips/init-first.c     |  7 +-
 sysdeps/unix/sysv/linux/mips/libc-vdso.h      |  2 -
 .../sysv/linux/mips/mips32/fpu/libc.abilist   |  1 -
 .../sysv/linux/mips/mips32/nofpu/libc.abilist |  1 -
 .../sysv/linux/mips/mips64/n32/libc.abilist   |  1 -
 .../sysv/linux/mips/mips64/n64/libc.abilist   |  1 -
 sysdeps/unix/sysv/linux/nios2/libc.abilist    |  1 -
 .../unix/sysv/linux/powerpc/gettimeofday.c    | 85 -------------------
 sysdeps/unix/sysv/linux/powerpc/init-first.c  |  8 +-
 sysdeps/unix/sysv/linux/powerpc/libc-vdso.h   |  2 -
 .../linux/powerpc/powerpc32/fpu/libc.abilist  |  1 -
 .../powerpc/powerpc32/nofpu/libc.abilist      |  1 -
 .../linux/powerpc/powerpc64/be/libc.abilist   |  1 -
 .../linux/powerpc/powerpc64/le/libc.abilist   |  1 -
 sysdeps/unix/sysv/linux/riscv/init-first.c    | 10 +--
 sysdeps/unix/sysv/linux/riscv/libc-vdso.h     |  2 -
 .../unix/sysv/linux/riscv/rv64/libc.abilist   |  1 -
 sysdeps/unix/sysv/linux/s390/init-first.c     |  9 +-
 sysdeps/unix/sysv/linux/s390/libc-vdso.h      |  3 -
 .../unix/sysv/linux/s390/s390-32/libc.abilist |  1 -
 .../unix/sysv/linux/s390/s390-64/libc.abilist |  1 -
 sysdeps/unix/sysv/linux/sh/libc.abilist       |  1 -
 sysdeps/unix/sysv/linux/sparc/init-first.c    |  8 +-
 sysdeps/unix/sysv/linux/sparc/libc-vdso.h     |  2 -
 .../sysv/linux/sparc/sparc32/libc.abilist     |  1 -
 .../sysv/linux/sparc/sparc64/libc.abilist     |  1 -
 sysdeps/unix/sysv/linux/x86/gettimeofday.c    | 61 -------------
 .../unix/sysv/linux/x86_64/64/libc.abilist    |  1 -
 .../unix/sysv/linux/x86_64/x32/libc.abilist   |  1 -
 .../unix/sysv/linux/x86_64/x32/syscalls.list  |  1 -
 time/Versions                                 |  2 +-
 time/gettimeofday.c                           | 28 ++++--
 57 files changed, 108 insertions(+), 447 deletions(-)
 delete mode 100644 sysdeps/posix/gettimeofday.c
 delete mode 100644 sysdeps/unix/sysv/linux/aarch64/gettimeofday.c
 rename sysdeps/unix/sysv/linux/{i386 => alpha}/gettimeofday.c (58%)
 create mode 100644 sysdeps/unix/sysv/linux/alpha/osf_gettimeofday.c
 delete mode 100644 sysdeps/unix/sysv/linux/gettimeofday.c
 delete mode 100644 sysdeps/unix/sysv/linux/powerpc/gettimeofday.c
 delete mode 100644 sysdeps/unix/sysv/linux/x86/gettimeofday.c
Joseph Myers - Aug. 20, 2019, 3:24 p.m.
On Tue, 20 Aug 2019, Zack Weinberg wrote:

> __gettimeofday is no longer called by anyone, so remove its internal
> prototype and its entries in Versions and .abilist files.  (It would
> have been a GLIBC_PRIVATE symbol if the GLIBC_PRIVATE convention had
> been invented back in the days of 2.0.)

That's not obviously safe.  The choice of which internal symbols to move 
to GLIBC_PRIVATE when GLIBC_PRIVATE was introduced

2002-02-01  Jakub Jelinek  <jakub@redhat.com>

        * Versions.def (libc): Add GLIBC_PRIVATE.
        [...]

was clearly a deliberate choice (as was the choice of which symbols in 
glibc 2.0 not to export at a public symbol version when symbol versioning 
was introduced in 2.1).  __gettimeofday is certainly the kind of symbol 
that could have been used by a library with its own namespace concerns 
(cf. past discussions of how we might enable libstdc++ to be 
namespace-clean), although maybe more likely to have been used by an 
application that should be using gettimeofday.

Perhaps someone set up to do so could check large sets of current and past 
distribution binaries for any reference to the __gettimeofday symbol in 
executable / shared library dynamic symbol tables, as evidence for whether 
such an ABI change is safe or not?
Adhemerval Zanella Netto - Aug. 20, 2019, 5:51 p.m.
On 20/08/2019 10:21, Zack Weinberg wrote:
> Abstractly, this is the same change as using clock_gettime to
> implement time, but the vestigial “get time zone” feature of
> gettimeofday complicates matters a little.  Unlike settimeofday, there
> are *no* known uses of this feature that are not bugs, so it is simply
> dummied out.  (The per-process timezone support in ‘localtime’ and
> friends is unrelated, and the programs that set the kernel’s offset
> between the hardware clock and UTC do not need to read it back.)
> 
> Henceforth, if gettimeofday’s ‘struct timezone’ argument is not NULL,
> it will write zeroes to both fields.  Any program that is actually
> looking at this data will thus think it is running in UTC, which is
> probably more correct than whatever it was doing before.
> 
> Hurd having already been converted, this patch only affects Linux and
> hypothetical future ports.  Most Linux ports supplied a vDSO symbol
> for gettimeofday, and some wrapped that with an ifunc, so this patch
> deletes a lot of code.  For ease of future edits to the many copies of
> _libc_vdso_platform_setup, the variable ‘p’ in each is now declared
> separately from any use of it.

I personally would prefer to make gettimeofday implementation use 
clock_gettime internally regardless, it has the clear code simplification 
advantage, and it allows an architecture provide only clock_gettime as vDSO 
to optimize all get time related functions.

However some architecture does implement it with vDSO as latency optimization
and I think we should consult with arch maintainers to see if this change is 
indeed acceptable. 

On my vDSO refactor for gettimeofday [1], I tried to keep current code
as is and the fallback code is still calling __NR_gettimeofday (since
all current architectures support the syscall).

[1] https://sourceware.org/ml/libc-alpha/2019-07/msg00158.html
Zack Weinberg - Aug. 22, 2019, 1:01 p.m.
On 8/20/19 11:24 AM, Joseph Myers wrote:
> On Tue, 20 Aug 2019, Zack Weinberg wrote:
> 
>> __gettimeofday is no longer called by anyone, so remove its internal
>> prototype and its entries in Versions and .abilist files.  (It would
>> have been a GLIBC_PRIVATE symbol if the GLIBC_PRIVATE convention had
>> been invented back in the days of 2.0.)
> 
> That's not obviously safe. ... __gettimeofday is certainly the kind of symbol 
> that could have been used by a library with its own namespace concerns 
> (cf. past discussions of how we might enable libstdc++ to be 
> namespace-clean), although maybe more likely to have been used by an 
> application that should be using gettimeofday.

Ugh, OK, I'll put it back in the Versions file.

> Perhaps someone set up to do so could check large sets of current and past 
> distribution binaries for any reference to the __gettimeofday symbol in 
> executable / shared library dynamic symbol tables, as evidence for whether 
> such an ABI change is safe or not?

I don't think this is important enough to go to that much trouble.

zw
arnd@arndb.de - Aug. 27, 2019, 2:33 p.m.
On Thu, Aug 22, 2019 at 3:01 PM Zack Weinberg <zackw@panix.com> wrote:
>
> On 8/20/19 11:24 AM, Joseph Myers wrote:
> > On Tue, 20 Aug 2019, Zack Weinberg wrote:
> >
> >> __gettimeofday is no longer called by anyone, so remove its internal
> >> prototype and its entries in Versions and .abilist files.  (It would
> >> have been a GLIBC_PRIVATE symbol if the GLIBC_PRIVATE convention had
> >> been invented back in the days of 2.0.)
> >
> > That's not obviously safe. ... __gettimeofday is certainly the kind of symbol
> > that could have been used by a library with its own namespace concerns
> > (cf. past discussions of how we might enable libstdc++ to be
> > namespace-clean), although maybe more likely to have been used by an
> > application that should be using gettimeofday.
>
> Ugh, OK, I'll put it back in the Versions file.
>
> > Perhaps someone set up to do so could check large sets of current and past
> > distribution binaries for any reference to the __gettimeofday symbol in
> > executable / shared library dynamic symbol tables, as evidence for whether
> > such an ABI change is safe or not?
>
> I don't think this is important enough to go to that much trouble.

I had a quick look at debian code search and found a few hundred
copies of the glibc tempname.c:
https://codesearch.debian.net/show?file=parted_3.2-25%2Flib%2Ftempname.c&line=67

Then there are a few other references like faketime that try to
override gettimeofday in some form:
https://codesearch.debian.net/show?file=faketime_0.9.7-3%2Fsrc%2Flibfaketime.c&line=1679
https://codesearch.debian.net/show?file=datefudge_1.23%2Fdatefudge.c&line=69
https://codesearch.debian.net/show?file=cyrus-imapd_3.0.11-1%2Fcunit%2Ftimeofday.c&line=195

       Arnd

Patch

diff --git a/include/sys/time.h b/include/sys/time.h
index a57752e8c7..4a91622096 100644
--- a/include/sys/time.h
+++ b/include/sys/time.h
@@ -20,10 +20,6 @@ 
 # include <time/sys/time.h>
 
 # ifndef _ISOMAC
-extern int __gettimeofday (struct timeval *__tv,
-			   struct timezone *__tz);
-libc_hidden_proto (__gettimeofday)
-libc_hidden_proto (gettimeofday)
 extern int __settimezone (const struct timezone *__tz)
 	attribute_hidden;
 extern int __adjtime (const struct timeval *__delta,
diff --git a/sysdeps/mach/hurd/i386/libc.abilist b/sysdeps/mach/hurd/i386/libc.abilist
index 1fc7ab2433..84345bf3e0 100644
--- a/sysdeps/mach/hurd/i386/libc.abilist
+++ b/sysdeps/mach/hurd/i386/libc.abilist
@@ -272,7 +272,6 @@  GLIBC_2.2.6 __getdelim F
 GLIBC_2.2.6 __getpagesize F
 GLIBC_2.2.6 __getpgid F
 GLIBC_2.2.6 __getpid F
-GLIBC_2.2.6 __gettimeofday F
 GLIBC_2.2.6 __gmtime_r F
 GLIBC_2.2.6 __h_errno_location F
 GLIBC_2.2.6 __hurd_fail F
diff --git a/sysdeps/posix/gettimeofday.c b/sysdeps/posix/gettimeofday.c
deleted file mode 100644
index 6ba625e13e..0000000000
--- a/sysdeps/posix/gettimeofday.c
+++ /dev/null
@@ -1,67 +0,0 @@ 
-/* Copyright (C) 1991-2019 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
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   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
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <errno.h>
-#include <time.h>
-#include <sys/time.h>
-
-/* Get the current time of day and timezone information,
-   putting it into *TV and *TZ.  If TZ is NULL, *TZ is not filled.
-   Returns 0 on success, -1 on errors.  */
-int
-__gettimeofday (struct timeval *tv, struct timezone *tz)
-{
-  if (tv == NULL)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  tv->tv_sec = (long int) time ((time_t *) NULL);
-  tv->tv_usec = 0L;
-
-  if (tz != NULL)
-    {
-      const time_t timer = tv->tv_sec;
-      struct tm tm;
-      const struct tm *tmp;
-
-      const long int save_timezone = __timezone;
-      const long int save_daylight = __daylight;
-      char *save_tzname[2];
-      save_tzname[0] = __tzname[0];
-      save_tzname[1] = __tzname[1];
-
-      tmp = localtime_r (&timer, &tm);
-
-      tz->tz_minuteswest = __timezone / 60;
-      tz->tz_dsttime = __daylight;
-
-      __timezone = save_timezone;
-      __daylight = save_daylight;
-      __tzname[0] = save_tzname[0];
-      __tzname[1] = save_tzname[1];
-
-      if (tmp == NULL)
-	return -1;
-    }
-
-  return 0;
-}
-libc_hidden_def (__gettimeofday)
-weak_alias (__gettimeofday, gettimeofday)
-libc_hidden_weak (gettimeofday)
diff --git a/sysdeps/unix/make-syscalls.sh b/sysdeps/unix/make-syscalls.sh
index 6a5c10d54e..2b8c9ea49c 100644
--- a/sysdeps/unix/make-syscalls.sh
+++ b/sysdeps/unix/make-syscalls.sh
@@ -27,7 +27,7 @@ 
 # n: scalar buffer length (e.g., 3rd arg to read)
 # N: pointer to value/return scalar buffer length (e.g., 6th arg to recvfrom)
 # p: non-NULL pointer to typed object (e.g., any non-void* arg)
-# P: optionally-NULL pointer to typed object (e.g., 2nd argument to gettimeofday)
+# P: optionally-NULL pointer to typed object (e.g., 3rd argument to sigaction)
 # s: non-NULL string (e.g., 1st arg to open)
 # S: optionally-NULL string (e.g., 1st arg to acct)
 # v: vararg scalar (e.g., optional 3rd arg to open)
diff --git a/sysdeps/unix/syscalls.list b/sysdeps/unix/syscalls.list
index 5fedd5733d..e28e801c7a 100644
--- a/sysdeps/unix/syscalls.list
+++ b/sysdeps/unix/syscalls.list
@@ -33,7 +33,6 @@  getrlimit	-	getrlimit	i:ip	__getrlimit	getrlimit
 getrusage	-	getrusage	i:ip	__getrusage	getrusage
 getsockname	-	getsockname	i:ibN	__getsockname	getsockname
 getsockopt	-	getsockopt	i:iiiBN	getsockopt
-gettimeofday	-	gettimeofday	i:pP	__gettimeofday	gettimeofday
 getuid		-	getuid		Ei:	__getuid	getuid
 ioctl		-	ioctl		i:iiI	__ioctl		ioctl
 kill		-	kill		i:ii	__kill		kill
diff --git a/sysdeps/unix/sysv/linux/aarch64/gettimeofday.c b/sysdeps/unix/sysv/linux/aarch64/gettimeofday.c
deleted file mode 100644
index 9180b50bf7..0000000000
--- a/sysdeps/unix/sysv/linux/aarch64/gettimeofday.c
+++ /dev/null
@@ -1,71 +0,0 @@ 
-/* Copyright (C) 2018-2019 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
-   modify it under the terms of the GNU Lesser General Public License as
-   published by the Free Software Foundation; either version 2.1 of the
-   License, or (at your option) any later version.
-
-   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
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-/* Get the current time of day and timezone information,
-   putting it into *tv and *tz.  If tz is null, *tz is not filled.
-   Returns 0 on success, -1 on errors.  */
-
-#ifdef SHARED
-
-# define __gettimeofday __redirect___gettimeofday
-# include <sys/time.h>
-# undef __gettimeofday
-# define HAVE_VSYSCALL
-# include <dl-vdso.h>
-# include <sysdep-vdso.h>
-
-/* Used as a fallback in the ifunc resolver if VDSO is not available
-   and for libc.so internal __gettimeofday calls.  */
-
-static int
-__gettimeofday_vsyscall (struct timeval *tv, struct timezone *tz)
-{
-  return INLINE_VSYSCALL (gettimeofday, 2, tv, tz);
-}
-
-/* PREPARE_VERSION_KNOWN will need an __LP64__ ifdef when ILP32 support
-   goes in.  See _libc_vdso_platform_setup in
-   sysdeps/unix/sysv/linux/aarch64/init-first.c.  */
-
-# undef INIT_ARCH
-# define INIT_ARCH() \
-	   PREPARE_VERSION_KNOWN (linux_version, LINUX_2_6_39); \
-	   void *vdso_gettimeofday = \
-	     _dl_vdso_vsym ("__kernel_gettimeofday", &linux_version);
-
-libc_ifunc_hidden (__redirect___gettimeofday, __gettimeofday,
-		   vdso_gettimeofday ?: (void *) __gettimeofday_vsyscall)
-
-__hidden_ver1 (__gettimeofday_vsyscall, __GI___gettimeofday,
-	       __gettimeofday_vsyscall);
-
-#else
-
-# include <sys/time.h>
-# include <sysdep.h>
-int
-__gettimeofday (struct timeval *tv, struct timezone *tz)
-{
-  return INLINE_SYSCALL (gettimeofday, 2, tv, tz);
-}
-libc_hidden_def (__gettimeofday)
-
-#endif
-
-weak_alias (__gettimeofday, gettimeofday)
-libc_hidden_weak (gettimeofday)
diff --git a/sysdeps/unix/sysv/linux/aarch64/init-first.c b/sysdeps/unix/sysv/linux/aarch64/init-first.c
index 80f7ed91ef..5e4e1fbf8c 100644
--- a/sysdeps/unix/sysv/linux/aarch64/init-first.c
+++ b/sysdeps/unix/sysv/linux/aarch64/init-first.c
@@ -19,23 +19,20 @@ 
 #include <dl-vdso.h>
 #include <libc-vdso.h>
 
-int (*VDSO_SYMBOL(gettimeofday)) (struct timeval *, void *) attribute_hidden;
 int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *);
 int (*VDSO_SYMBOL(clock_getres)) (clockid_t, struct timespec *);
 
 static inline void
 _libc_vdso_platform_setup (void)
 {
+  void *p;
+
 #ifdef __LP64__
   PREPARE_VERSION_KNOWN (linux_version, LINUX_2_6_39);
 #else
   PREPARE_VERSION_KNOWN (linux_version, LINUX_4_9);
 #endif
 
-  void *p = _dl_vdso_vsym ("__kernel_gettimeofday", &linux_version);
-  PTR_MANGLE (p);
-  VDSO_SYMBOL(gettimeofday) = p;
-
   p = _dl_vdso_vsym ("__kernel_clock_gettime", &linux_version);
   PTR_MANGLE (p);
   VDSO_SYMBOL(clock_gettime) = p;
diff --git a/sysdeps/unix/sysv/linux/aarch64/libc-vdso.h b/sysdeps/unix/sysv/linux/aarch64/libc-vdso.h
index 3fcbaa9fce..285ca62fd3 100644
--- a/sysdeps/unix/sysv/linux/aarch64/libc-vdso.h
+++ b/sysdeps/unix/sysv/linux/aarch64/libc-vdso.h
@@ -22,8 +22,6 @@ 
 #include <sysdep.h>
 #include <sysdep-vdso.h>
 
-extern int (*VDSO_SYMBOL(gettimeofday)) (struct timeval *, void *)
-   attribute_hidden;
 extern int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *);
 extern int (*VDSO_SYMBOL(clock_getres)) (clockid_t, struct timespec *);
 
diff --git a/sysdeps/unix/sysv/linux/aarch64/libc.abilist b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
index a4c31932cb..4d24c65074 100644
--- a/sysdeps/unix/sysv/linux/aarch64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
@@ -216,7 +216,6 @@  GLIBC_2.17 __getpagesize F
 GLIBC_2.17 __getpgid F
 GLIBC_2.17 __getpid F
 GLIBC_2.17 __gets_chk F
-GLIBC_2.17 __gettimeofday F
 GLIBC_2.17 __getwd_chk F
 GLIBC_2.17 __gmtime_r F
 GLIBC_2.17 __h_errno_location F
diff --git a/sysdeps/unix/sysv/linux/alpha/Versions b/sysdeps/unix/sysv/linux/alpha/Versions
index 3b7971c2a3..a20d80c2ce 100644
--- a/sysdeps/unix/sysv/linux/alpha/Versions
+++ b/sysdeps/unix/sysv/linux/alpha/Versions
@@ -39,7 +39,6 @@  libc {
     # Linux/Alpha 64-bit timeval functions.
     __select; select;
     adjtime; adjtimex; __adjtimex;
-    __gettimeofday;
 
     # glob interface change
     glob; globfree;
diff --git a/sysdeps/unix/sysv/linux/i386/gettimeofday.c b/sysdeps/unix/sysv/linux/alpha/gettimeofday.c
similarity index 58%
rename from sysdeps/unix/sysv/linux/i386/gettimeofday.c
rename to sysdeps/unix/sysv/linux/alpha/gettimeofday.c
index 185450ece6..46dc778427 100644
--- a/sysdeps/unix/sysv/linux/i386/gettimeofday.c
+++ b/sysdeps/unix/sysv/linux/alpha/gettimeofday.c
@@ -1,5 +1,5 @@ 
-/* gettimeofday - get the time.  Linux/i386 version.
-   Copyright (C) 2015-2019 Free Software Foundation, Inc.
+/* gettimeofday -- Get the current time of day.  Linux/Alpha/tv64 version.
+   Copyright (C) 2019 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
@@ -16,20 +16,7 @@ 
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#ifdef SHARED
-# define __gettimeofday __redirect___gettimeofday
-#endif
-
-#include <sys/time.h>
-
-#ifdef SHARED
-# undef __gettimeofday
-# define __gettimeofday_type __redirect___gettimeofday
-
-# undef libc_hidden_def
-# define libc_hidden_def(name) \
-  __hidden_ver1 (__gettimeofday_syscall, __GI___gettimeofday, \
-	       __gettimeofday_syscall);
-#endif
-
-#include <sysdeps/unix/sysv/linux/x86/gettimeofday.c>
+/* We can use the generic implementation, but we have to override its
+   default symbol version.  */
+#define VERSION_gettimeofday GLIBC_2.1
+#include <time/gettimeofday.c>
diff --git a/sysdeps/unix/sysv/linux/alpha/libc.abilist b/sysdeps/unix/sysv/linux/alpha/libc.abilist
index fe85a35620..3335f3b0f7 100644
--- a/sysdeps/unix/sysv/linux/alpha/libc.abilist
+++ b/sysdeps/unix/sysv/linux/alpha/libc.abilist
@@ -141,7 +141,6 @@  GLIBC_2.0 __getdelim F
 GLIBC_2.0 __getpagesize F
 GLIBC_2.0 __getpgid F
 GLIBC_2.0 __getpid F
-GLIBC_2.0 __gettimeofday F
 GLIBC_2.0 __gmtime_r F
 GLIBC_2.0 __h_errno_location F
 GLIBC_2.0 __ieee_get_fp_control F
@@ -1370,7 +1369,6 @@  GLIBC_2.1 __backtrace_symbols_fd F
 GLIBC_2.1 __duplocale F
 GLIBC_2.1 __freelocale F
 GLIBC_2.1 __fxstat64 F
-GLIBC_2.1 __gettimeofday F
 GLIBC_2.1 __isalnum_l F
 GLIBC_2.1 __isalpha_l F
 GLIBC_2.1 __isascii_l F
diff --git a/sysdeps/unix/sysv/linux/alpha/osf_gettimeofday.c b/sysdeps/unix/sysv/linux/alpha/osf_gettimeofday.c
new file mode 100644
index 0000000000..9868dfd9c9
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/osf_gettimeofday.c
@@ -0,0 +1,66 @@ 
+/* gettimeofday -- Get the current time of day.  Linux/Alpha/tv32 version.
+   Copyright (C) 2019 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
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <errno.h>
+#include <limits.h>
+#include <string.h>
+#include <time.h>
+#include <sys/time.h>
+#include <shlib-compat.h>
+
+#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
+
+struct timeval32
+{
+    int tv_sec, tv_usec;
+};
+
+/* Get the current time of day, putting it into *TV.
+   If *TZ is not NULL, clear it.
+   Returns 0 on success, -1 on errors.  */
+
+int
+attribute_compat_text_section
+__gettimeofday_tv32 (struct timeval32 *tv32,
+                     struct timezone *tz)
+{
+  if (__glibc_unlikely (tz != 0))
+    memset (tz, 0, sizeof *tz);
+
+  struct timespec ts;
+  if (__clock_gettime (CLOCK_REALTIME, &ts))
+    return -1;
+
+  if (__glibc_unlikely (ts.tv_sec > (time_t)INT_MAX))
+    {
+      /* The clock has advanced past the time representable in a 32-bit
+         time_t.  Fail, but write a saturated value to the output first,
+         because callers don't typically expect gettimeofday to fail.  */
+      __set_errno (EOVERFLOW);
+      tv32->tv_sec  = INT_MAX;
+      tv32->tv_usec = 0;
+      return -1;
+    }
+
+  tv32->tv_sec = ts.tv_sec;
+  tv32->tv_usec = ts.tv_nsec / 1000;
+  return 0;
+}
+
+compat_symbol (libc, __gettimeofday_tv32, gettimeofday, GLIBC_2_0);
+#endif
diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list
index f5a534ed68..9ceed78c8d 100644
--- a/sysdeps/unix/sysv/linux/alpha/syscalls.list
+++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list
@@ -23,7 +23,6 @@  pciconfig_write	EXTRA	pciconfig_write	5	pciconfig_write
 pciconfig_iobase EXTRA	pciconfig_iobase 3	__pciconfig_iobase pciconfig_iobase
 
 # support old timeval32 entry points
-osf_gettimeofday -	osf_gettimeofday 2	__gettimeofday_tv32  __gettimeofday@GLIBC_2.0 gettimeofday@GLIBC_2.0
 osf_getitimer	-	osf_getitimer	2	__getitimer_tv32  getitimer@GLIBC_2.0
 osf_setitimer	-	osf_setitimer	3	__setitimer_tv32  setitimer@GLIBC_2.0
 osf_utimes	-	osf_utimes	2	__utimes_tv32  utimes@GLIBC_2.0
@@ -31,7 +30,6 @@  osf_getrusage	-	osf_getrusage	2	__getrusage_tv32  getrusage@GLIBC_2.0
 osf_wait4	-	osf_wait4	4	__wait4_tv32  wait4@GLIBC_2.0
 
 # support new timeval64 entry points
-gettimeofday	-	gettimeofday	2	__GI___gettimeofday gettimeofday@@GLIBC_2.1 __gettimeofday@@GLIBC_2.1
 getitimer	-	getitimer	2	__getitimer getitimer@@GLIBC_2.1
 setitimer	-	setitimer	3	__setitimer setitimer@@GLIBC_2.1
 utimes		-	utimes		2	__utimes utimes@@GLIBC_2.1
diff --git a/sysdeps/unix/sysv/linux/arm/init-first.c b/sysdeps/unix/sysv/linux/arm/init-first.c
index e1846df661..c73970d06d 100644
--- a/sysdeps/unix/sysv/linux/arm/init-first.c
+++ b/sysdeps/unix/sysv/linux/arm/init-first.c
@@ -21,17 +21,14 @@ 
 #include <libc-vdso.h>
 #include <sysdep-vdso.h>
 
-int (*VDSO_SYMBOL(gettimeofday)) (struct timeval *, void *) attribute_hidden;
 int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *);
 
 static inline void
 _libc_vdso_platform_setup (void)
 {
-  PREPARE_VERSION_KNOWN (linux26, LINUX_2_6);
+  void *p;
 
-  void *p = _dl_vdso_vsym ("__vdso_gettimeofday", &linux26);
-  PTR_MANGLE (p);
-  VDSO_SYMBOL (gettimeofday) = p;
+  PREPARE_VERSION_KNOWN (linux26, LINUX_2_6);
 
   p = _dl_vdso_vsym ("__vdso_clock_gettime", &linux26);
   PTR_MANGLE (p);
diff --git a/sysdeps/unix/sysv/linux/arm/libc-vdso.h b/sysdeps/unix/sysv/linux/arm/libc-vdso.h
index 8702165c6b..b7ae61def6 100644
--- a/sysdeps/unix/sysv/linux/arm/libc-vdso.h
+++ b/sysdeps/unix/sysv/linux/arm/libc-vdso.h
@@ -22,8 +22,6 @@ 
 
 #include <sysdep-vdso.h>
 
-extern int (*VDSO_SYMBOL(gettimeofday)) (struct timeval *, void *)
-   attribute_hidden;
 extern int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *);
 
 #endif /* _LIBC_VDSO_H */
diff --git a/sysdeps/unix/sysv/linux/arm/libc.abilist b/sysdeps/unix/sysv/linux/arm/libc.abilist
index bc3df8dcea..d58f0f84e3 100644
--- a/sysdeps/unix/sysv/linux/arm/libc.abilist
+++ b/sysdeps/unix/sysv/linux/arm/libc.abilist
@@ -356,7 +356,6 @@  GLIBC_2.4 __getpagesize F
 GLIBC_2.4 __getpgid F
 GLIBC_2.4 __getpid F
 GLIBC_2.4 __gets_chk F
-GLIBC_2.4 __gettimeofday F
 GLIBC_2.4 __getwd_chk F
 GLIBC_2.4 __gmtime_r F
 GLIBC_2.4 __gnu_Unwind_Find_exidx F
diff --git a/sysdeps/unix/sysv/linux/csky/libc.abilist b/sysdeps/unix/sysv/linux/csky/libc.abilist
index 9b3cee65bb..fcbfbd756b 100644
--- a/sysdeps/unix/sysv/linux/csky/libc.abilist
+++ b/sysdeps/unix/sysv/linux/csky/libc.abilist
@@ -216,7 +216,6 @@  GLIBC_2.29 __getpagesize F
 GLIBC_2.29 __getpgid F
 GLIBC_2.29 __getpid F
 GLIBC_2.29 __gets_chk F
-GLIBC_2.29 __gettimeofday F
 GLIBC_2.29 __getwd_chk F
 GLIBC_2.29 __gmtime_r F
 GLIBC_2.29 __h_errno_location F
diff --git a/sysdeps/unix/sysv/linux/gettimeofday.c b/sysdeps/unix/sysv/linux/gettimeofday.c
deleted file mode 100644
index a74f03825a..0000000000
--- a/sysdeps/unix/sysv/linux/gettimeofday.c
+++ /dev/null
@@ -1,39 +0,0 @@ 
-/* Copyright (C) 2015-2019 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
-   modify it under the terms of the GNU Lesser General Public License as
-   published by the Free Software Foundation; either version 2.1 of the
-   License, or (at your option) any later version.
-
-   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
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <errno.h>
-#include <sys/time.h>
-
-#undef __gettimeofday
-
-#ifdef HAVE_GETTIMEOFDAY_VSYSCALL
-# define HAVE_VSYSCALL
-#endif
-#include <sysdep-vdso.h>
-
-/* Get the current time of day and timezone information,
-   putting it into *tv and *tz.  If tz is null, *tz is not filled.
-   Returns 0 on success, -1 on errors.  */
-int
-__gettimeofday (struct timeval *tv, struct timezone *tz)
-{
-  return INLINE_VSYSCALL (gettimeofday, 2, tv, tz);
-}
-libc_hidden_def (__gettimeofday)
-weak_alias (__gettimeofday, gettimeofday)
-libc_hidden_weak (gettimeofday)
diff --git a/sysdeps/unix/sysv/linux/hppa/libc.abilist b/sysdeps/unix/sysv/linux/hppa/libc.abilist
index 75edece94a..8204979434 100644
--- a/sysdeps/unix/sysv/linux/hppa/libc.abilist
+++ b/sysdeps/unix/sysv/linux/hppa/libc.abilist
@@ -271,7 +271,6 @@  GLIBC_2.2 __getmntent_r F
 GLIBC_2.2 __getpagesize F
 GLIBC_2.2 __getpgid F
 GLIBC_2.2 __getpid F
-GLIBC_2.2 __gettimeofday F
 GLIBC_2.2 __gmtime_r F
 GLIBC_2.2 __h_errno_location F
 GLIBC_2.2 __isalnum_l F
diff --git a/sysdeps/unix/sysv/linux/i386/libc.abilist b/sysdeps/unix/sysv/linux/i386/libc.abilist
index edeaf8e722..eddfaae9ee 100644
--- a/sysdeps/unix/sysv/linux/i386/libc.abilist
+++ b/sysdeps/unix/sysv/linux/i386/libc.abilist
@@ -139,7 +139,6 @@  GLIBC_2.0 __getdelim F
 GLIBC_2.0 __getpagesize F
 GLIBC_2.0 __getpgid F
 GLIBC_2.0 __getpid F
-GLIBC_2.0 __gettimeofday F
 GLIBC_2.0 __gmtime_r F
 GLIBC_2.0 __h_errno_location F
 GLIBC_2.0 __isinf F
diff --git a/sysdeps/unix/sysv/linux/ia64/libc.abilist b/sysdeps/unix/sysv/linux/ia64/libc.abilist
index b5d460eeb2..8fa8bb37fe 100644
--- a/sysdeps/unix/sysv/linux/ia64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/ia64/libc.abilist
@@ -271,7 +271,6 @@  GLIBC_2.2 __getmntent_r F
 GLIBC_2.2 __getpagesize F
 GLIBC_2.2 __getpgid F
 GLIBC_2.2 __getpid F
-GLIBC_2.2 __gettimeofday F
 GLIBC_2.2 __gmtime_r F
 GLIBC_2.2 __h_errno_location F
 GLIBC_2.2 __isalnum_l F
diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
index 05633b3cb8..572713c5ce 100644
--- a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
@@ -342,7 +342,6 @@  GLIBC_2.4 __getpagesize F
 GLIBC_2.4 __getpgid F
 GLIBC_2.4 __getpid F
 GLIBC_2.4 __gets_chk F
-GLIBC_2.4 __gettimeofday F
 GLIBC_2.4 __getwd_chk F
 GLIBC_2.4 __gmtime_r F
 GLIBC_2.4 __h_errno_location F
diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
index 47eb7b4608..c2da22311b 100644
--- a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
@@ -139,7 +139,6 @@  GLIBC_2.0 __getdelim F
 GLIBC_2.0 __getpagesize F
 GLIBC_2.0 __getpgid F
 GLIBC_2.0 __getpid F
-GLIBC_2.0 __gettimeofday F
 GLIBC_2.0 __gmtime_r F
 GLIBC_2.0 __h_errno_location F
 GLIBC_2.0 __isinf F
diff --git a/sysdeps/unix/sysv/linux/microblaze/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/libc.abilist
index f7ced487f7..3c37a890f2 100644
--- a/sysdeps/unix/sysv/linux/microblaze/libc.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/libc.abilist
@@ -217,7 +217,6 @@  GLIBC_2.18 __getpagesize F
 GLIBC_2.18 __getpgid F
 GLIBC_2.18 __getpid F
 GLIBC_2.18 __gets_chk F
-GLIBC_2.18 __gettimeofday F
 GLIBC_2.18 __getwd_chk F
 GLIBC_2.18 __gmtime_r F
 GLIBC_2.18 __h_errno_location F
diff --git a/sysdeps/unix/sysv/linux/mips/init-first.c b/sysdeps/unix/sysv/linux/mips/init-first.c
index 25884ffd80..a7c3643cb8 100644
--- a/sysdeps/unix/sysv/linux/mips/init-first.c
+++ b/sysdeps/unix/sysv/linux/mips/init-first.c
@@ -20,17 +20,14 @@ 
 #include <dl-vdso.h>
 #include <libc-vdso.h>
 
-int (*VDSO_SYMBOL(gettimeofday)) (struct timeval *, void *) attribute_hidden;
 int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *);
 
 static inline void
 _libc_vdso_platform_setup (void)
 {
-  PREPARE_VERSION_KNOWN (linux26, LINUX_2_6);
+  void *p;
 
-  void *p = _dl_vdso_vsym ("__vdso_gettimeofday", &linux26);
-  PTR_MANGLE (p);
-  VDSO_SYMBOL (gettimeofday) = p;
+  PREPARE_VERSION_KNOWN (linux26, LINUX_2_6);
 
   p = _dl_vdso_vsym ("__vdso_clock_gettime", &linux26);
   PTR_MANGLE (p);
diff --git a/sysdeps/unix/sysv/linux/mips/libc-vdso.h b/sysdeps/unix/sysv/linux/mips/libc-vdso.h
index 344ea2d750..e0a8fe4a80 100644
--- a/sysdeps/unix/sysv/linux/mips/libc-vdso.h
+++ b/sysdeps/unix/sysv/linux/mips/libc-vdso.h
@@ -22,8 +22,6 @@ 
 
 #include <sysdep-vdso.h>
 
-extern int (*VDSO_SYMBOL(gettimeofday)) (struct timeval *, void *)
-   attribute_hidden;
 extern int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *);
 
 #endif /* _LIBC_VDSO_H */
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
index e49dc4272e..a56e887841 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
@@ -138,7 +138,6 @@  GLIBC_2.0 __getdelim F
 GLIBC_2.0 __getpagesize F
 GLIBC_2.0 __getpgid F
 GLIBC_2.0 __getpid F
-GLIBC_2.0 __gettimeofday F
 GLIBC_2.0 __gmtime_r F
 GLIBC_2.0 __h_errno_location F
 GLIBC_2.0 __isinf F
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
index daa3b60c5b..6b77079708 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
@@ -138,7 +138,6 @@  GLIBC_2.0 __getdelim F
 GLIBC_2.0 __getpagesize F
 GLIBC_2.0 __getpgid F
 GLIBC_2.0 __getpid F
-GLIBC_2.0 __gettimeofday F
 GLIBC_2.0 __gmtime_r F
 GLIBC_2.0 __h_errno_location F
 GLIBC_2.0 __isinf F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
index 457ce0b6f2..74d0cdd671 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
@@ -138,7 +138,6 @@  GLIBC_2.0 __getdelim F
 GLIBC_2.0 __getpagesize F
 GLIBC_2.0 __getpgid F
 GLIBC_2.0 __getpid F
-GLIBC_2.0 __gettimeofday F
 GLIBC_2.0 __gmtime_r F
 GLIBC_2.0 __h_errno_location F
 GLIBC_2.0 __isinf F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
index 63d5c03bfb..e7173457f7 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
@@ -138,7 +138,6 @@  GLIBC_2.0 __getdelim F
 GLIBC_2.0 __getpagesize F
 GLIBC_2.0 __getpgid F
 GLIBC_2.0 __getpid F
-GLIBC_2.0 __gettimeofday F
 GLIBC_2.0 __gmtime_r F
 GLIBC_2.0 __h_errno_location F
 GLIBC_2.0 __isinf F
diff --git a/sysdeps/unix/sysv/linux/nios2/libc.abilist b/sysdeps/unix/sysv/linux/nios2/libc.abilist
index 7fec0c9670..6384bba4ba 100644
--- a/sysdeps/unix/sysv/linux/nios2/libc.abilist
+++ b/sysdeps/unix/sysv/linux/nios2/libc.abilist
@@ -242,7 +242,6 @@  GLIBC_2.21 __getpagesize F
 GLIBC_2.21 __getpgid F
 GLIBC_2.21 __getpid F
 GLIBC_2.21 __gets_chk F
-GLIBC_2.21 __gettimeofday F
 GLIBC_2.21 __getwd_chk F
 GLIBC_2.21 __gmtime_r F
 GLIBC_2.21 __gtdf2 F
diff --git a/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c b/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c
deleted file mode 100644
index 463b678ad9..0000000000
--- a/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c
+++ /dev/null
@@ -1,85 +0,0 @@ 
-/* Copyright (C) 2005-2019 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
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   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
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#if defined SHARED && !defined __powerpc64__
-# define __gettimeofday __redirect___gettimeofday
-#else
-# define __redirect___gettimeofday __gettimeofday
-#endif
-
-#include <sys/time.h>
-
-#ifdef SHARED
-
-# include <dl-vdso.h>
-# include <libc-vdso.h>
-# include <dl-machine.h>
-
-# ifndef __powerpc64__
-#  undef __gettimeofday
-
-int
-__gettimeofday_vsyscall (struct timeval *tv, struct timezone *tz)
-{
-  return INLINE_VSYSCALL (gettimeofday, 2, tv, tz);
-}
-
-/* __GI___gettimeofday is defined as hidden and for ppc32 it enables the
-   compiler make a local call (symbol@local) for internal GLIBC usage. It
-   means the PLT won't be used and the ifunc resolver will be called directly.
-   For ppc64 a call to a function in another translation unit might use a
-   different toc pointer thus disallowing direct branchess and making internal
-   ifuncs calls safe.  */
-#  undef libc_hidden_def
-#  define libc_hidden_def(name)					\
-  __hidden_ver1 (__gettimeofday_vsyscall, __GI___gettimeofday,	\
-	       __gettimeofday_vsyscall);
-
-# endif /* !__powerpc64__  */
-
-static int
-__gettimeofday_syscall (struct timeval *tv, struct timezone *tz)
-{
-  return INLINE_SYSCALL (gettimeofday, 2, tv, tz);
-}
-
-# define INIT_ARCH()						\
-  PREPARE_VERSION_KNOWN (linux2615, LINUX_2_6_15);		\
-  void *vdso_gettimeofday = _dl_vdso_vsym ("__kernel_gettimeofday", &linux2615);
-
-/* If the vDSO is not available we fall back syscall.  */
-libc_ifunc_hidden (__redirect___gettimeofday, __gettimeofday,
-		   vdso_gettimeofday
-		   ? VDSO_IFUNC_RET (vdso_gettimeofday)
-		   : (void *) __gettimeofday_syscall);
-libc_hidden_def (__gettimeofday)
-
-#else
-
-# include <sysdep.h>
-# include <errno.h>
-
-int
-__gettimeofday (struct timeval *tv, struct timezone *tz)
-{
-  return INLINE_SYSCALL (gettimeofday, 2, tv, tz);
-}
-libc_hidden_def (__gettimeofday)
-
-#endif
-weak_alias (__gettimeofday, gettimeofday)
-libc_hidden_weak (gettimeofday)
diff --git a/sysdeps/unix/sysv/linux/powerpc/init-first.c b/sysdeps/unix/sysv/linux/powerpc/init-first.c
index 4f12b59e76..166bf3f2fe 100644
--- a/sysdeps/unix/sysv/linux/powerpc/init-first.c
+++ b/sysdeps/unix/sysv/linux/powerpc/init-first.c
@@ -19,8 +19,6 @@ 
 #include <dl-vdso.h>
 #include <libc-vdso.h>
 
-int (*VDSO_SYMBOL(gettimeofday)) (struct timeval *, void *)
-  attribute_hidden;
 int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *);
 int (*VDSO_SYMBOL(clock_getres)) (clockid_t, struct timespec *);
 unsigned long long (*VDSO_SYMBOL(get_tbfreq)) (void);
@@ -36,11 +34,9 @@  void *VDSO_SYMBOL(sigtramp_rt32);
 static inline void
 _libc_vdso_platform_setup (void)
 {
-  PREPARE_VERSION_KNOWN (linux2615, LINUX_2_6_15);
+  void *p;
 
-  void *p = _dl_vdso_vsym ("__kernel_gettimeofday", &linux2615);
-  PTR_MANGLE (p);
-  VDSO_SYMBOL (gettimeofday) = p;
+  PREPARE_VERSION_KNOWN (linux2615, LINUX_2_6_15);
 
   p = _dl_vdso_vsym ("__kernel_clock_gettime", &linux2615);
   PTR_MANGLE (p);
diff --git a/sysdeps/unix/sysv/linux/powerpc/libc-vdso.h b/sysdeps/unix/sysv/linux/powerpc/libc-vdso.h
index f8184061c0..e233ea18a5 100644
--- a/sysdeps/unix/sysv/linux/powerpc/libc-vdso.h
+++ b/sysdeps/unix/sysv/linux/powerpc/libc-vdso.h
@@ -23,8 +23,6 @@ 
 #include <sysdep.h>
 #include <sysdep-vdso.h>
 
-extern int (*VDSO_SYMBOL(gettimeofday)) (struct timeval *, void *)
-  attribute_hidden;
 extern int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *);
 extern int (*VDSO_SYMBOL(clock_getres)) (clockid_t, struct timespec *);
 extern unsigned long long (*VDSO_SYMBOL(get_tbfreq)) (void);
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
index 9200a54309..ec3f7a3715 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
@@ -147,7 +147,6 @@  GLIBC_2.0 __getdelim F
 GLIBC_2.0 __getpagesize F
 GLIBC_2.0 __getpgid F
 GLIBC_2.0 __getpid F
-GLIBC_2.0 __gettimeofday F
 GLIBC_2.0 __gmtime_r F
 GLIBC_2.0 __h_errno_location F
 GLIBC_2.0 __isinf F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
index ef7779905f..e8facd80b9 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
@@ -147,7 +147,6 @@  GLIBC_2.0 __getdelim F
 GLIBC_2.0 __getpagesize F
 GLIBC_2.0 __getpgid F
 GLIBC_2.0 __getpid F
-GLIBC_2.0 __gettimeofday F
 GLIBC_2.0 __gmtime_r F
 GLIBC_2.0 __h_errno_location F
 GLIBC_2.0 __isinf F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
index 2860df8ebc..0fbb6c46b9 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
@@ -319,7 +319,6 @@  GLIBC_2.3 __getmntent_r F
 GLIBC_2.3 __getpagesize F
 GLIBC_2.3 __getpgid F
 GLIBC_2.3 __getpid F
-GLIBC_2.3 __gettimeofday F
 GLIBC_2.3 __gmtime_r F
 GLIBC_2.3 __h_errno_location F
 GLIBC_2.3 __isalnum_l F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
index 2229a1dcc0..ad21ed22ab 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
@@ -215,7 +215,6 @@  GLIBC_2.17 __getpagesize F
 GLIBC_2.17 __getpgid F
 GLIBC_2.17 __getpid F
 GLIBC_2.17 __gets_chk F
-GLIBC_2.17 __gettimeofday F
 GLIBC_2.17 __getwd_chk F
 GLIBC_2.17 __gmtime_r F
 GLIBC_2.17 __h_errno_location F
diff --git a/sysdeps/unix/sysv/linux/riscv/init-first.c b/sysdeps/unix/sysv/linux/riscv/init-first.c
index 98a8ce33ad..014d770861 100644
--- a/sysdeps/unix/sysv/linux/riscv/init-first.c
+++ b/sysdeps/unix/sysv/linux/riscv/init-first.c
@@ -22,8 +22,6 @@ 
 
 long int (*VDSO_SYMBOL (getcpu)) (unsigned int *, unsigned int *, void *)
     attribute_hidden;
-long int (*VDSO_SYMBOL (gettimeofday)) (struct timeval *, void *)
-    attribute_hidden;
 long int (*VDSO_SYMBOL (clock_gettime)) (clockid_t, struct timespec *)
     attribute_hidden;
 long int (*VDSO_SYMBOL (clock_getres)) (clockid_t, struct timespec *)
@@ -32,16 +30,14 @@  long int (*VDSO_SYMBOL (clock_getres)) (clockid_t, struct timespec *)
 static inline void
 _libc_vdso_platform_setup (void)
 {
+  void *p;
+
   PREPARE_VERSION_KNOWN (linux_version, LINUX_4_15);
 
-  void *p = _dl_vdso_vsym ("__vdso_getcpu", &linux_version);
+  p = _dl_vdso_vsym ("__vdso_getcpu", &linux_version);
   PTR_MANGLE (p);
   VDSO_SYMBOL (getcpu) = p;
 
-  p = _dl_vdso_vsym ("__vdso_gettimeofday", &linux_version);
-  PTR_MANGLE (p);
-  VDSO_SYMBOL (gettimeofday) = p;
-
   p = _dl_vdso_vsym ("__vdso_clock_gettime", &linux_version);
   PTR_MANGLE (p);
   VDSO_SYMBOL (clock_gettime) = p;
diff --git a/sysdeps/unix/sysv/linux/riscv/libc-vdso.h b/sysdeps/unix/sysv/linux/riscv/libc-vdso.h
index 2373292ab9..e9a5b239b9 100644
--- a/sysdeps/unix/sysv/linux/riscv/libc-vdso.h
+++ b/sysdeps/unix/sysv/linux/riscv/libc-vdso.h
@@ -24,8 +24,6 @@ 
 
 extern long int (*VDSO_SYMBOL (getcpu)) (unsigned int *, unsigned int *, void *)
     attribute_hidden;
-extern long int (*VDSO_SYMBOL (gettimeofday)) (struct timeval *, void *)
-    attribute_hidden;
 extern long int (*VDSO_SYMBOL (clock_gettime)) (clockid_t, struct timespec *)
     attribute_hidden;
 extern long int (*VDSO_SYMBOL (clock_getres)) (clockid_t, struct timespec *)
diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
index 31010e6cf7..0214f99ce4 100644
--- a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
@@ -218,7 +218,6 @@  GLIBC_2.27 __getpagesize F
 GLIBC_2.27 __getpgid F
 GLIBC_2.27 __getpid F
 GLIBC_2.27 __gets_chk F
-GLIBC_2.27 __gettimeofday F
 GLIBC_2.27 __getwd_chk F
 GLIBC_2.27 __gmtime_r F
 GLIBC_2.27 __h_errno_location F
diff --git a/sysdeps/unix/sysv/linux/s390/init-first.c b/sysdeps/unix/sysv/linux/s390/init-first.c
index a1ad9458e3..3a55935886 100644
--- a/sysdeps/unix/sysv/linux/s390/init-first.c
+++ b/sysdeps/unix/sysv/linux/s390/init-first.c
@@ -19,9 +19,6 @@ 
 #include <dl-vdso.h>
 #include <libc-vdso.h>
 
-long int (*VDSO_SYMBOL(gettimeofday)) (struct timeval *, void *)
-   attribute_hidden;
-
 long int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *)
   __attribute__ ((nocommon));
 
@@ -34,11 +31,9 @@  long int (*VDSO_SYMBOL(getcpu)) (unsigned *, unsigned *, void *)
 static inline void
 _libc_vdso_platform_setup (void)
 {
-  PREPARE_VERSION_KNOWN (linux2629, LINUX_2_6_29);
+  void *p;
 
-  void *p = _dl_vdso_vsym ("__kernel_gettimeofday", &linux2629);
-  PTR_MANGLE (p);
-  VDSO_SYMBOL (gettimeofday) = p;
+  PREPARE_VERSION_KNOWN (linux2629, LINUX_2_6_29);
 
   p = _dl_vdso_vsym ("__kernel_clock_gettime", &linux2629);
   PTR_MANGLE (p);
diff --git a/sysdeps/unix/sysv/linux/s390/libc-vdso.h b/sysdeps/unix/sysv/linux/s390/libc-vdso.h
index cc97601383..2cdf44583a 100644
--- a/sysdeps/unix/sysv/linux/s390/libc-vdso.h
+++ b/sysdeps/unix/sysv/linux/s390/libc-vdso.h
@@ -22,9 +22,6 @@ 
 
 #include <sysdep-vdso.h>
 
-extern long int (*VDSO_SYMBOL(gettimeofday)) (struct timeval *, void *)
-   attribute_hidden;
-
 extern long int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *);
 
 extern long int (*VDSO_SYMBOL(clock_getres)) (clockid_t, struct timespec *);
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
index 576295deff..7dad6eba74 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
@@ -139,7 +139,6 @@  GLIBC_2.0 __getdelim F
 GLIBC_2.0 __getpagesize F
 GLIBC_2.0 __getpgid F
 GLIBC_2.0 __getpid F
-GLIBC_2.0 __gettimeofday F
 GLIBC_2.0 __gmtime_r F
 GLIBC_2.0 __h_errno_location F
 GLIBC_2.0 __isinf F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
index abf0473683..e3767a3df2 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
@@ -283,7 +283,6 @@  GLIBC_2.2 __getmntent_r F
 GLIBC_2.2 __getpagesize F
 GLIBC_2.2 __getpgid F
 GLIBC_2.2 __getpid F
-GLIBC_2.2 __gettimeofday F
 GLIBC_2.2 __gmtime_r F
 GLIBC_2.2 __h_errno_location F
 GLIBC_2.2 __isalnum_l F
diff --git a/sysdeps/unix/sysv/linux/sh/libc.abilist b/sysdeps/unix/sysv/linux/sh/libc.abilist
index 41977f6e9c..22b77a1b9a 100644
--- a/sysdeps/unix/sysv/linux/sh/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sh/libc.abilist
@@ -272,7 +272,6 @@  GLIBC_2.2 __getmntent_r F
 GLIBC_2.2 __getpagesize F
 GLIBC_2.2 __getpgid F
 GLIBC_2.2 __getpid F
-GLIBC_2.2 __gettimeofday F
 GLIBC_2.2 __gmtime_r F
 GLIBC_2.2 __h_errno_location F
 GLIBC_2.2 __isalnum_l F
diff --git a/sysdeps/unix/sysv/linux/sparc/init-first.c b/sysdeps/unix/sysv/linux/sparc/init-first.c
index 643d6c7c88..520fc25808 100644
--- a/sysdeps/unix/sysv/linux/sparc/init-first.c
+++ b/sysdeps/unix/sysv/linux/sparc/init-first.c
@@ -20,19 +20,15 @@ 
 #include <dl-vdso.h>
 #include <libc-vdso.h>
 
-long int (*VDSO_SYMBOL (gettimeofday)) (struct timeval *, void *)
-    attribute_hidden;
 long int (*VDSO_SYMBOL (clock_gettime)) (clockid_t, struct timespec *)
     attribute_hidden;
 
 static inline void
 _libc_vdso_platform_setup (void)
 {
-  PREPARE_VERSION_KNOWN (linux_version, LINUX_2_6);
+  void *p;
 
-  void *p = _dl_vdso_vsym ("__vdso_gettimeofday", &linux_version);
-  PTR_MANGLE (p);
-  VDSO_SYMBOL (gettimeofday) = p;
+  PREPARE_VERSION_KNOWN (linux_version, LINUX_2_6);
 
   p = _dl_vdso_vsym ("__vdso_clock_gettime", &linux_version);
   PTR_MANGLE (p);
diff --git a/sysdeps/unix/sysv/linux/sparc/libc-vdso.h b/sysdeps/unix/sysv/linux/sparc/libc-vdso.h
index d20afcdf04..28d1229587 100644
--- a/sysdeps/unix/sysv/linux/sparc/libc-vdso.h
+++ b/sysdeps/unix/sysv/linux/sparc/libc-vdso.h
@@ -22,8 +22,6 @@ 
 
 #include <sysdep-vdso.h>
 
-extern long int (*VDSO_SYMBOL(gettimeofday)) (struct timeval *, void *)
-   attribute_hidden;
 extern long int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *);
 
 #endif /* _LIBC_VDSO_H */
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
index 3d2f00ca52..a8803be2aa 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
@@ -144,7 +144,6 @@  GLIBC_2.0 __getdelim F
 GLIBC_2.0 __getpagesize F
 GLIBC_2.0 __getpgid F
 GLIBC_2.0 __getpid F
-GLIBC_2.0 __gettimeofday F
 GLIBC_2.0 __gmtime_r F
 GLIBC_2.0 __h_errno_location F
 GLIBC_2.0 __isinf F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
index 2f20643e8e..6045532a26 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
@@ -310,7 +310,6 @@  GLIBC_2.2 __getmntent_r F
 GLIBC_2.2 __getpagesize F
 GLIBC_2.2 __getpgid F
 GLIBC_2.2 __getpid F
-GLIBC_2.2 __gettimeofday F
 GLIBC_2.2 __gmtime_r F
 GLIBC_2.2 __h_errno_location F
 GLIBC_2.2 __isalnum_l F
diff --git a/sysdeps/unix/sysv/linux/x86/gettimeofday.c b/sysdeps/unix/sysv/linux/x86/gettimeofday.c
deleted file mode 100644
index 8886ccd707..0000000000
--- a/sysdeps/unix/sysv/linux/x86/gettimeofday.c
+++ /dev/null
@@ -1,61 +0,0 @@ 
-/* gettimeofday - get the time.  Linux/x86 version.
-   Copyright (C) 2015-2019 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
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   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
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sys/time.h>
-
-#ifdef SHARED
-
-# include <dl-vdso.h>
-# include <errno.h>
-
-static int
-__gettimeofday_syscall (struct timeval *tv, struct timezone *tz)
-{
-  return INLINE_SYSCALL (gettimeofday, 2, tv, tz);
-}
-
-# ifndef __gettimeofday_type
-/* The i386 gettimeofday.c includes this file with a defined
-   __gettimeofday_type macro.  For x86_64 we have to define it to __gettimeofday
-   as the internal symbol is the ifunc'ed one.  */
-#  define __gettimeofday_type __gettimeofday
-# endif
-
-# undef INIT_ARCH
-# define INIT_ARCH() PREPARE_VERSION_KNOWN (linux26, LINUX_2_6)
-/* If the vDSO is not available we fall back to syscall.  */
-libc_ifunc_hidden (__gettimeofday_type, __gettimeofday,
-		   (_dl_vdso_vsym ("__vdso_gettimeofday", &linux26)
-		    ?: &__gettimeofday_syscall))
-libc_hidden_def (__gettimeofday)
-
-#else
-
-# include <sysdep.h>
-# include <errno.h>
-
-int
-__gettimeofday (struct timeval *tv, struct timezone *tz)
-{
-  return INLINE_SYSCALL (gettimeofday, 2, tv, tz);
-}
-libc_hidden_def (__gettimeofday)
-
-#endif
-weak_alias (__gettimeofday, gettimeofday)
-libc_hidden_weak (gettimeofday)
diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
index 59f85d9373..2cfe09dfe1 100644
--- a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
@@ -270,7 +270,6 @@  GLIBC_2.2.5 __getmntent_r F
 GLIBC_2.2.5 __getpagesize F
 GLIBC_2.2.5 __getpgid F
 GLIBC_2.2.5 __getpid F
-GLIBC_2.2.5 __gettimeofday F
 GLIBC_2.2.5 __gmtime_r F
 GLIBC_2.2.5 __h_errno_location F
 GLIBC_2.2.5 __isalnum_l F
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
index 67a4e238d6..72eed1ab3f 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
@@ -217,7 +217,6 @@  GLIBC_2.16 __getpagesize F
 GLIBC_2.16 __getpgid F
 GLIBC_2.16 __getpid F
 GLIBC_2.16 __gets_chk F
-GLIBC_2.16 __gettimeofday F
 GLIBC_2.16 __getwd_chk F
 GLIBC_2.16 __gmtime_r F
 GLIBC_2.16 __h_errno_location F
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/syscalls.list b/sysdeps/unix/sysv/linux/x86_64/x32/syscalls.list
index c0cfa7b0da..58ea31d1fd 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/syscalls.list
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/syscalls.list
@@ -1,5 +1,4 @@ 
 # File name	Caller	Syscall name	# args	Strong name	Weak names
 
-gettimeofday	-	gettimeofday:__vdso_gettimeofday@LINUX_2.6	i:pP	__gettimeofday	gettimeofday
 personality	EXTRA	personality	Ei:i	__personality	personality
 posix_fadvise64	-	fadvise64	Vi:iiii	posix_fadvise	posix_fadvise64
diff --git a/time/Versions b/time/Versions
index fd838181e4..cd2e0725f4 100644
--- a/time/Versions
+++ b/time/Versions
@@ -7,7 +7,7 @@  libc {
     __adjtimex;
 
     # functions used in other libraries
-    __gmtime_r; __gettimeofday;
+    __gmtime_r;
 
     # variables in normal name space
     daylight; timezone; tzname;
diff --git a/time/gettimeofday.c b/time/gettimeofday.c
index 1004ec8911..22a996a220 100644
--- a/time/gettimeofday.c
+++ b/time/gettimeofday.c
@@ -15,20 +15,30 @@ 
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <errno.h>
+#include <string.h>
+#include <time.h>
 #include <sys/time.h>
 
-/* Get the current time of day and timezone information,
-   putting it into *TV and *TZ.  If TZ is NULL, *TZ is not filled.
+/* Get the current time of day, putting it into *TV.
+   If *TZ is not NULL, clear it.
    Returns 0 on success, -1 on errors.  */
 int
 __gettimeofday (struct timeval *tv, struct timezone *tz)
 {
-  __set_errno (ENOSYS);
-  return -1;
+  if (__glibc_unlikely (tz != 0))
+    memset (tz, 0, sizeof *tz);
+
+  struct timespec ts;
+  if (__clock_gettime (CLOCK_REALTIME, &ts))
+    return -1;
+
+  TIMESPEC_TO_TIMEVAL (tv, &ts);
+  return 0;
 }
-libc_hidden_def (__gettimeofday)
-weak_alias (__gettimeofday, gettimeofday)
-libc_hidden_weak (gettimeofday)
 
-stub_warning (gettimeofday)
+#ifdef VERSION_gettimeofday
+weak_alias (__gettimeofday, __gettimeofday_w);
+default_symbol_version (__gettimeofday_w, gettimeofday, VERSION_gettimeofday);
+#else
+weak_alias (__gettimeofday, gettimeofday)
+#endif