Reducing library dependancies

Thiago Macieira thiago at kde.org
Mon Aug 4 18:21:21 BST 2008


On Monday 04 August 2008 17:21:43 Maksim Orlovich wrote:
> > libkdeui.so.5: 15390 relocations, 5801 relative (37%), 2591 PLT entries,
> > 0 for local syms (0%), 0 users
>
> Ouch. Any good way of getting an idea of what the non-relative ones are?

Yes, results attached. Command was:

eu-readelf -r libkdeui.so | \
	awk '/386_(32|GLOB_DAT)/ {print $4}' | \
	uniq -c | \
	sort -n -r | \
	c++filt

The number to the left is the number of times the symbol is used. There are 
1551 distinct symbols in use, 936 of which are used only once, 261 twice, 91 
three times (or 1288 symbols for 1731 relocations).

You will notice that the symbols most used are those required for the virtual 
tables. That means we have 244 non-trivial classes in kdeui, and at least 226 
of those derive ultimately from QObject.

The only way to reduce this count is to convince the gcc and binutils people 
that a relocation type specific for virtual tables is a must.

There are also 2591 distinct functions called directly (not through the 
virtual table), but PLT entries are resolved lazily, so the impact is not that 
great. About 2100 go to Qt functions, 315 to kdecore, 74 to X11 and Smc; the 
rest is libc and C++ runtime (including system(3).

For comparison, kdecore has 154 classes (61 from QObject), KIO has 185 classes 
(144), and the start of the dump for QtGui is as follows:

    548 vtable for __cxxabiv1::__si_class_type_info
    280 QObject::disconnectNotify(char const*)
    280 QObject::customEvent(QEvent*)
    279 QObject::connectNotify(char const*)
    263 QObject::childEvent(QChildEvent*)
    254 __cxa_pure_virtual
    229 QObject::eventFilter(QObject*, QEvent*)
    206 QObject::timerEvent(QTimerEvent*)
    114 QObject::event(QEvent*)
     59 typeinfo for QWidget
     54 typeinfo for QObject
     53 QObject::staticMetaObject
     49 QWidget::staticMetaObject
     41 vtable for __cxxabiv1::__class_type_info
     33 typeinfo for QWidgetPrivate
     31 typeinfo for QObjectPrivate
     26 typeinfo for QEvent
     22 vtable for __cxxabiv1::__vmi_class_type_info
     15 QAbstractItemModel::buddy(QModelIndex const&) const
     14 typeinfo for QDialog
     14 QAbstractItemModel::match(QModelIndex const&, int, QVariant const&, 
int, QFlags<Qt::MatchFlag>) const
     14 QAbstractItemModel::span(QModelIndex const&) const
     14 QAbstractItemModel::canFetchMore(QModelIndex const&) const
     13 QDialog::staticMetaObject
     13 QAbstractItemModel::fetchMore(QModelIndex const&)
     13 QAbstractItemModel::setItemData(QModelIndex const&, QMap<int, 
QVariant> const&)
     12 QAbstractItemModel::submit()
     12 QAbstractItemModel::revert()
     11 typeinfo for QFrame
     11 QAbstractItemModel::removeColumns(int, int, QModelIndex const&)
     10 QFrame::staticMetaObject

-- 
  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: kdeui-relocation-dump.zip
Type: application/zip
Size: 10141 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20080804/73b5acae/attachment.zip>
-------------- 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/73b5acae/attachment.sig>


More information about the kde-core-devel mailing list