Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Jan 2024 22:25:55 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 156b0d23dcd5 - stable/14 - kldxref: Implement aarch64 R_AARCH64_AB64 relocation
Message-ID:  <202401182225.40IMPtFN089285@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=156b0d23dcd57cd7bba7d0544133e8f32559a2ac

commit 156b0d23dcd57cd7bba7d0544133e8f32559a2ac
Author:     Jessica Clarke <jrtc27@FreeBSD.org>
AuthorDate: 2023-12-14 20:17:20 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-01-18 21:30:48 +0000

    kldxref: Implement aarch64 R_AARCH64_AB64 relocation
    
    Doing nothing seems to be sufficient but is strange, inconsistent with
    other architectures, and not necessary when it's easy to support
    properly.
    
    (cherry picked from commit aaba1490ec4b17dea750b1e58dfded7aeb4e9816)
---
 usr.sbin/kldxref/ef_aarch64.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/usr.sbin/kldxref/ef_aarch64.c b/usr.sbin/kldxref/ef_aarch64.c
index f1e499e76ef1..4365a7ff1f66 100644
--- a/usr.sbin/kldxref/ef_aarch64.c
+++ b/usr.sbin/kldxref/ef_aarch64.c
@@ -43,8 +43,8 @@ ef_aarch64_reloc(struct elf_file *ef, const void *reldata, Elf_Type reltype,
     GElf_Addr relbase, GElf_Addr dataoff, size_t len, void *dest)
 {
 	char *where;
-	Elf64_Addr addend;
-	GElf_Size rtype;
+	GElf_Addr addr, addend;
+	GElf_Size rtype, symidx;
 	const GElf_Rela *rela;
 
 	if (reltype != ELF_T_RELA)
@@ -54,6 +54,7 @@ ef_aarch64_reloc(struct elf_file *ef, const void *reldata, Elf_Type reltype,
 	where = (char *)dest - dataoff + rela->r_offset;
 	addend = rela->r_addend;
 	rtype = GELF_R_TYPE(rela->r_info);
+	symidx = GELF_R_SYM(rela->r_info);
 
 	if (where < (char *)dest || where >= (char *)dest + len)
 		return (0);
@@ -63,6 +64,8 @@ ef_aarch64_reloc(struct elf_file *ef, const void *reldata, Elf_Type reltype,
 		le64enc(where, relbase + addend);
 		break;
 	case R_AARCH64_ABS64:
+		addr = EF_SYMADDR(ef, symidx) + addend;
+		le64enc(where, addr);
 		break;
 	default:
 		warnx("unhandled relocation type %d", (int)rtype);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202401182225.40IMPtFN089285>