ELF prelinking - 0.0.0alpha
Jakub Jelinek
jakub@redhat.com
Thu Jun 14 13:52:00 GMT 2001
Hi!
As I'm leaving tomorrow for vacation, I've put what I have so far with ELF
prelinking to
ftp://people.redhat.com/jakub/prelink/prelink-20010614.tar.bz2
Included in that package are two patches (binutils and glibc) plus the
actual prelink utility.
There is still lots of work to do, namely:
- add undo mode, so that one can convert a prelinked library/binary back
to the state how it was created by ld
- add verify mode to verify the library has not been mucked with after
prelinking
(these two modes together could be used for system verification in
presence of prelinking)
- the prelink utility currently works in a single library/binary per
invocation only ATM (library extents are stored in /etc/prelink.cache).
The desired mode of operation is that it works similarly to ldconfig,
ie. /etc/prelink.conf gives list of lib paths and the utility prelinks
all libs in there, then prelinks all binaries
- a sub-item of this is to check carefully for memory leaks, because
when all libs will be prelinked by a single program, every memory leak
counts
- although the utility converts .rel*.* sections but .rel*.plt into
.gnu.reloc while sorting relocs carefully and filling
DT_RELCOUNT/DT_RELACOUNT, the included glibc patch does not take advantage
of this yes (if prelinking is successful, it is not that severe, but for
dlopening etc. it should:
- cache in _dl_lookup_symbol and _dl_lookup_versioned_symbol last symbol
lookup (.gnu.reloc section sorting makes sure relocs against the same
symbol are together)
- if l_addr == 0 (even during dlopen etc.), check if DT_REL{,A}COUNT is
non-zero and if yes and last non-PLT reloc is of R_*_RELATIVE type,
then it can skip all relocs from non-PLT-reloc-count - DT_REL{,A}COUNT + 1
up (e.g. for my glibc there are 300 non-relative relocs first, then
DT_RELACOUNT=1627 R_386_RELATIVE relocs, so if prelinking cannot be
used but glibc is successfully mmaped where it wants, then 1627 relocs
can be cheaply skipped)
- once the above is done, the program needs more ports beyond i386 and
any time more testing
Jakub
More information about the Libc-alpha
mailing list