From nobody Thu Oct 20 15:04:28 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4MtW8s018hz4fXrL; Thu, 20 Oct 2022 15:04:29 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MtW8r6cW5z42w8; Thu, 20 Oct 2022 15:04:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1666278268; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=b3GJd56GSWyO2R/TGjdwAvik21P0qI0AuGKDpUXc6Ro=; b=nnZz/94/n0Zw4EQfAC861RwAaQulMxk11kUC5Qbb8DSjH+N2ZJhBAfkmc8qZ8oCezPbVJZ AhWIQdLKHW7ziZP2WekwpdWZr7gukVmGjtdE8q7PUwNkbDI60Q9XFx/dZ3llbkY5FSLiJ3 4dGrgNGcFJbQSXR7cmVcg/bMWQwWmk7Psseyc9+FrxMMp2M/i4IWZMSurv57NDnhx9vocV /9oY+aNIn52eYt73F+rN2dmS32VLR6hpbY6Dm3YXcpSnk+V2SnDKrtDf3qCAim2SKe4ozN 7htITKetvmlcW++F7jidXa2TYIqdPzhNAskCDYQB5RY+AZo9zXfUDaaX+i2XsA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4MtW8r5crmzvGJ; Thu, 20 Oct 2022 15:04:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 29KF4S6c090688; Thu, 20 Oct 2022 15:04:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 29KF4S0t090687; Thu, 20 Oct 2022 15:04:28 GMT (envelope-from git) Date: Thu, 20 Oct 2022 15:04:28 GMT Message-Id: <202210201504.29KF4S0t090687@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: fc4c39c54fc2 - main - kldxref: handle R_RISCV_64 relocation List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fc4c39c54fc240af424ae249b75057d2977ef8f2 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1666278268; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=b3GJd56GSWyO2R/TGjdwAvik21P0qI0AuGKDpUXc6Ro=; b=xKkT8D3nv7v1az0QyYsb3x+MFWDEEpExB6yqHQFd2xp7owfJPUzybnJPMcYGIA067jWcHK 2sxBT92nRYyu8IQzYed7b5nHTSghVK1Tg2/HqglTiNCq+pkXFHFornFldU0/umtp/tmAZh ApSdB7jcrCJ1jvfsYE1gloBpxu68T96QXqPXxKzrIGV4d9d64CLvQ0W0Nn3N4TAeyWCKvx YgUXWEecZC0l348Vm+cs1zGWL3thGzrbfzmslvI5AerYW89+RpnbPipio7Cc8/pol/vpt4 R0uQv07JvQzM6aOvSHbVwc5FrOdgl+6aRpuwaYAUfRgTExx3a9v0AKY5dMo1gw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1666278268; a=rsa-sha256; cv=none; b=tyuiPWv2Ekt+AU8JY3FTv5qI8J4tBnIR0+zpf7cn/jRJInbT6w7a3AyqCmcreIsPKT/Bkr FinEWPwXYfLdG+mq1EJD4iHJu6INg6EDhbnPIdeo9MRvJeRSIef9tFGTC5dtLAF3ZkXg15 GTHztZjOVxH3aPoSlPGnPn7tbVP7J0bmV5k5Fg6qneaZ6Z6OYvwMCs1YIMtsYR677vpRsU 0CJXY6gWy5UxUPMyEATm0izy0punUnAHRxOZUzUvz6iSBXbC+EktXBMVFh3o/mnORQdwcs LsS4QPwxF/W0TW1A6dy4fjmOSH9NJEAJTPit3Z++FbQuxSXM4f+nCaLysnBLCw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=fc4c39c54fc240af424ae249b75057d2977ef8f2 commit fc4c39c54fc240af424ae249b75057d2977ef8f2 Author: Mitchell Horne AuthorDate: 2022-10-20 14:56:01 +0000 Commit: Mitchell Horne CommitDate: 2022-10-20 15:01:29 +0000 kldxref: handle R_RISCV_64 relocation These are emitted in at least two kmods, and kldxref prints a warning. While here, remove the unneeded local variable 'val'. Reviewed by: jrtc27, imp, emaste MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D37038 --- usr.sbin/kldxref/ef_riscv.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/usr.sbin/kldxref/ef_riscv.c b/usr.sbin/kldxref/ef_riscv.c index e0caae3bd286..b94b37b3a92f 100644 --- a/usr.sbin/kldxref/ef_riscv.c +++ b/usr.sbin/kldxref/ef_riscv.c @@ -45,10 +45,10 @@ int ef_reloc(struct elf_file *ef, const void *reldata, int reltype, Elf_Off relbase, Elf_Off dataoff, size_t len, void *dest) { - Elf_Addr *where, val; + Elf_Addr *where; const Elf_Rela *rela; Elf_Addr addend, addr; - Elf_Size rtype; + Elf_Size rtype, symidx; switch (reltype) { case EF_RELOC_RELA: @@ -57,6 +57,7 @@ ef_reloc(struct elf_file *ef, const void *reldata, int reltype, Elf_Off relbase, dataoff); addend = rela->r_addend; rtype = ELF_R_TYPE(rela->r_info); + symidx = ELF_R_SYM(rela->r_info); break; default: return (EINVAL); @@ -66,10 +67,13 @@ ef_reloc(struct elf_file *ef, const void *reldata, int reltype, Elf_Off relbase, return (0); switch (rtype) { + case R_RISCV_64: /* S + A */ + addr = EF_SYMADDR(ef, symidx) + addend; + *where = addr; + break; case R_RISCV_RELATIVE: /* B + A */ addr = addend + relbase; - val = addr; - *where = val; + *where = addr; break; default: warnx("unhandled relocation type %d", (int)rtype);