rtld: Support DT_GNU_HASH (startup performance increase)
authorJohn Marino <draco@marino.st>
Fri, 9 Mar 2012 07:40:34 +0000 (08:40 +0100)
committerJohn Marino <draco@marino.st>
Sun, 11 Mar 2012 08:59:06 +0000 (09:59 +0100)
commit7629c6317998f850ebca23c296822ba08af09e5b
tree8bbc38f27bba9f438369f5645207a6aa48575be2
parent9bf270a9f80267846b5713c75babf4a480dcf670
rtld: Support DT_GNU_HASH (startup performance increase)

This is another "First BSD to get" feature that Linux and Solaris
had years ago.  Essentially DT_GNU_HASH is a GNU extension to the ELF
format that allows symbol searches much faster than the System V ABI
standard hash does.  Both versions of our binutils have the capability
of generating GNU hashes alongside of (or instead of) the SysV hash.

The benefit comes at the real-time link stage when the rtld is
searching the libraries for symbols.  For very large programs
written in languages such as c++ that tend to link in many libraries
with many symbols, the reduction in start-time can be dramatic.

According to benchmarks done by binutils team in 2006, more than 90% of
the symbol queries of OpenOffice Writer are rejected by the Bloom filter
before the string comparison takes place:

http://sources.redhat.com/ml/libc-alpha/2006-07/msg00034.html
libexec/rtld-elf/i386/reloc.c
libexec/rtld-elf/rtld.c
libexec/rtld-elf/rtld.h
libexec/rtld-elf/x86_64/reloc.c