This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 5/8] Use libc_ifunc macro for clock_* symbols in librt.
- From: Stefan Liebler <stli at linux dot vnet dot ibm dot com>
- To: libc-alpha at sourceware dot org
- Date: Mon, 4 Jul 2016 15:45:15 +0200
- Subject: Re: [PATCH 5/8] Use libc_ifunc macro for clock_* symbols in librt.
- Authentication-results: sourceware.org; auth=none
- References: <1466682952-6301-1-git-send-email-stli@linux.vnet.ibm.com> <1466682952-6301-5-git-send-email-stli@linux.vnet.ibm.com> <3a265423-d832-9226-88b2-b53df2633f6b@redhat.com>
On 07/04/2016 11:14 AM, Florian Weimer wrote:
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
At the moment INIT_ARCH is only defined in
-sysdeps/powerpc/powerpc32/power4/multiarch/init-arch.h
-sysdeps/x86/cpu-features.h
The latter one is included in ldsodefs.h which is included in dl-vdso.h.
Thus the undef is needed in x86/i386 time.c/gettimeofday.c.
I built and run testsuite for intel, power and s390. There did not occur
a redefinition warning.
Nevertheless, this is a good point and I add an undef INIT_ARCH before
the definition in this patch and the other "Use libc_ifunc macro for ABC
in libDEF." patches.
>From d80e99d0fcd917cdd66a8d9697e75de59e67b863 Mon Sep 17 00:00:00 2001
From: Stefan Liebler <stli@linux.vnet.ibm.com>
Date: Mon, 4 Jul 2016 15:33:56 +0200
Subject: [PATCH 5/8] Use libc_ifunc macro for clock_* symbols in librt.
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 | 34 +++++++++++++++-------------------
1 file changed, 15 insertions(+), 19 deletions(-)
diff --git a/rt/clock-compat.c b/rt/clock-compat.c
index dc69e4a..b47781c 100644
--- a/rt/clock-compat.c
+++ b/rt/clock-compat.c
@@ -28,13 +28,9 @@
#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");
+# undef INIT_ARCH
+# define INIT_ARCH()
+# define COMPAT_REDIRECT(name, proto, arglist) libc_ifunc (name, &__##name)
#else
# define COMPAT_REDIRECT(name, proto, arglist) \
int \
@@ -45,21 +41,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
--
2.3.0