svn commit: r361303 - in head: lib/libc/gen libexec/rtld-elf sys/sys
Konstantin Belousov
kib at FreeBSD.org
Wed May 20 22:08:27 UTC 2020
Author: kib
Date: Wed May 20 22:08:26 2020
New Revision: 361303
URL: https://svnweb.freebsd.org/changeset/base/361303
Log:
Change the samantic of struct link_map l_addr member.
It previously returned the object map base address, while all other
ELF operating systems return load offset, i.e. the difference between
map base and the link base.
Explain the meaning of the field in the man page.
Stop filling the mips-only l_offs member, which is apparently unused.
PR: 246561
Requested by: Damjan Jovanovic <damjan.jov at gmail.com>
Reviewed by: emaste, jhb, cem (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D24918
Modified:
head/lib/libc/gen/dlinfo.3
head/libexec/rtld-elf/rtld.c
head/sys/sys/link_elf.h
Modified: head/lib/libc/gen/dlinfo.3
==============================================================================
--- head/lib/libc/gen/dlinfo.3 Wed May 20 22:00:31 2020 (r361302)
+++ head/lib/libc/gen/dlinfo.3 Wed May 20 22:08:26 2020 (r361303)
@@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd February 14, 2003
+.Dd May 19, 2020
.Dt DLINFO 3
.Os
.Sh NAME
@@ -105,7 +105,7 @@ structure is defined in
.In link.h
and has the following members:
.Bd -literal -offset indent
-caddr_t l_addr; /* Base Address of library */
+caddr_t l_addr; /* Load Offset of library */
const char *l_name; /* Absolute Path to Library */
const void *l_ld; /* Pointer to .dynamic in memory */
struct link_map *l_next, /* linked list of mapped libs */
@@ -113,7 +113,9 @@ struct link_map *l_next, /* linked list of mapped li
.Ed
.Bl -tag -width ".Va l_addr"
.It Va l_addr
-The base address of the object loaded into memory.
+The load offset of the object, that is, the difference between
+the actual load address and the base virtual address the object
+was linked at.
.It Va l_name
The full name of the loaded shared object.
.It Va l_ld
Modified: head/libexec/rtld-elf/rtld.c
==============================================================================
--- head/libexec/rtld-elf/rtld.c Wed May 20 22:00:31 2020 (r361302)
+++ head/libexec/rtld-elf/rtld.c Wed May 20 22:08:26 2020 (r361303)
@@ -4032,12 +4032,8 @@ linkmap_add(Obj_Entry *obj)
struct link_map *prev;
obj->linkmap.l_name = obj->path;
- obj->linkmap.l_addr = obj->mapbase;
+ obj->linkmap.l_addr = obj->relocbase;
obj->linkmap.l_ld = obj->dynamic;
-#ifdef __mips__
- /* GDB needs load offset on MIPS to use the symbols */
- obj->linkmap.l_offs = obj->relocbase;
-#endif
if (r_debug.r_map == NULL) {
r_debug.r_map = l;
Modified: head/sys/sys/link_elf.h
==============================================================================
--- head/sys/sys/link_elf.h Wed May 20 22:00:31 2020 (r361302)
+++ head/sys/sys/link_elf.h Wed May 20 22:08:26 2020 (r361303)
@@ -57,9 +57,9 @@
#define LA_SER_SECURE 0x80 /* default (secure) path prepended */
typedef struct link_map {
- caddr_t l_addr; /* Base Address of library */
+ caddr_t l_addr; /* Load Offset of library */
#ifdef __mips__
- caddr_t l_offs; /* Load Offset of library */
+ caddr_t l_xxx; /* unused */
#endif
const char *l_name; /* Absolute Path to Library */
const void *l_ld; /* Pointer to .dynamic in memory */
More information about the svn-src-all
mailing list