[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-optimize
Subject:    Re: Prelink and libGL.so : a tip
From:       Leon Bottou <leon () bottou ! org>
Date:       2003-12-02 20:08:07
[Download RAW message or body]


It seems that Jakub would favor using weakly 
undefined symbols for the libGL.so dependencies.
If of course this can be made to work nicely with KDE.

That would involve adding the following in the Qgl cpp files:
	#pragma weak glCallLists
	#pragma weak glXXXX
	...   // for all required libGL.so functions
plus a few well placed tests to prevent creating Qgl objects
if these functions resolve to NULL...

- L.




On Tue, Dec 02, 2003 at 01:57:21PM -0500, Leon Bottou wrote:
> I saw some exchanges on a mailing list a while ago linking this
> issue to their implementation of thread local variables, etc.
> This seems a complicated issue.  

The XFree86 libGL.so we ship uses TLS and works...
It is really not that complicated.

> > As for your http://lists.kde.org/?l=kde-optimize&m=107007239305615&w=2
> > patch, I'd strongly suggest using different names of the stubs than
> > the names of the functions in libGL.so, since it otherwise creates
> > unnecessary prelink conflicts depending whether libqt comes before
> > libGL.so in search scope.  Also, I think it is better to do all the
> > initialization in one routine (perhaps also guarded with weak pthread_once)
> > so that the stubs are as small as possible.
> 
> Sounds right.
> 
> The conflicts only affect the applications that actually make use of openGL
> (meaning that they are explicitely linked with libGL.so).   But these
> cannot be prelinked at the moment since libGL.so is non pic.

That's not true.  The whole world is not NVidia.

> The pthread_once is definitely missing.

#include <pthread.h>
#pragma weak pthread_once
static pthread_once_t once_control = PTHREAD_ONCE_INIT;
static void *libgl_handle;
if (libgl_handle == NULL)
  {
    if (pthread_once)
      pthread_once (&once_control, init_libgl);
    else
      init_libgl ();
  }

?

> I wonder if we really need to do a dlopen("libGL.so",...).
> All applications that use these classes should be linked with -lGL.
> Maybe weakly undefined symbols would do the trick just as well.

If the KDE folks say it is ok, that is surely the best way to do it.

	Jakub


_______________________________________________
Kde-optimize mailing list
Kde-optimize@kde.org
https://mail.kde.org/mailman/listinfo/kde-optimize
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic