From owner-svn-src-all@freebsd.org Wed Nov 7 15:04:43 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 34BE911286E3; Wed, 7 Nov 2018 15:04:43 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B92966CD70; Wed, 7 Nov 2018 15:04:42 +0000 (UTC) (envelope-from arichardson@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 9642117393; Wed, 7 Nov 2018 15:04:42 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wA7F4gEg040676; Wed, 7 Nov 2018 15:04:42 GMT (envelope-from arichardson@FreeBSD.org) Received: (from arichardson@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wA7F4g8c040674; Wed, 7 Nov 2018 15:04:42 GMT (envelope-from arichardson@FreeBSD.org) Message-Id: <201811071504.wA7F4g8c040674@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arichardson set sender to arichardson@FreeBSD.org using -f From: Alex Richardson Date: Wed, 7 Nov 2018 15:04:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r340218 - in head: libexec/rtld-elf sys/sys X-SVN-Group: head X-SVN-Commit-Author: arichardson X-SVN-Commit-Paths: in head: libexec/rtld-elf sys/sys X-SVN-Commit-Revision: 340218 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B92966CD70 X-Spamd-Result: default: False [-106.84 / 200.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; ALLOW_DOMAIN_WHITELIST(-100.00)[FreeBSD.org]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; HAS_XAW(0.00)[]; R_SPF_SOFTFAIL(0.00)[~all]; DMARC_NA(0.00)[FreeBSD.org]; RCVD_COUNT_THREE(0.00)[4]; MX_GOOD(-0.01)[cached: mx1.FreeBSD.org]; NEURAL_HAM_SHORT(-1.00)[-0.999,0]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; IP_SCORE(-3.73)[ip: (-9.91), ipnet: 2610:1c1:1::/48(-4.89), asn: 11403(-3.74), country: US(-0.09)] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Nov 2018 15:04:43 -0000 Author: arichardson Date: Wed Nov 7 15:04:41 2018 New Revision: 340218 URL: https://svnweb.freebsd.org/changeset/base/340218 Log: Handle the DT_MIPS_RLD_MAP_REL dynamic tag in RTLD This dynamic tag contains the location of the .rld_map section relative to the location of the dynamic tag. For PIE MIPS binaries DT_MIPS_RLD_MAP can not be used since it contains an absolute address. Without this change GDB can not find the function program counters in other libraries and once I apply this change I can successfully run info sharedlibraries again. Reviewed By: kib Differential Revision: https://reviews.freebsd.org/D17867 Modified: head/libexec/rtld-elf/rtld.c head/sys/sys/elf_common.h Modified: head/libexec/rtld-elf/rtld.c ============================================================================== --- head/libexec/rtld-elf/rtld.c Wed Nov 7 12:08:26 2018 (r340217) +++ head/libexec/rtld-elf/rtld.c Wed Nov 7 15:04:41 2018 (r340218) @@ -1264,6 +1264,13 @@ digest_dynamic1(Obj_Entry *obj, int early, const Elf_D *((Elf_Addr *)(dynp->d_un.d_ptr)) = (Elf_Addr) &r_debug; break; + case DT_MIPS_RLD_MAP_REL: + // The MIPS_RLD_MAP_REL tag stores the offset to the .rld_map + // section relative to the address of the tag itself. + *((Elf_Addr *)(__DECONST(char*, dynp) + dynp->d_un.d_val)) = + (Elf_Addr) &r_debug; + break; + case DT_MIPS_PLTGOT: obj->mips_pltgot = (Elf_Addr *)(obj->relocbase + dynp->d_un.d_ptr); Modified: head/sys/sys/elf_common.h ============================================================================== --- head/sys/sys/elf_common.h Wed Nov 7 12:08:26 2018 (r340217) +++ head/sys/sys/elf_common.h Wed Nov 7 15:04:41 2018 (r340218) @@ -707,6 +707,7 @@ typedef struct { #define DT_MIPS_PLTGOT 0x70000032 #define DT_MIPS_RLD_OBJ_UPDATE 0x70000033 #define DT_MIPS_RWPLT 0x70000034 +#define DT_MIPS_RLD_MAP_REL 0x70000035 #define DT_PPC_GOT 0x70000000 #define DT_PPC_TLSOPT 0x70000001