From b3ae7beabb9f0c219bb8a8b63567a01c6530c1ac Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Fri, 2 Feb 2018 12:15:43 -0500 Subject: [PATCH] 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. --- ldso/dynlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ldso/dynlink.c b/ldso/dynlink.c index 4b4841f9..33802400 100644 --- a/ldso/dynlink.c +++ b/ldso/dynlink.c @@ -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; -- 2.25.1