diff mbox series

sysdeps: Add clock_gettime64 vDSO

Message ID 20190918235554.15873-1-alistair.francis@wdc.com
State New
Headers show
Series sysdeps: Add clock_gettime64 vDSO | expand

Commit Message

Alistair Francis Sept. 18, 2019, 11:55 p.m. UTC
Add support for the clock_gettim64 vDSO calls.

2019-09-18  Alistair Francis  <alistair.francis@wdc.com>

	* sysdeps/unix/sysv/linux/init-first.c: Add clock_gettime64
	vDSO.
	* sysdeps/unix/sysv/linux/libc-vdso.h: Likewise.
---
 sysdeps/unix/sysv/linux/init-first.c | 10 ++++++++++
 sysdeps/unix/sysv/linux/libc-vdso.h  |  4 ++++
 2 files changed, 14 insertions(+)

Comments

Maciej W. Rozycki Sept. 19, 2019, 12:26 p.m. UTC | #1
On Wed, 18 Sep 2019, Alistair Francis wrote:

> Add support for the clock_gettim64 vDSO calls.
> 
> 2019-09-18  Alistair Francis  <alistair.francis@wdc.com>
> 
> 	* sysdeps/unix/sysv/linux/init-first.c: Add clock_gettime64
> 	vDSO.
> 	* sysdeps/unix/sysv/linux/libc-vdso.h: Likewise.

 FYI, I believe this requires a complementing change like below.

  Maciej

---
 sysdeps/unix/sysv/linux/riscv/sysdep.h |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

glibc-clock-gettime-vdso-update.diff
Index: glibc/sysdeps/unix/sysv/linux/riscv/sysdep.h
===================================================================
--- glibc.orig/sysdeps/unix/sysv/linux/riscv/sysdep.h
+++ glibc/sysdeps/unix/sysv/linux/riscv/sysdep.h
@@ -199,7 +199,11 @@
 
 /* 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"
+# if __riscv_xlen == 32
+#  define HAVE_CLOCK_GETTIME64_VSYSCALL	"__vdso_clock_gettime64"
+# else
+#  define HAVE_CLOCK_GETTIME_VSYSCALL	"__vdso_clock_gettime"
+# endif
 # define HAVE_GETTIMEOFDAY_VSYSCALL	"__vdso_gettimeofday"
 # define HAVE_GETCPU_VSYSCALL		"__vdso_getcpu"
Alistair Francis Sept. 19, 2019, 9:31 p.m. UTC | #2
On Thu, Sep 19, 2019 at 5:26 AM Maciej W. Rozycki <macro@wdc.com> wrote:
>
> On Wed, 18 Sep 2019, Alistair Francis wrote:
>
> > Add support for the clock_gettim64 vDSO calls.
> >
> > 2019-09-18  Alistair Francis  <alistair.francis@wdc.com>
> >
> >       * sysdeps/unix/sysv/linux/init-first.c: Add clock_gettime64
> >       vDSO.
> >       * sysdeps/unix/sysv/linux/libc-vdso.h: Likewise.
>
>  FYI, I believe this requires a complementing change like below.
>
>   Maciej
>
> ---
>  sysdeps/unix/sysv/linux/riscv/sysdep.h |    6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> glibc-clock-gettime-vdso-update.diff
> Index: glibc/sysdeps/unix/sysv/linux/riscv/sysdep.h
> ===================================================================
> --- glibc.orig/sysdeps/unix/sysv/linux/riscv/sysdep.h
> +++ glibc/sysdeps/unix/sysv/linux/riscv/sysdep.h
> @@ -199,7 +199,11 @@
>
>  /* 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"
> +# if __riscv_xlen == 32
> +#  define HAVE_CLOCK_GETTIME64_VSYSCALL        "__vdso_clock_gettime64"
> +# else
> +#  define HAVE_CLOCK_GETTIME_VSYSCALL  "__vdso_clock_gettime"
> +# endif
>  # define HAVE_GETTIMEOFDAY_VSYSCALL    "__vdso_gettimeofday"
>  # define HAVE_GETCPU_VSYSCALL          "__vdso_getcpu"

Yes, it will. I have a similar change in with the RV32 patches. I
wanted to send this separate to reduce the size of that series.

Alistair

>
diff mbox series

Patch

diff --git a/sysdeps/unix/sysv/linux/init-first.c b/sysdeps/unix/sysv/linux/init-first.c
index d90ca820be0..d005d133220 100644
--- a/sysdeps/unix/sysv/linux/init-first.c
+++ b/sysdeps/unix/sysv/linux/init-first.c
@@ -24,6 +24,11 @@ 
 int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *)
   attribute_hidden;
 #endif
+/* vDSO symbol used on clock_gettime64 implementation.  */
+#ifdef HAVE_CLOCK_GETTIME64_VSYSCALL
+int (*VDSO_SYMBOL(clock_gettime64)) (clockid_t, struct __timespec64 *)
+  attribute_hidden;
+#endif
 /* vDSO symbol used on clock_getres implementation.  */
 #ifdef HAVE_CLOCK_GETRES_VSYSCALL
 int (*VDSO_SYMBOL(clock_getres)) (clockid_t, struct timespec *)
@@ -52,6 +57,11 @@  __libc_vdso_platform_setup (void)
     = get_vdso_mangle_symbol (HAVE_CLOCK_GETTIME_VSYSCALL);
 #endif
 
+#ifdef HAVE_CLOCK_GETTIME64_VSYSCALL
+  VDSO_SYMBOL(clock_gettime64)
+    = get_vdso_mangle_symbol (HAVE_CLOCK_GETTIME64_VSYSCALL);
+#endif
+
 #ifdef HAVE_CLOCK_GETRES_VSYSCALL
   VDSO_SYMBOL(clock_getres)
     = get_vdso_mangle_symbol (HAVE_CLOCK_GETRES_VSYSCALL);
diff --git a/sysdeps/unix/sysv/linux/libc-vdso.h b/sysdeps/unix/sysv/linux/libc-vdso.h
index 792ac39d85a..c6d505bab39 100644
--- a/sysdeps/unix/sysv/linux/libc-vdso.h
+++ b/sysdeps/unix/sysv/linux/libc-vdso.h
@@ -32,6 +32,10 @@ 
 extern int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *)
   attribute_hidden;
 #endif
+#ifdef HAVE_CLOCK_GETTIME64_VSYSCALL
+extern int (*VDSO_SYMBOL(clock_gettime64)) (clockid_t, struct __timespec64 *)
+  attribute_hidden;
+#endif
 #ifdef HAVE_CLOCK_GETRES_VSYSCALL
 extern int (*VDSO_SYMBOL(clock_getres)) (clockid_t, struct timespec *)
   attribute_hidden;