diff mbox

rt: avoid PLT setup in timer_[sg]ettime

Message ID mvmo8up9p8l.fsf@suse.de
State New
Headers show

Commit Message

Andreas Schwab Jan. 27, 2020, 10:18 a.m. UTC
The functions __timer_gettime64 and __timer_settime64 live in librt, not
libc.  Use proper hidden aliases so that the callers do not need to set up
the PLT register.

Fixes commits cae1635a70 ("y2038: linux: Provide __timer_settime64
implementation") and 562cdc19c7 ("y2038: linux: Provide __timer_gettime64
implementation").
---
 include/time.h                          | 4 ++--
 sysdeps/unix/sysv/linux/timer_gettime.c | 3 ++-
 sysdeps/unix/sysv/linux/timer_settime.c | 3 ++-
 3 files changed, 6 insertions(+), 4 deletions(-)

Comments

Lukasz Majewski Jan. 27, 2020, 11:25 a.m. UTC | #1
Hi Andreas,

> The functions __timer_gettime64 and __timer_settime64 live in librt,
> not libc.  Use proper hidden aliases so that the callers do not need
> to set up the PLT register.
> 
> Fixes commits cae1635a70 ("y2038: linux: Provide __timer_settime64
> implementation") and 562cdc19c7 ("y2038: linux: Provide
> __timer_gettime64 implementation").

Thanks for providing this fix. 

The the timer_gettime and timer_settime are indeed added to be build in
rt/Makefile.

> ---
>  include/time.h                          | 4 ++--
>  sysdeps/unix/sysv/linux/timer_gettime.c | 3 ++-
>  sysdeps/unix/sysv/linux/timer_settime.c | 3 ++-
>  3 files changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/include/time.h b/include/time.h
> index e5e8246eac..eff959d642 100644
> --- a/include/time.h
> +++ b/include/time.h
> @@ -183,7 +183,7 @@ libc_hidden_proto (__futimens64);
>  # define __timer_gettime64 __timer_gettime
>  #else
>  extern int __timer_gettime64 (timer_t timerid, struct __itimerspec64
> *value); -libc_hidden_proto (__timer_gettime64);
> +librt_hidden_proto (__timer_gettime64);
>  #endif
>  
>  #if __TIMESIZE == 64
> @@ -192,7 +192,7 @@ libc_hidden_proto (__timer_gettime64);
>  extern int __timer_settime64 (timer_t timerid, int flags,
>                                const struct __itimerspec64 *value,
>                                struct __itimerspec64 *ovalue);
> -libc_hidden_proto (__timer_settime64);
> +librt_hidden_proto (__timer_settime64);
>  #endif
>  
>  /* Compute the `struct tm' representation of T,
> diff --git a/sysdeps/unix/sysv/linux/timer_gettime.c
> b/sysdeps/unix/sysv/linux/timer_gettime.c index
> 669aff8d16..1e07d4845b 100644 ---
> a/sysdeps/unix/sysv/linux/timer_gettime.c +++
> b/sysdeps/unix/sysv/linux/timer_gettime.c @@ -52,6 +52,8 @@
> __timer_gettime64 (timer_t timerid, struct __itimerspec64 *value) }
>  
>  #if __TIMESIZE != 64
> +librt_hidden_def (__timer_gettime64)
> +
>  int
>  __timer_gettime (timer_t timerid, struct itimerspec *value)
>  {
> @@ -67,4 +69,3 @@ __timer_gettime (timer_t timerid, struct itimerspec
> *value) }
>  #endif
>  weak_alias (__timer_gettime, timer_gettime)
> -libc_hidden_def (timer_gettime)
> diff --git a/sysdeps/unix/sysv/linux/timer_settime.c
> b/sysdeps/unix/sysv/linux/timer_settime.c index
> cd302e38d8..c97a9e92ef 100644 ---
> a/sysdeps/unix/sysv/linux/timer_settime.c +++
> b/sysdeps/unix/sysv/linux/timer_settime.c @@ -68,6 +68,8 @@
> __timer_settime64 (timer_t timerid, int flags, }
>  
>  #if __TIMESIZE != 64
> +librt_hidden_def (__timer_settime64)
> +
>  int
>  __timer_settime (timer_t timerid, int flags, const struct itimerspec
> *value, struct itimerspec *ovalue)
> @@ -89,4 +91,3 @@ __timer_settime (timer_t timerid, int flags, const
> struct itimerspec *value, }
>  #endif
>  weak_alias (__timer_settime, timer_settime)
> -libc_hidden_def (timer_settime)

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
diff mbox

Patch

diff --git a/include/time.h b/include/time.h
index e5e8246eac..eff959d642 100644
--- a/include/time.h
+++ b/include/time.h
@@ -183,7 +183,7 @@  libc_hidden_proto (__futimens64);
 # define __timer_gettime64 __timer_gettime
 #else
 extern int __timer_gettime64 (timer_t timerid, struct __itimerspec64 *value);
-libc_hidden_proto (__timer_gettime64);
+librt_hidden_proto (__timer_gettime64);
 #endif
 
 #if __TIMESIZE == 64
@@ -192,7 +192,7 @@  libc_hidden_proto (__timer_gettime64);
 extern int __timer_settime64 (timer_t timerid, int flags,
                               const struct __itimerspec64 *value,
                               struct __itimerspec64 *ovalue);
-libc_hidden_proto (__timer_settime64);
+librt_hidden_proto (__timer_settime64);
 #endif
 
 /* Compute the `struct tm' representation of T,
diff --git a/sysdeps/unix/sysv/linux/timer_gettime.c b/sysdeps/unix/sysv/linux/timer_gettime.c
index 669aff8d16..1e07d4845b 100644
--- a/sysdeps/unix/sysv/linux/timer_gettime.c
+++ b/sysdeps/unix/sysv/linux/timer_gettime.c
@@ -52,6 +52,8 @@  __timer_gettime64 (timer_t timerid, struct __itimerspec64 *value)
 }
 
 #if __TIMESIZE != 64
+librt_hidden_def (__timer_gettime64)
+
 int
 __timer_gettime (timer_t timerid, struct itimerspec *value)
 {
@@ -67,4 +69,3 @@  __timer_gettime (timer_t timerid, struct itimerspec *value)
 }
 #endif
 weak_alias (__timer_gettime, timer_gettime)
-libc_hidden_def (timer_gettime)
diff --git a/sysdeps/unix/sysv/linux/timer_settime.c b/sysdeps/unix/sysv/linux/timer_settime.c
index cd302e38d8..c97a9e92ef 100644
--- a/sysdeps/unix/sysv/linux/timer_settime.c
+++ b/sysdeps/unix/sysv/linux/timer_settime.c
@@ -68,6 +68,8 @@  __timer_settime64 (timer_t timerid, int flags,
 }
 
 #if __TIMESIZE != 64
+librt_hidden_def (__timer_settime64)
+
 int
 __timer_settime (timer_t timerid, int flags, const struct itimerspec *value,
                  struct itimerspec *ovalue)
@@ -89,4 +91,3 @@  __timer_settime (timer_t timerid, int flags, const struct itimerspec *value,
 }
 #endif
 weak_alias (__timer_settime, timer_settime)
-libc_hidden_def (timer_settime)