This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: [PATCH] ppc vdso, A working gettimeofday
- From: Steve Munroe <sjmunroe at us dot ibm dot com>
- To: Ulrich Drepper <drepper at redhat dot com>
- Cc: libc-alpha at sources dot redhat dot com, Roland McGrath <roland at redhat dot com>
- Date: Mon, 2 May 2005 10:14:23 -0500
- Subject: Re: [PATCH] ppc vdso, A working gettimeofday
Ulrich Drepper <drepper@redhat.com> wrote on 04/29/2005 05:29:19 PM:
> Steve Munroe wrote:
>
> > + _dl_vdso_sym; _dl_vdso_vsym;
>
> There is no reason to add these symbols anywhere but ppc/linux. Despite
> what you might want to believe, ppc/linux is not the only platform that
> matters.
>
Resolving symbols in a VDSO seems like a common GLIBC/Linux problem. So I
was trying to provide a common GLIBC/Linux solution.
>
> > diff -urN libc24-cvstip-20050427/elf/dl-vdso.c libc24/elf/dl-vdso.c
> > --- libc24-cvstip-20050427/elf/dl-vdso.c Wed Dec 31 18:00:00 1969
> > +++ libc24/elf/dl-vdso.c Thu Apr 28 17:26:43 2005
> > @@ -0,0 +1,85 @@
>
> Likewise for this file. Move in specific directory.
>
Oops that should have gone to sysdeps/unix/sysv/linux as VDSO is Linux
specific but not necessarily powerpc specific.
>
> Haven't you paid any attention to the coding standard in all this time?
> Fix the indentation.
>
Done.
>
> > diff -urN libc24-cvstip-20050427/elf/rtld.c libc24/elf/rtld.c
> > --- libc24-cvstip-20050427/elf/rtld.c 2005-04-07 15:56:48.000000000
-0500
> > +++ libc24/elf/rtld.c 2005-04-27 15:52:25.000000000 -0500
> > @@ -1274,6 +1274,13 @@
> > elf_get_dynamic_info (l, dyn_temp);
> > _dl_setup_hash (l);
> > l->l_relocated = 1;
> > + /* Initialize l_local_scope to contain just this map. This
allows
> > + the use of dl_lookup_symbol_x to resolve symbols within the
vdso.
> > + So we create a single entry list pointing to l_real as its
only
> > + element */
> > +
> > + l->l_local_scope[0]->r_nlist = 1;
> > + l->l_local_scope[0]->r_list = &l->l_real;
>
> They is this needed?
>
Yes. Otherwise do_lookup_x segfaults at statement:
45 map = list[i]->l_real;
>
> > diff -urN libc24-cvstip-20050427/sysdeps/powerpc/elf/libc-start.c
> libc24/sysdeps/powerpc/elf/libc-start.c
> > --- libc24-cvstip-20050427/sysdeps/powerpc/elf/libc-start.c
> 2004-04-03 19:06:07.000000000 -0600
> > +++ libc24/sysdeps/powerpc/elf/libc-start.c 2005-04-29 15:48:44.
> 000000000 -0500
> > @@ -18,6 +18,7 @@
> > [...]
> > +#ifdef SHARED
> > +#undef __gettimeofday
> > +#include <bits/libc-vdso.h>
> > +
> > +__typeof (__gettimeofday) *__vdso_gettimeofday attribute_hidden;
> > +
> > +#if __WORDSIZE == 64
> > +typedef struct
> > + {
> > + void *func;
> > + void *toc_ptr;
> > + void *extra;
> > + } _ppc_func_desciptor;
> > +
> > +static struct
> > + {
> > + _ppc_func_desciptor fd_gettimeofday;
> > + } __vdso_descriptor;
> > +#endif
>
> That's ppc/linux specific and doesn't have any business being in this
file.
>
Yes but sysdeps/powerpc/elf/libc-start.c is a powerpc specific file. :)
> > --- libc24-cvstip-20050427/sysdeps/unix/sysv/linux/Makefile
> 2004-10-04 18:29:06.000000000 -0500
> > +++ libc24/sysdeps/unix/sysv/linux/Makefile 2005-04-28 16:32:00.
> 000000000 -0500
> > @@ -142,6 +142,7 @@
> >
> > ifeq ($(subdir),elf)
> > sysdep-rtld-routines += dl-brk dl-sbrk
> > +routines += dl-vdso
>
> Once again, wrong file.
>
Unless we can agree that resolving symbols in VDSO is a common GLIBC/Linux
issue and should have a common GLIBC/Linux solution.
Steven J. Munroe
Linux on Power Toolchain Architect
IBM Corporation, Linux Technology Center