[08/12] Add support for clock_gettime64 vDSO

Message ID 20191212181614.31782-8-adhemerval.zanella@linaro.org
State New
Headers show
Series
  • [01/12] linux: Fix vDSO macros build with time64 interfaces
Related show

Commit Message

Adhemerval Zanella Dec. 12, 2019, 6:16 p.m.
No architecture currently defines the vDSO symbol.
---
 sysdeps/unix/sysv/linux/clock_gettime.c | 12 ++++++++++--
 sysdeps/unix/sysv/linux/dl-vdso-setup.c |  4 ++++
 sysdeps/unix/sysv/linux/dl-vdso-setup.h |  3 +++
 3 files changed, 17 insertions(+), 2 deletions(-)

-- 
2.17.1

Patch

diff --git a/sysdeps/unix/sysv/linux/clock_gettime.c b/sysdeps/unix/sysv/linux/clock_gettime.c
index 4ea56c9a4b..43e378aa83 100644
--- a/sysdeps/unix/sysv/linux/clock_gettime.c
+++ b/sysdeps/unix/sysv/linux/clock_gettime.c
@@ -34,7 +34,11 @@  __clock_gettime64 (clockid_t clock_id, struct __timespec64 *tp)
 #ifdef __ASSUME_TIME64_SYSCALLS
   /* 64 bit ABIs or Newer 32-bit ABIs that only support 64-bit time_t.  */
 # ifdef __NR_clock_gettime64
-  r = INLINE_SYSCALL_CALL (clock_gettime64, clock_id, tp);
+#  ifdef HAVE_CLOCK_GETTIME64_VSYSCALL
+  r = INLINE_VSYSCALL (clock_gettime64, 2, clock_id, tp);
+#  endif
+  if (r == -1)
+    r = INLINE_SYSCALL_CALL (clock_gettime64, clock_id, tp);
 # else
 #  ifdef HAVE_CLOCK_GETTIME_VSYSCALL
   r = INLINE_VSYSCALL (clock_gettime, 2, clock_id, tp);
@@ -45,7 +49,11 @@  __clock_gettime64 (clockid_t clock_id, struct __timespec64 *tp)
 #else
   /* Old 32-bit ABI with possible 64-bit time_t support.  */
 # ifdef __NR_clock_gettime64
-  r = INLINE_SYSCALL_CALL (clock_gettime64, clock_id, tp);
+#  ifdef HAVE_CLOCK_GETTIME64_VSYSCALL
+  r = INLINE_VSYSCALL (clock_gettime64, 2, clock_id, tp);
+#  endif
+  if (r == -1)
+    r = INLINE_SYSCALL_CALL (clock_gettime64, clock_id, tp);
 # endif
   if (r == -1)
     {
diff --git a/sysdeps/unix/sysv/linux/dl-vdso-setup.c b/sysdeps/unix/sysv/linux/dl-vdso-setup.c
index 1069879f1a..d19a4af6c1 100644
--- a/sysdeps/unix/sysv/linux/dl-vdso-setup.c
+++ b/sysdeps/unix/sysv/linux/dl-vdso-setup.c
@@ -45,6 +45,10 @@ 
 PROCINFO_CLASS int (*_dl_vdso_clock_gettime) (clockid_t,
 					      struct timespec *) RELRO;
 #endif
+# ifdef HAVE_CLOCK_GETTIME_VSYSCALL
+PROCINFO_CLASS int (*_dl_vdso_clock_gettime64) (clockid_t,
+						struct __timespec64 *) RELRO;
+#endif
 # ifdef HAVE_GETTIMEOFDAY_VSYSCALL
 PROCINFO_CLASS int (*_dl_vdso_gettimeofday) (struct timeval *, void *) RELRO;
 #endif
diff --git a/sysdeps/unix/sysv/linux/dl-vdso-setup.h b/sysdeps/unix/sysv/linux/dl-vdso-setup.h
index f4e76202fc..8a89e100c8 100644
--- a/sysdeps/unix/sysv/linux/dl-vdso-setup.h
+++ b/sysdeps/unix/sysv/linux/dl-vdso-setup.h
@@ -26,6 +26,9 @@  setup_vdso_pointers (void)
 #ifdef HAVE_CLOCK_GETTIME_VSYSCALL
   GLRO(dl_vdso_clock_gettime) = dl_vdso_vsym (HAVE_CLOCK_GETTIME_VSYSCALL);
 #endif
+#ifdef HAVE_CLOCK_GETTIME64_VSYSCALL
+  GLRO(dl_vdso_clock_gettime64) = dl_vdso_vsym (HAVE_CLOCK_GETTIME64_VSYSCALL);
+#endif
 #ifdef HAVE_GETTIMEOFDAY_VSYSCALL
   GLRO(dl_vdso_gettimeofday) = dl_vdso_vsym (HAVE_GETTIMEOFDAY_VSYSCALL);
 #endif