Implement Solaris-like link_map l_refname member.
The implementation is based on the public documentation, in particular dlinfo(3) from Solaris. Sponsored by: The FreeBSD Foundation MFC after: 1 week
This commit is contained in:
parent
48e9fb855b
commit
c8ad15b6ff
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=361398
@ -25,7 +25,7 @@
|
|||||||
.\"
|
.\"
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd May 19, 2020
|
.Dd May 21, 2020
|
||||||
.Dt DLINFO 3
|
.Dt DLINFO 3
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -111,6 +111,7 @@ const void *l_ld; /* Pointer to .dynamic in memory */
|
|||||||
struct link_map *l_next, /* linked list of mapped libs */
|
struct link_map *l_next, /* linked list of mapped libs */
|
||||||
*l_prev;
|
*l_prev;
|
||||||
caddr_t l_addr; /* Load Offset of library */
|
caddr_t l_addr; /* Load Offset of library */
|
||||||
|
const char *l_refname; /* Object this one filters for */
|
||||||
.Ed
|
.Ed
|
||||||
.Bl -tag -width ".Va l_addr"
|
.Bl -tag -width ".Va l_addr"
|
||||||
.It Va l_base
|
.It Va l_base
|
||||||
@ -133,6 +134,11 @@ structure on the link-map list.
|
|||||||
The load offset of the object, that is, the difference between
|
The load offset of the object, that is, the difference between
|
||||||
the actual load address and the base virtual address the object
|
the actual load address and the base virtual address the object
|
||||||
was linked at.
|
was linked at.
|
||||||
|
.It Va l_refname
|
||||||
|
A name of the object this object filters for, if any.
|
||||||
|
If there are more then one filtee, a name from the first
|
||||||
|
.Dv DT_FILTER
|
||||||
|
dynamic entry is supplied.
|
||||||
.El
|
.El
|
||||||
.It Dv RTLD_DI_SERINFO
|
.It Dv RTLD_DI_SERINFO
|
||||||
Retrieve the library search paths associated with the given
|
Retrieve the library search paths associated with the given
|
||||||
|
@ -1207,6 +1207,9 @@ digest_dynamic1(Obj_Entry *obj, int early, const Elf_Dyn **dyn_rpath,
|
|||||||
|
|
||||||
*needed_filtees_tail = nep;
|
*needed_filtees_tail = nep;
|
||||||
needed_filtees_tail = &nep->next;
|
needed_filtees_tail = &nep->next;
|
||||||
|
|
||||||
|
if (obj->linkmap.l_refname == NULL)
|
||||||
|
obj->linkmap.l_refname = (char *)dynp->d_un.d_val;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1402,6 +1405,10 @@ digest_dynamic1(Obj_Entry *obj, int early, const Elf_Dyn **dyn_rpath,
|
|||||||
}
|
}
|
||||||
obj->dynsymcount += obj->symndx_gnu;
|
obj->dynsymcount += obj->symndx_gnu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (obj->linkmap.l_refname != NULL)
|
||||||
|
obj->linkmap.l_refname = obj->strtab + (unsigned long)obj->
|
||||||
|
linkmap.l_refname;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
|
@ -65,6 +65,7 @@ typedef struct link_map {
|
|||||||
const void *l_ld; /* Pointer to .dynamic in memory */
|
const void *l_ld; /* Pointer to .dynamic in memory */
|
||||||
struct link_map *l_next, *l_prev; /* linked list of of mapped libs */
|
struct link_map *l_next, *l_prev; /* linked list of of mapped libs */
|
||||||
caddr_t l_addr; /* Load Offset of library */
|
caddr_t l_addr; /* Load Offset of library */
|
||||||
|
const char *l_refname; /* object we are filtering for */
|
||||||
} Link_map;
|
} Link_map;
|
||||||
|
|
||||||
struct r_debug {
|
struct r_debug {
|
||||||
|
Loading…
Reference in New Issue
Block a user