Dynamic symbol table
Karl Vogel
karl.vogel at seagha.com
Thu Jul 15 23:09:23 CEST 2004
Karl Vogel wrote:
> I noticed that a lot of the .so files have big dynamic symbol tables, as
> if everything is exported. Wouldn't it be better to only export the
> symbols that are really required?!
Seems like it is indeed not needed. I've changed the Makefile.am of
some kcm modules to use a version script which only exports init_*
and create_* symbols.
ie. kdebase/kcontrol/arts/Makefile.am
--- Makefile.am.orig 2004-07-15 22:57:34.848230768 +0200
+++ Makefile.am 2004-07-15 22:26:47.000000000 +0200
@@ -2,7 +2,7 @@
kcm_arts_la_SOURCES = arts.cpp generaltab.ui hardwaretab.ui
-kcm_arts_la_LDFLAGS = $(all_libraries) -module -avoid-version -no-undefined
+kcm_arts_la_LDFLAGS = $(all_libraries) -module -avoid-version -no-undefined -Wl,--version-script=export.ver
kcm_arts_la_LIBADD = $(LIB_KIO) $(LIB_KUTILS) -lkmid
INCLUDES = -I$(kde_includes)/arts $(all_includes)
And I put an export.ver file in the arts directory. The file contents is:
$ cat export.ver
{
global: init_*; create_*;
local: *;
};
After this change the symbol table is nicely reduced to 2 symbols (down from
96 symbols):
$ objdump -CT .libs/kcm_arts.so|grep -v UND|grep DF
00008bb0 g DF .text 00000254 Base init_arts
00009bc0 g DF .text 0000008e Base create_arts
Filesize also benefits from it:
After:
$ ls -l .libs/kcm_arts.so
-rwxrwxr-x 1 kvo kvo 395815 Jul 15 22:39 .libs/kcm_arts.so
Before:
$ ls -l .libs/kcm_arts.so
-rwxrwxr-x 1 kvo kvo 400039 Jul 15 23:00 .libs/kcm_arts.so
The more symbols, the more diskspace is saved ofcourse.. ie:
before:
$ ls -l .libs/kcm_kwindecoration.so
-rwxrwxr-x 1 kvo kvo 609527 Jul 10 01:19 .libs/kcm_kwindecoration.so
after:
$ ls -l .libs/kcm_kwindecoration.so
-rwxrwxr-x 1 kvo kvo 586391 Jul 15 23:03 .libs/kcm_kwindecoration.so
KDE Startup time however isn't reduced.. still 18 seconds for a cold boot..
while only 5 seconds for a warm start :-(
More information about the Kde-optimize
mailing list