rtld: Allows return pathname in dl_iterate_phdr dlpi_name
authorJohn Marino <draco@marino.st>
Sun, 30 Nov 2014 10:06:04 +0000 (11:06 +0100)
committerJohn Marino <draco@marino.st>
Sun, 30 Nov 2014 16:50:50 +0000 (17:50 +0100)
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)

libexec/rtld-elf/rtld.c

index 772e028..f630d67 100644 (file)
@@ -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;