mirror of git://git.musl-libc.org/musl
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.
This commit is contained in:
parent
c8b49b2fbc
commit
f6870d6b4f
|
@ -1978,7 +1978,7 @@ int dladdr(const void *addr_arg, Dl_info *info)
|
||||||
&& (1<<(sym->st_info&0xf) & OK_TYPES)
|
&& (1<<(sym->st_info&0xf) & OK_TYPES)
|
||||||
&& (1<<(sym->st_info>>4) & OK_BINDS)) {
|
&& (1<<(sym->st_info>>4) & OK_BINDS)) {
|
||||||
size_t symaddr = (size_t)laddr(p, sym->st_value);
|
size_t symaddr = (size_t)laddr(p, sym->st_value);
|
||||||
if (symaddr > addr || symaddr < best)
|
if (symaddr > addr || symaddr <= best)
|
||||||
continue;
|
continue;
|
||||||
best = symaddr;
|
best = symaddr;
|
||||||
bestsym = sym;
|
bestsym = sym;
|
||||||
|
|
Loading…
Reference in New Issue