This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: [Dri-devel] Re: OpenGL and the LinuxThreads pthread_descr structure
Jakub Jelinek wrote:
>
> On Fri, May 17, 2002 at 12:30:56AM +0100, Keith Whitwell wrote:
> > > BTW: Last time I looked at libGL (in March), these were things which I
> > > came over:
> > > 1) libGL should IMHO use a version script (at least an anonymous one
> > > if you want to avoid assigning a specific GL_x.y symbol version to it),
> > > that way you get rid of thousands of expensive run-time relocations
> >
> > Where can I get info on this?
>
> info ld, study glibc sources.
>
> Just checked the latest libGL.so, it has:
> 0x00000016 (TEXTREL) 0x0
> 0x6ffffffa (RELCOUNT) 3615
> 0x00000000 (NULL) 0x0
>
> Relocation section '.rel.dyn' at offset 0x14074 contains 12341 entries:
>
> This effectively means libGL.so is not a shared library at all and takes
> awfully lot of time to load during program startup.
Yes, we've been aware of this for a little while. One thing that we've got a
bit of in there is assembly for the non-threaded dispatch case (the opensource
libGL.so doesn't really handle the threaded case in a performant way, but
we've made some effort on the non-threaded case), that looks a bit like this:
ALIGNTEXT16
GLOBL_FN(GL_PREFIX(NewList))
GL_PREFIX(NewList):
MOV_L(GLNAME(_glapi_Dispatch), EAX)
JMP(GL_OFFSET(_gloffset_NewList))
This generates the library entrypoint 'glNewList', which just grabs the active
dispatch table and jumps to the real function. I had some emails with HJ Lu
about this, but didn't really get what he was saying. Are these a problem for
building with -fPIC? I'm not really interested in giving this up as I believe
any benefits from -fPIC will be quickly outweighed by any loss at the dispatch
layer.
> What you can and should do:
>
> create either linker script like:
> { global: gl*; DRI*; XF86DRI*; local: *; }
> or
> GL_1.0 { global: gl*; DRI*; XF86DRI*; local: *; }
> then pass this file to linker at libGL.so link time, like
> gcc -shared ... -Wl,--version-script,libGL.map ...
I'm playing with this now.
Keith