diff mbox

[5/8] Use libc_ifunc macro for clock_* symbols in librt.

Message ID 1466682952-6301-5-git-send-email-stli@linux.vnet.ibm.com
State Superseded
Headers show

Commit Message

Stefan Liebler June 23, 2016, 11:55 a.m. UTC
This patch uses the libc_ifunc macro to create already existing ifunc functions
clock_getres, clock_gettime, clock_settime, clock_getcpuclockid and
clock_nanosleep. If HAVE_IFUNC is defined, the macro COMPAT_REDIRECT uses
the libc_ifunc macro.
Furthermore some whitespace damage is cleaned.

ChangeLog:

	* rt/clock-compat.c (COMPAT_REDIRECT): Use libc_ifunc macro.
---
 rt/clock-compat.c | 33 ++++++++++++++-------------------
 1 file changed, 14 insertions(+), 19 deletions(-)

Comments

Florian Weimer July 4, 2016, 9:14 a.m. UTC | #1
On 06/23/2016 01:55 PM, Stefan Liebler wrote:
> +# define INIT_ARCH()
> +# define COMPAT_REDIRECT(name, proto, arglist) libc_ifunc (name, &__##name)

Doesn't this cause INIT_ARCH redefinition warnings in some cases?

Thanks,
Florian
diff mbox

Patch

diff --git a/rt/clock-compat.c b/rt/clock-compat.c
index dc69e4a..b2a4d3b 100644
--- a/rt/clock-compat.c
+++ b/rt/clock-compat.c
@@ -28,13 +28,8 @@ 
 #include <time.h>
 
 #if HAVE_IFUNC
-# define COMPAT_REDIRECT(name, proto, arglist)				      \
-  __typeof (name) *name##_ifunc (void) asm (#name);			      \
-  __typeof (name) *name##_ifunc (void)					      \
-  {									      \
-    return &__##name;							      \
-  }									      \
-  asm (".type " #name ", %gnu_indirect_function");
+# define INIT_ARCH()
+# define COMPAT_REDIRECT(name, proto, arglist) libc_ifunc (name, &__##name)
 #else
 # define COMPAT_REDIRECT(name, proto, arglist)				      \
   int									      \
@@ -45,21 +40,21 @@ 
 #endif
 
 COMPAT_REDIRECT (clock_getres,
-                 (clockid_t clock_id, struct timespec *res),
-                 (clock_id, res))
+		 (clockid_t clock_id, struct timespec *res),
+		 (clock_id, res))
 COMPAT_REDIRECT (clock_gettime,
-                 (clockid_t clock_id, struct timespec *tp),
-                 (clock_id, tp))
+		 (clockid_t clock_id, struct timespec *tp),
+		 (clock_id, tp))
 COMPAT_REDIRECT (clock_settime,
-                 (clockid_t clock_id, const struct timespec *tp),
-                 (clock_id, tp))
+		 (clockid_t clock_id, const struct timespec *tp),
+		 (clock_id, tp))
 COMPAT_REDIRECT (clock_getcpuclockid,
-                 (pid_t pid, clockid_t *clock_id),
-                 (pid, clock_id))
+		 (pid_t pid, clockid_t *clock_id),
+		 (pid, clock_id))
 COMPAT_REDIRECT (clock_nanosleep,
-                 (clockid_t clock_id, int flags,
-                  const struct timespec *req,
-                  struct timespec *rem),
-                 (clock_id, flags, req, rem))
+		 (clockid_t clock_id, int flags,
+		  const struct timespec *req,
+		  struct timespec *rem),
+		 (clock_id, flags, req, rem))
 
 #endif