about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/aarch64/gettimeofday.c
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2019-05-23 16:33:32 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2019-09-17 17:09:01 -0300
commitb8386c2859e61c5c80ca98e987665a3179bd7e52 (patch)
tree325390efdfff3a436d65f9abfd15ee0ed57a7063 /sysdeps/unix/sysv/linux/aarch64/gettimeofday.c
parentb881217f1716cc02a6606c44f0e436c3a4e70a9e (diff)
downloadglibc-b8386c2859e61c5c80ca98e987665a3179bd7e52.tar.gz
glibc-b8386c2859e61c5c80ca98e987665a3179bd7e52.tar.xz
glibc-b8386c2859e61c5c80ca98e987665a3179bd7e52.zip
Remove PREPARE_VERSION and PREPARE_VERSION_KNOW
This patch removes the PREPARE_VERSION and PREPARE_VERSION_KNOW macro
and uses a static inline function instead, get_vdso_symbol.  Each
architecture that supports vDSO must define the Linux version and its
hash for symbol resolution (VDSO_NAME and VDSO_HASH macro respectively).

It also organizes the HAVE_*_VSYSCALL for mips, powerpc, and s390 to
define them on a common header.

The idea is to require less code to configure and enable vDSO support
for newer ports.  No semantic changes are expected.

Checked with a build against all affected architectures.

	* sysdeps/unix/make-syscalls.sh: Make vDSO call use get_vdso_symbol.
	* sysdeps/unix/sysv/linux/aarch64/gettimeofday.c (__gettimeofday):
	Use get_vdso_symbol instead of _dl_vdso_vsym.
	* sysdeps/unix/sysv/linux/powerpc/time.c (time): Likewise.
	* sysdeps/unix/sysv/linux/riscv/flush-icache.c
	(__lookup_riscv_flush_icache): Likewise.
	* sysdeps/unix/sysv/linux/x86/gettimeofday.c (__gettimeofday):
	Likewise.
	* sysdeps/unix/sysv/linux/x86/time.c (time): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/gettimeofday.c: Likewise.
	* sysdeps/unix/sysv/linux/aarch64/init-first.c: Likewise.
	* sysdeps/unix/sysv/linux/arm/init-first.c: Likewise.
	* sysdeps/unix/sysv/linux/i386/init-first.c: Likewise.
	* sysdeps/unix/sysv/linux/mips/init-first.c: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/init-first.c: Likewise.
	* sysdeps/unix/sysv/linux/riscv/init-first.c: Likewise.
	* sysdeps/unix/sysv/linux/sparc/init-first.c: Likewise.
	* sysdeps/unix/sysv/linux/s390/init-first.c: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/init-first.c: Likewise.
	* sysdeps/unix/sysv/linux/aarch64/sysdep.h (VDSO_NAME, VDSO_HASH):
	Define.
	* sysdeps/unix/sysv/linux/arm/sysdep.h (VDSO_NAME, VDSO_HASH):
	Likewise.
	* sysdeps/unix/sysv/linux/i386/sysdep.h (VDSO_NAME, VDSO_HASH):
	Likewise.
	* sysdeps/unix/sysv/linux/riscv/sysdep.h (VDSO_NAME, VDSO_HASH):
	Likewise.
	* sysdeps/unix/sysv/linux/sparc/sysdep.h (VDSO_NAME, VDSO_HASH):
	Likewise.
	* sysdeps/unix/sysv/linux/x86_64/sysdep.h (VDSO_NAME, VDSO_HASH):
	Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/sysdep.h
	(HAVE_CLOCK_GETTIME_VSYSCALL, HAVE_GETTIMEOFDAY_VSYSCALL): Remove
	definition.
	* sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h
	(HAVE_CLOCK_GETTIME_VSYSCALL, HAVE_GETTIMEOFDAY_VSYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h
	(HAVE_CLOCK_GETTIME_VSYSCALL, HAVE_GETTIMEOFDAY_VSYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
	(HAVE_CLOCK_GETTIME_VSYSCALL, HAVE_GETTIMEOFDAY_VSYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
	(HAVE_CLOCK_GETTIME_VSYSCALL, HAVE_GETTIMEOFDAY_VSYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h
	(HAVE_CLOCK_GETRES_VSYSCALL, HAVE_CLOCK_GETTIME_VSYSCALL,
	HAVE_GETTIMEOFDAY_VSYSCALL, HAVE_GETCPU_VSYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
	(HAVE_CLOCK_GETRES_VSYSCALL, HAVE_CLOCK_GETTIME_VSYSCALL,
	HAVE_GETTIMEOFDAY_VSYSCALL, HAVE_GETCPU_VSYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/mips/sysdep.h: New file.
	* sysdeps/unix/sysv/linux/powerpc/sysdep.h: Likewise.
	* sysdeps/unix/sysv/linux/s390/sysdep.h: Likewise.
	* sysdeps/unix/sysv/linux/dl-vdso.h (PREPARE_VERSION,
	PREPARE_VERSION_KNOWN, VDSO_NAME_LINUX_2_6, VDSO_HASH_LINUX_2_6,
	VDSO_NAME_LINUX_2_6_15, VDSO_HASH_LINUX_2_6_15,
	VDSO_NAME_LINUX_2_6_29, VDSO_HASH_LINUX_2_6_29,
	VDSO_NAME_LINUX_4_15, VDSO_HASH_LINUX_4_15): Remove defines.
	(get_vdso_symbol): New function.
Diffstat (limited to 'sysdeps/unix/sysv/linux/aarch64/gettimeofday.c')
-rw-r--r--sysdeps/unix/sysv/linux/aarch64/gettimeofday.c27
1 files changed, 7 insertions, 20 deletions
diff --git a/sysdeps/unix/sysv/linux/aarch64/gettimeofday.c b/sysdeps/unix/sysv/linux/aarch64/gettimeofday.c
index ccec52e363..1ec98bf161 100644
--- a/sysdeps/unix/sysv/linux/aarch64/gettimeofday.c
+++ b/sysdeps/unix/sysv/linux/aarch64/gettimeofday.c
@@ -20,12 +20,10 @@
    putting it into *tv and *tz.  If tz is null, *tz is not filled.
    Returns 0 on success, -1 on errors.  */
 
+#include <sys/time.h>
+
 #ifdef SHARED
 
-# define __gettimeofday __redirect___gettimeofday
-# include <sys/time.h>
-# undef __gettimeofday
-# define HAVE_VSYSCALL
 # include <dl-vdso.h>
 # include <sysdep-vdso.h>
 
@@ -38,25 +36,14 @@ __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);
+# define INIT_ARCH()
+libc_ifunc_hidden (__gettimeofday, __gettimeofday,
+		   (get_vdso_symbol ("__kernel_gettimeofday")
+		    ?: __gettimeofday_vsyscall))
+libc_hidden_def (__gettimeofday)
 
 #else
 
-# include <sys/time.h>
 # include <sysdep.h>
 int
 __gettimeofday (struct timeval *tv, struct timezone *tz)