adjust dladdr dli_fbase definition to match other implementations

the Linux and FreeBSD man pages for dladdr document dli_fbase as the
"base address" of the library/module found. normally (e.g. AT_BASE)
the term "base" is used to denote the base address relative to which
p_vaddr addresses are interpreted; however in the case of dladdr's
Dl_info structure, existing implementations define it as the lowest
address of the mapping, which makes sense in the context of
determining which module's memory range the input address falls
within.

since this is a nonstandard interface provided to mimic one provided
by other implementations, adjust it to match their behavior.
This commit is contained in:
Rich Felker 2018-02-02 12:15:43 -05:00
parent 6f03b61b46
commit b3ae7beabb
1 changed files with 1 additions and 1 deletions

View File

@ -1961,7 +1961,7 @@ int dladdr(const void *addr, Dl_info *info)
best = p->funcdescs + (bestsym - p->syms);
info->dli_fname = p->name;
info->dli_fbase = p->base;
info->dli_fbase = p->map;
info->dli_sname = strings + bestsym->st_name;
info->dli_saddr = best;