]> git.ipfire.org Git - thirdparty/glibc.git/commit
dlsym: Do not determine caller link map if not needed
authorFlorian Weimer <fweimer@redhat.com>
Fri, 8 Nov 2019 14:48:51 +0000 (15:48 +0100)
committerFlorian Weimer <fweimer@redhat.com>
Mon, 11 Nov 2019 13:18:36 +0000 (14:18 +0100)
commit6e18a8ddf1f60596e84e25f3af4bb8f0c27ffe2a
treef01af137c69a20844cf5618a1172d573c9dbb63b
parent10cf7f52c60209f34199d216ef6710568d6297bf
dlsym: Do not determine caller link map if not needed

Obtaining the link map is potentially very slow because it requires
iterating over all loaded objects in the current implementation.  If
the caller supplied an explicit handle (i.e., not one of the RTLD_*
constants), the dlsym implementation does not need the identity of the
caller (except in the special cause of auditing), so this change
avoids computing it in that case.

Even in the minimal case (dlsym called from a main program linked with
-dl), this shows a small speedup, perhaps around five percent.  The
performance improvement can be arbitrarily large in principle (if
_dl_find_dso_for_object has to iterate over many link maps).

Change-Id: Ide5d9e2cc7ac25a0ffae8fb4c26def0c898efa29
elf/dl-sym.c