After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 319557 - loading dl modules should always be lazy on Solaris
loading dl modules should always be lazy on Solaris
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gmodule
2.8.x
Other Solaris
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2005-10-23 21:05 UTC by Laszlo (Laca) Peter
Modified: 2005-10-27 03:52 UTC
See Also:
GNOME target: ---
GNOME version: 2.11/2.12


Attachments
force lazy loading of dl modules on solaris (562 bytes, patch)
2005-10-23 21:11 UTC, Laszlo (Laca) Peter
none Details | Review

Description Laszlo (Laca) Peter 2005-10-23 21:05:55 UTC
Distribution/Version: 5.x

... not sure about other platforms.

Quote from dlopen(3C) on Solaris:

     RTLD_LAZY       Only immediate symbol references  are  relo-
                     cated  when the object is first loaded. Lazy
                     references are not relocated until  a  given
                     function  is called for the first time. This
                     value for mode should  improve  performance,
                     since  a  process might not require all lazy
                     references  in  any   given   object.   This
                     behavior mimics the normal loading of depen-
                     dencies during process  initialization.  See
                     NOTES.

     RTLD_NOW        All necessary relocations are performed when
                     the  object  is  first  loaded. This process
                     might waste some processing  if  relocations
                     are  performed  for lazy references that are
                     never used. However, this mode ensures  that
                     when an object is loaded, all symbols refer-
                     enced during execution are  available.  This
                     behavior  mimics the loading of dependencies
                     when the environment variable LD_BIND_NOW is
                     in effect.

Some modules, for example gtk theme engines are opened with
g_module_open(..., 0), which means RTLD_NOW is used in the dlopen
call.  This causes a noticable performance hit at the startup
of of large applications, such as firefox.

The attached patch makes g_module_open to always use RTLD_LAZY
on Solaris.  One may argue that the calls to g_module_open should
be fixed, but it seems that RTLD_NOW is never the right thing
to do when opening modules.
Comment 1 Laszlo (Laca) Peter 2005-10-23 21:11:05 UTC
Created attachment 53809 [details] [review]
force lazy loading of dl modules on solaris
Comment 2 Matthias Clasen 2005-10-27 03:08:44 UTC
I think we should just make GTK+ use G_MODULE_BIND_LAZY 
Comment 3 Matthias Clasen 2005-10-27 03:19:35 UTC
2005-10-26  Matthias Clasen  <mclasen@redhat.com>

	* gtk/gtkfilesystem.c (gtk_file_system_module_load): 
	* gtk/gtkthemes.c (gtk_theme_engine_load): 
	* gtk/gtkimmodule.c (gtk_im_module_load): Use G_MODULE_BIND_LAZY
	when dlopening modules.  (#319557, Laszlo Peter)
Comment 4 Laszlo (Laca) Peter 2005-10-27 03:41:48 UTC
hmm... fair enough, but then there are loads of other calls that need to
be fixed too. I'll file individual bug reports.
Unfortunately, while any one of those is not fixed, we're haven't achieved
anything.

Other g_module_open (foo, 0) calls in gtk+:

   gtk/gtkimmodule.c
   gtk/gtkfilesystem.c

There are about 30 more throughout the GNOME stack, including 1 in pango,
1 in libglade, 1 in gconf.  These are probably the most critical ones.
Comment 5 Matthias Clasen 2005-10-27 03:52:21 UTC
I have changed all calls in GTK+, and I can probably convince Behdad to fix the
on e in Pango. It might be worth posting this information to the new
performance-list, to get some janitorial effort going.