diff mbox series

[v2] linux: Use GLRO(dl_vdso_gettimeofday) on gettimeofday

Message ID 20240905134942.2463850-1-adhemerval.zanella@linaro.org
State Accepted
Commit 02b195d30fdf4d2a396a550ea6044511f1305a9f
Headers show
Series [v2] linux: Use GLRO(dl_vdso_gettimeofday) on gettimeofday | expand

Commit Message

Adhemerval Zanella Netto Sept. 5, 2024, 1:49 p.m. UTC
The BZ#24967 fix (1bdda52fe92fd01b424c) missed the gettimeofday for
architectures that define USE_IFUNC_GETTIMEOFDAY.  Although it is not
an issue, since there is no pointer mangling, there is also no need
to call dl_vdso_vsym since the vDSO setup was already done by the
loader.

Checked on x86_64-linux-gnu and i686-linux-gnu.
--
Change from v1:
* Fixed build on some architectures due a missing INIT_ARCH.
---
 sysdeps/unix/sysv/linux/gettimeofday.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

Comments

Adhemerval Zanella Netto Oct. 2, 2024, 11:38 a.m. UTC | #1
Ping.

On 05/09/24 10:49, Adhemerval Zanella wrote:
> The BZ#24967 fix (1bdda52fe92fd01b424c) missed the gettimeofday for
> architectures that define USE_IFUNC_GETTIMEOFDAY.  Although it is not
> an issue, since there is no pointer mangling, there is also no need
> to call dl_vdso_vsym since the vDSO setup was already done by the
> loader.
> 
> Checked on x86_64-linux-gnu and i686-linux-gnu.
> --
> Change from v1:
> * Fixed build on some architectures due a missing INIT_ARCH.
> ---
>  sysdeps/unix/sysv/linux/gettimeofday.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/gettimeofday.c b/sysdeps/unix/sysv/linux/gettimeofday.c
> index 7ab147c614..afee658e7b 100644
> --- a/sysdeps/unix/sysv/linux/gettimeofday.c
> +++ b/sysdeps/unix/sysv/linux/gettimeofday.c
> @@ -36,12 +36,11 @@ __gettimeofday_syscall (struct timeval *restrict tv, void *restrict tz)
>    return INLINE_SYSCALL_CALL (gettimeofday, tv, tz);
>  }
>  
> -# undef INIT_ARCH
> -# define INIT_ARCH() \
> -  void *vdso_gettimeofday = dl_vdso_vsym (HAVE_GETTIMEOFDAY_VSYSCALL)
> +# define INIT_ARCH()
>  libc_ifunc (__gettimeofday,
> -	    vdso_gettimeofday ? VDSO_IFUNC_RET (vdso_gettimeofday)
> -			      : (void *) __gettimeofday_syscall)
> +	    GLRO(dl_vdso_gettimeofday) != NULL
> +	    ? VDSO_IFUNC_RET (GLRO(dl_vdso_gettimeofday))
> +	    : (void *) __gettimeofday_syscall)
>  
>  # else
>  int
Andreas Schwab Oct. 2, 2024, 12:03 p.m. UTC | #2
On Sep 05 2024, Adhemerval Zanella wrote:

> The BZ#24967 fix (1bdda52fe92fd01b424c) missed the gettimeofday for
> architectures that define USE_IFUNC_GETTIMEOFDAY.  Although it is not
> an issue, since there is no pointer mangling, there is also no need
> to call dl_vdso_vsym since the vDSO setup was already done by the
> loader.

Ok.
diff mbox series

Patch

diff --git a/sysdeps/unix/sysv/linux/gettimeofday.c b/sysdeps/unix/sysv/linux/gettimeofday.c
index 7ab147c614..afee658e7b 100644
--- a/sysdeps/unix/sysv/linux/gettimeofday.c
+++ b/sysdeps/unix/sysv/linux/gettimeofday.c
@@ -36,12 +36,11 @@  __gettimeofday_syscall (struct timeval *restrict tv, void *restrict tz)
   return INLINE_SYSCALL_CALL (gettimeofday, tv, tz);
 }
 
-# undef INIT_ARCH
-# define INIT_ARCH() \
-  void *vdso_gettimeofday = dl_vdso_vsym (HAVE_GETTIMEOFDAY_VSYSCALL)
+# define INIT_ARCH()
 libc_ifunc (__gettimeofday,
-	    vdso_gettimeofday ? VDSO_IFUNC_RET (vdso_gettimeofday)
-			      : (void *) __gettimeofday_syscall)
+	    GLRO(dl_vdso_gettimeofday) != NULL
+	    ? VDSO_IFUNC_RET (GLRO(dl_vdso_gettimeofday))
+	    : (void *) __gettimeofday_syscall)
 
 # else
 int