]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
linux: Add support for clock_gettime64 vDSO
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Wed, 11 Dec 2019 14:13:50 +0000 (11:13 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Fri, 3 Jan 2020 14:22:07 +0000 (11:22 -0300)
No architecture currently defines the vDSO symbol.  On architectures
with 64-bit time_t the HAVE_CLOCK_GETTIME_VSYSCALL is renamed to
HAVE_CLOCK_GETTIME64_VSYSCALL, it simplifies clock_gettime code.

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
sysdeps/unix/sysv/linux/aarch64/sysdep.h
sysdeps/unix/sysv/linux/clock_gettime.c
sysdeps/unix/sysv/linux/dl-vdso-setup.c
sysdeps/unix/sysv/linux/dl-vdso-setup.h
sysdeps/unix/sysv/linux/powerpc/sysdep.h
sysdeps/unix/sysv/linux/riscv/sysdep.h
sysdeps/unix/sysv/linux/s390/sysdep.h
sysdeps/unix/sysv/linux/sparc/sysdep.h
sysdeps/unix/sysv/linux/x86_64/sysdep.h

index da3df3e2449d5d630f6ecf3e9843ec024300aa0d..982851287c89cb26854383d26eece64828792910 100644 (file)
 
 /* List of system calls which are supported as vsyscalls.  */
 # define HAVE_CLOCK_GETRES_VSYSCALL    "__kernel_clock_getres"
-# define HAVE_CLOCK_GETTIME_VSYSCALL   "__kernel_clock_gettime"
+# define HAVE_CLOCK_GETTIME64_VSYSCALL "__kernel_clock_gettime"
 # define HAVE_GETTIMEOFDAY_VSYSCALL    "__kernel_gettimeofday"
 
 /* Previously AArch64 used the generic version without the libc_hidden_def
index 74aadbfbd4ea601c3a8af1a7716dde390f6e4382..a530daef1c96b8a1ec0a7f69bb33fb1af5d39694 100644 (file)
@@ -30,21 +30,24 @@ int
 __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
-  return INLINE_SYSCALL_CALL (clock_gettime64, clock_id, tp);
+  /* 64 bit ABIs or newer 32-bit ABIs that only support 64-bit time_t.  */
+# ifndef __NR_clock_gettime64
+#  define __NR_clock_gettime64 __NR_clock_gettime
+# endif
+# ifdef HAVE_CLOCK_GETTIME64_VSYSCALL
+  return INLINE_VSYSCALL (clock_gettime64, 2, clock_id, tp);
 # else
-#  ifdef HAVE_CLOCK_GETTIME_VSYSCALL
-  return INLINE_VSYSCALL (clock_gettime, 2, clock_id, tp);
-#  else
-  return INLINE_SYSCALL_CALL (clock_gettime, clock_id, tp);
-#  endif
+  return INLINE_SYSCALL_CALL (clock_gettime64, clock_id, tp);
 # endif
 #else
   int r;
   /* Old 32-bit ABI with possible 64-bit time_t support.  */
 # ifdef __NR_clock_gettime64
+#  ifdef HAVE_CLOCK_GETTIME64_VSYSCALL
+  r = INLINE_VSYSCALL (clock_gettime64, 2, clock_id, tp);
+#  else
   r = INLINE_SYSCALL_CALL (clock_gettime64, clock_id, tp);
+#  endif
   if (r == 0 || errno != ENOSYS)
     return r;
 # endif
index 352fcae5292601976c22f02dc188ad17fbca70c3..3e92aa1f98e7fca8330ba5f40e0b3f895b8ffb81 100644 (file)
 PROCINFO_CLASS int (*_dl_vdso_clock_gettime) (clockid_t,
                                              struct timespec *) RELRO;
 #endif
+# ifdef HAVE_CLOCK_GETTIME64_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
index 9f5e4a3b0bf8b7426a3f010948aeba0d5024fef8..11a1e867aea81d02b023eed6b65ed83b125c91af 100644 (file)
@@ -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
index aac0dafeb7a94fe6f2a1402603e25c8e9a66a549..4491ddc421396c22741e267fedc218e539d8e3a5 100644 (file)
 
 /* List of system calls which are supported as vsyscalls.  */
 #define HAVE_CLOCK_GETRES_VSYSCALL     "__kernel_clock_getres"
+#if defined(__PPC64__) || defined(__powerpc64__)
+#define HAVE_CLOCK_GETTIME64_VSYSCALL  "__kernel_clock_gettime"
+#else
 #define HAVE_CLOCK_GETTIME_VSYSCALL    "__kernel_clock_gettime"
+#endif
 #define HAVE_GETCPU_VSYSCALL           "__kernel_getcpu"
 #define HAVE_TIME_VSYSCALL             "__kernel_time"
 #define HAVE_GETTIMEOFDAY_VSYSCALL      "__kernel_gettimeofday"
index bfbcf60feb37be83faafa53c844ca9f65716632f..7f43595cb0c71c490b52a9f3ead1c301a0f349ca 100644 (file)
 
 /* List of system calls which are supported as vsyscalls.  */
 # define HAVE_CLOCK_GETRES_VSYSCALL    "__vdso_clock_getres"
-# define HAVE_CLOCK_GETTIME_VSYSCALL   "__vdso_clock_gettime"
+# define HAVE_CLOCK_GETTIME64_VSYSCALL "__vdso_clock_gettime"
 # define HAVE_GETTIMEOFDAY_VSYSCALL    "__vdso_gettimeofday"
 # define HAVE_GETCPU_VSYSCALL          "__vdso_getcpu"
 
index bb89e1192f1c713042318166f6b24587ec6c0c70..a53c8ff44bb11464f475b5e6d68052257437df9c 100644 (file)
 
 /* List of system calls which are supported as vsyscalls.  */
 #define HAVE_CLOCK_GETRES_VSYSCALL     "__kernel_clock_getres"
+#ifdef __s390x__
+#define HAVE_CLOCK_GETTIME64_VSYSCALL  "__kernel_clock_gettime"
+#else
 #define HAVE_CLOCK_GETTIME_VSYSCALL    "__kernel_clock_gettime"
+#endif
 #define HAVE_GETTIMEOFDAY_VSYSCALL     "__kernel_gettimeofday"
 #define HAVE_GETCPU_VSYSCALL           "__kernel_getcpu"
index 9f96f3b1c5852d78cc4a468dd9f77018fa260530..0c32780d9c61bf977e0d8f707e0f35a9028c8d83 100644 (file)
 # define VDSO_HASH  61765110
 
 /* List of system calls which are supported as vsyscalls.  */
-# define HAVE_CLOCK_GETTIME_VSYSCALL   "__vdso_clock_gettime"
+# ifdef __arch64__
+#  define HAVE_CLOCK_GETTIME64_VSYSCALL        "__vdso_clock_gettime"
+# else
+#  define HAVE_CLOCK_GETTIME_VSYSCALL  "__vdso_clock_gettime"
+# endif
 # define HAVE_GETTIMEOFDAY_VSYSCALL    "__vdso_gettimeofday"
 
 #undef INLINE_SYSCALL
index b8a1a512666e03edcb322bd7b388b46cd61d036e..46df401c2da03bd0d1e4006b01d9c0e9b113ffc6 100644 (file)
 # define VDSO_HASH  61765110
 
 /* List of system calls which are supported as vsyscalls.  */
-# define HAVE_CLOCK_GETTIME_VSYSCALL    "__vdso_clock_gettime"
+# define HAVE_CLOCK_GETTIME64_VSYSCALL  "__vdso_clock_gettime"
 # define HAVE_GETTIMEOFDAY_VSYSCALL     "__vdso_gettimeofday"
 # define HAVE_TIME_VSYSCALL             "__vdso_time"
 # define HAVE_GETCPU_VSYSCALL          "__vdso_getcpu"