diff options
author | Rich Felker <dalias@aerifal.cx> | 2018-06-28 12:07:51 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2018-06-28 12:07:51 -0400 |
commit | f6870d6b4f32c99fdbf4367422820218b2f638bb (patch) | |
tree | 3f4f6fc7565c7b5923c8af5661a0dbc592796189 | |
parent | c8b49b2fbc7faa8bf065220f11963d76c8a2eb93 (diff) | |
download | musl-f6870d6b4f32c99fdbf4367422820218b2f638bb.tar.gz musl-f6870d6b4f32c99fdbf4367422820218b2f638bb.tar.bz2 musl-f6870d6b4f32c99fdbf4367422820218b2f638bb.tar.xz musl-f6870d6b4f32c99fdbf4367422820218b2f638bb.zip |
make dladdr consistently produce the first symbol in presence of aliases
the early-exit condition for the symbol match loop on exact matches
caused dladdr to produce the first match for an exact match, but the
last match for an inexact match. in the interest of consistency,
require a strictly-closer match to replace an already-found one.
-rw-r--r-- | ldso/dynlink.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/ldso/dynlink.c b/ldso/dynlink.c index d963aeab..a773b782 100644 --- a/ldso/dynlink.c +++ b/ldso/dynlink.c @@ -1978,7 +1978,7 @@ int dladdr(const void *addr_arg, Dl_info *info) && (1<<(sym->st_info&0xf) & OK_TYPES) && (1<<(sym->st_info>>4) & OK_BINDS)) { size_t symaddr = (size_t)laddr(p, sym->st_value); - if (symaddr > addr || symaddr < best) + if (symaddr > addr || symaddr <= best) continue; best = symaddr; bestsym = sym; |