What are all these changes?

Ulrich Drepper drepper@redhat.com
Fri Mar 15 02:13:00 GMT 2002


In case you are wondering what all these changes I check in are for some
explanations might be good.  The changes mainly address the reduction of
the number of relocations and as a sideeffect optmizes access to
variables.

Let's take ld.so.  The version from RH7.2 which is quite close in
functionality to the linker in the current 2.3 (the 2.3 version has a
bit more functionality like TLS handling) has

   84 relocations, 52 of which are relative
   26 PLT entries

All the relocations have to be processed twice, once for the initial
trivial relocation and then again once everything including the program
is set up correctly.  Of course the data structures are taking up some
space as well.

The ld.so in the current 2.3 code has

   7 relocation, 1 of which is relative
   8 PLT entries

These numbers are final.  None of these 15 entries can be removed
without changing the behavior of ld.so or making it significantly
slower.  The improvements are in code quality as well as startup
overhead.

The story for libc.so is similar.  The code before changes had  about

  2000 relocation, about 1700 relative
  457 PLT entries

(I don't have the exact numbers anymore).  The current 2.3 code has

  1596 relocation, 1479 of which are relative
  418 PLT entries

Already quite a difference.  Each PLT entry must be initialized and
every relocation must be processed.  Relative relocations are quite
cheap (especially with the binutils changes to group them together) but
accessing the memory is always associated with some costs.

Together these changes reduce the startup costs by 15-20%.


The high number of relocations left in libc.so already suggest that
there is more work to do.  This is what I'll do in the next time.  But
it's a rather slow process.  I have some scripts which identify the
possible optimization but making and testing them is time consuming.

-- 
---------------.                          ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at redhat.com   `------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 232 bytes
Desc: This is a digitally signed message part
URL: <http://sourceware.org/pipermail/libc-hacker/attachments/20020315/f1b3ead0/attachment.sig>


More information about the Libc-hacker mailing list