From: John Marino Date: Sun, 30 Nov 2014 10:06:04 +0000 (+0100) Subject: rtld: Allows return pathname in dl_iterate_phdr dlpi_name X-Git-Tag: v4.2.0rc~1352 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/9c47603718642464b4e3cdb11ad4c9e1c964b60a rtld: Allows return pathname in dl_iterate_phdr dlpi_name This is the behavior of Linux and also of FreeBSD since October 2014. Until this point, dlpi_name returned the short name of the object unless it wasn't defined, so the fallback was to return the pathname. Returning the pathname in all cases is considered more useful and matches the definition of Linux. Taken from: FreeBSD svn 272842 (9 Oct 2014) --- diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 772e0288c3..f630d6754d 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -3318,8 +3318,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;