Always return pathname in dl_iterate_phdr's dlpi_name, as Linux does

Linux LD_ITERATE_PHDR(3):
    The dlpi_name field is a null-terminated string giving the
    pathname from which the shared object was loaded.

That functionality is much more useful than returning just the short
name.

Approved by:	kan
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Ed Maste 2014-10-09 20:39:18 +00:00
parent e03159ea69
commit 54ac10780f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=272842

View File

@ -3377,8 +3377,7 @@ rtld_fill_dl_phdr_info(const Obj_Entry *obj, struct dl_phdr_info *phdr_info)
{
phdr_info->dlpi_addr = (Elf_Addr)obj->relocbase;
phdr_info->dlpi_name = STAILQ_FIRST(&obj->names) ?
STAILQ_FIRST(&obj->names)->name : obj->path;
phdr_info->dlpi_name = obj->path;
phdr_info->dlpi_phdr = obj->phdr;
phdr_info->dlpi_phnum = obj->phsize / sizeof(obj->phdr[0]);
phdr_info->dlpi_tls_modid = obj->tlsindex;