Reducing library dependancies
Thiago Macieira
thiago at kde.org
Mon Aug 4 16:16:09 BST 2008
On Monday 04 August 2008 15:59:12 Dirk Mueller wrote:
> It also reminds me that almost everything links against kio for (little)
> reason. KIO is an extremely huge dependency. It pulls in 3 different XML
> readers alone (QtXml for some kdecore stuff, libxml2 for strigi support
> (which is only needed optionally in one kio class, and expat for fontconfig
> parsing (because kio depends on kdeui for historic reasons). libxml2 is a
> big dependency, it has a lot of relocations against internal symbols
> (-Bsymbic- functions would help with that but not every distribution builds
> with it).
QtXml in KIO and in kdecore would be one of the libraries pruned by --as-
needed. It's not needed in KIO nor in kdecore.
It's an indirect dependency only because QtDBus uses it. But since it doesn't
expose that in the API, I have a task to rewrite the parser to
QXmlStreamReader (which is in QtCore).
Also, I don't see libexpat in my kdeui's ldd. Does fontconfig dynamically load
it?
As for libxml2, here's the result in my distro:
$ relinfo.pl /usr/lib/libxml2.so.2
/usr/lib/libxml2.so.2: 3196 relocations, 3108 relative (97%), 142 PLT entries,
45 for local syms (31%), 0 users
That's 86 non-relative relocations and 45 functions calls that would be pruned
with -Bsymbolic-functions.
That's not too bad, compared to our own stuff:
$ ldd libkio.so.5 | awk '{print $3}' | xargs relinfo.pl | sed 's,^.*/,,' |
sort -k2 -n -r | head -n 10
libQtGui.so.4: 23444 relocations, 18668 relative (79%), 1314 PLT entries, 1
for local syms (0%), 0 users
libkdeui.so.5: 15390 relocations, 5801 relative (37%), 2591 PLT entries, 0 for
local syms (0%), 0 users
libkdecore.so.5: 4928 relocations, 3045 relative (61%), 923 PLT entries, 0 for
local syms (0%), 0 users
libsolid.so.4: 3984 relocations, 2520 relative (63%), 215 PLT entries, 0 for
local syms (0%), 0 users
libxml2.so.2: 3196 relocations, 3108 relative (97%), 142 PLT entries, 45 for
local syms (31%), 0 users
libstdc++.so.6: 2453 relocations, 469 relative (19%), 595 PLT entries, 484 for
local syms (81%), 0 users
libQtCore.so.4: 2451 relocations, 1871 relative (76%), 214 PLT entries, 4 for
local syms (1%), 0 users
libQtNetwork.so.4: 1679 relocations, 960 relative (57%), 467 PLT entries, 0
for local syms (0%), 0 users
libc.so.6: 1340 relocations, 1244 relative (92%), 7 PLT entries, 6 for local
syms (85%), 0 users
libX11.so.6: 1079 relocations, 853 relative (79%), 651 PLT entries, 519 for
local syms (79%), 0 users
Qt and KDE are built with -Bsymbolic-functions. That means no use of the PLT
to call local functions.
But, yeah, libxml2 is the fifth place in relocation count for libkio. In my
system, requires 64828 relocations in total, of which 4.9% come from libxml2.
Another fact: of the 64828 relocations, 42100 are relative. Of the 22k that
aren't relative, 10k come from libkdeui.
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20080804/837b7880/attachment.sig>
More information about the kde-core-devel
mailing list