This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH, resend] Add x86 32 bit vDSO time function support
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Adhemerval Zanella <azanella at linux dot vnet dot ibm dot com>
- Cc: GNU C Library <libc-alpha at sourceware dot org>
- Date: Mon, 12 Jan 2015 05:51:29 -0800
- Subject: Re: [PATCH, resend] Add x86 32 bit vDSO time function support
- Authentication-results: sourceware.org; auth=none
- References: <54871622 dot 807 at linux dot vnet dot ibm dot com> <54ABF2A9 dot 5010306 at linux dot vnet dot ibm dot com>
On Tue, Jan 6, 2015 at 6:35 AM, Adhemerval Zanella
<azanella@linux.vnet.ibm.com> wrote:
> Ping.
>
> On 09-12-2014 13:32, Adhemerval Zanella wrote:
>> Linux 3.15 adds support for clock_gettime, gettimeofday, and time vDSO
>> (commit id 37c975545ec63320789962bf307f000f08fabd48). This patch adds
>> GLIBC supports to use such symbol when they are avaiable.
>>
>> Along with x86 vDSO support, this patch cleanup x86_64 code by moving
>> all common code to x86 common folder. Only init-first.c is different
>> between implementations.
>>
>> Tested on x86 and x86_64 with a 3.5.0 and a 3.16 kernel.
>>
>> --
>>
>> 2014-12-09 Adhemerval Zanella <azanella@linux.vnet.ibm.com>
>> Stefani Seibold <stefani@seibold.net>
>>
>> * sysdeps/unix/sysv/linux/x86_64/Makefile [$(subdir) = elf]
>> (sysdep_routines): Add dl-vdso here, ...
>> * sysdeps/unix/sysv/linux/x86/Makefile [$(subdir) = elf]
>> (sysdep_routines): ... not here.
>> * sysdeps/unix/sysv/linux/i386/gettimeofday.c: New file: set syscall
>> fallback when vDSO is not presented.
>> * sysdeps/unix/sysv/linux/x86_64/init-first.c (__vdso_clock_gettime):
>> Define with libc_hidden_proto/libc_hidden_data_def definitions.
>> (_libc_vdso_platform_setup): Rename to __vdso_platform_setup.
>> * sysdeps/unix/sysv/linux/i386/init-first.c: New file: likewise.
>> * sysdeps/unix/sysv/linux/i386/time.c: New file: likewise.
>> * sysdeps/unix/sysv/linux/x86_64/bits/libc-vdso.h: Moved to ...
>> * sysdeps/unix/sysv/linux/x86/libc-vdso.h: ... here.
>> * sysdeps/unix/sysv/linux/x86_64/clock_gettime.c: Move to ...
>> * sysdeps/unix/sysv/linux/x86/clock_gettime.c: ... here.
>> * sysdeps/unix/sysv/linux/x86_64/gettimeofday.c: Move to ...
>> * sysdeps/unix/sysv/linux/x86/gettimeofday.c: ... here. Also added
>> fallback configurable symbol when vDSO is not available.
>> * sysdeps/unix/sysv/linux/x86_64/time.c: Move to ...
>> * sysdeps/unix/sysv/linux/x86/time.c: ... here. Also refactored to
>> be able to redefine fallback symbol when vDSO is not available.
>> * sysdeps/unix/sysv/linux/x86_64/timespec_get.c: Move to ...
>> * sysdeps/unix/sysv/linux/x86/timespec_get.c: ... here.
>>
>> --
>>
>> +# include <dl-vdso.h>
>> +# include <errno.h>
>> +
>> +/* If the vDSO is not available we fall back on the syscall. */
>> +static int
>> +__gettimeofday_syscall (struct timeval *tv, struct timezone *tz)
>> +{
>> + return INLINE_SYSCALL (gettimeofday, 2, tv, tz);
>> +}
>> +# define GETTIMEOFAY_FALLBACK (void*) (&__gettimeofday_syscall)
>> +# undef libc_ifunc_hidden_def
>> +# define libc_ifunc_hidden_def(name) \
>> + libc_ifunc_hidden_def1 (__GI_##name, __gettimeofday_syscall)
Why do you define __GI___gettimeofday to __gettimeofday_syscall
instead of the ifunc version? The x86-64 ifunc works fine.
--
H.J.