diff options
author | jdp <jdp@FreeBSD.org> | 2001-05-05 23:21:05 +0000 |
---|---|---|
committer | jdp <jdp@FreeBSD.org> | 2001-05-05 23:21:05 +0000 |
commit | 66a962ce675f3386156405c78fe7d7a1e6a852bb (patch) | |
tree | 661ed94ee85164ded5139aff0e44eefd488583a9 /libexec/rtld-elf/rtld.h | |
parent | da4bd71ba54c6cef03c8b248a7dd42b16a7b348e (diff) | |
download | FreeBSD-src-66a962ce675f3386156405c78fe7d7a1e6a852bb.zip FreeBSD-src-66a962ce675f3386156405c78fe7d7a1e6a852bb.tar.gz |
Performance improvements for the ELF dynamic linker. These
particularly help programs which load many shared libraries with
a lot of relocations. Large C++ programs such as are found in KDE
are a prime example.
While relocating a shared object, maintain a vector of symbols
which have already been looked up, directly indexed by symbol
number. Typically, symbols which are referenced by a relocation
entry are referenced by many of them. This is the same optimization
I made to the a.out dynamic linker in 1995 (rtld.c revision 1.30).
Also, compare the first character of a sought-after symbol with its
symbol table entry before calling strcmp().
On a PII/400 these changes reduce the start-up time of a typical
KDE program from 833 msec (elapsed) to 370 msec.
MFC after: 5 days
Diffstat (limited to 'libexec/rtld-elf/rtld.h')
-rw-r--r-- | libexec/rtld-elf/rtld.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/libexec/rtld-elf/rtld.h b/libexec/rtld-elf/rtld.h index 5ac7c12..3476826 100644 --- a/libexec/rtld-elf/rtld.h +++ b/libexec/rtld-elf/rtld.h @@ -166,6 +166,15 @@ typedef struct Struct_Obj_Entry { #define RTLD_MAGIC 0xd550b87a #define RTLD_VERSION 1 +/* + * Symbol cache entry used during relocation to avoid multiple lookups + * of the same symbol. + */ +typedef struct Struct_SymCache { + const Elf_Sym *sym; /* Symbol table entry */ + const Obj_Entry *obj; /* Shared object which defines it */ +} SymCache; + extern void _rtld_error(const char *, ...) __printflike(1, 2); extern Obj_Entry *map_object(int, const char *, const struct stat *); extern void *xcalloc(size_t); @@ -179,7 +188,7 @@ extern Elf_Addr _GLOBAL_OFFSET_TABLE_[]; int do_copy_relocations(Obj_Entry *); unsigned long elf_hash(const char *); const Elf_Sym *find_symdef(unsigned long, const Obj_Entry *, - const Obj_Entry **, bool); + const Obj_Entry **, bool, SymCache *); void init_pltgot(Obj_Entry *); void lockdflt_init(LockInfo *); void obj_free(Obj_Entry *); |