From owner-svn-src-head@freebsd.org Wed May 20 22:08:27 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4F6052F67B7; Wed, 20 May 2020 22:08:27 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49S6Mb1S76z3dCV; Wed, 20 May 2020 22:08:27 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2D0A223285; Wed, 20 May 2020 22:08:27 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 04KM8RVd020710; Wed, 20 May 2020 22:08:27 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 04KM8QPA020707; Wed, 20 May 2020 22:08:26 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202005202208.04KM8QPA020707@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 20 May 2020 22:08:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361303 - in head: lib/libc/gen libexec/rtld-elf sys/sys X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head: lib/libc/gen libexec/rtld-elf sys/sys X-SVN-Commit-Revision: 361303 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 May 2020 22:08:27 -0000 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 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 */