G DEFINE TYPE

From Buzztrax

Jump to: navigation, search

G_DEFINE_TYPE*, G_IMPLEMENT_INTERFACE are glib 2.4 (thus safe to be used for us). The advantage are:

* less code needed
* thread safety
* less relocations

At first it seems it actually would produce two more PLT entries :/, but see below:

// before
$ objdump -p /home/ensonic/buzztrax/lib/libbuzztrax-core.so.0.6.0  | grep REL
  PLTRELSZ             0x000011f8
  JMPREL               0x0000916c
  REL                  0x00008d1c
$ relinfo.pl /home/ensonic/buzztrax/lib/libbuzztrax-core.so.0.6.0
138 relocations, 109 relative (78%), 575 PLT entries, 153 for local syms (26%), 0 users
// after
$ objdump -p /home/ensonic/buzztrax/lib/libbuzztrax-core.so.0.6.0  | grep REL
  PLTRELSZ             0x00001208
  JMPREL               0x000091cc
  REL                  0x00008d7c
$ relinfo.pl /home/ensonic/buzztrax/lib/libbuzztrax-core.so.0.6.0
138 relocations, 109 relative (78%), 577 PLT entries, 153 for local syms (26%), 0 users
// delta
  PLTRELSZ + 0x10
  JMPREL   + 0x60
  REL      + 0x60
// compare
objdump -R /home/ensonic/buzztrax/lib/libbuzztrax-core.so.0.6.0 | sed "s%  *% %g" | cut -d" " -f 3- | sort >rel.before
g_intern_static_string
g_type_register_static_simple

Voila, the extra relocations should disaapear, once we totally switched to it.

Support Us

Collaboration

GStreamer Logo
Become a Friend of GNOME
Linux Sound Logo
MediaWiki
Valgrind
GNU Library Public Licence
GNU Free Documentation License 1.2