git: 0d27ad33a44c - stable/13 - kldxref: add R_PPC_ADDR32 handler
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 17 Feb 2022 18:49:08 UTC
The branch stable/13 has been updated by alfredo: URL: https://cgit.FreeBSD.org/src/commit/?id=0d27ad33a44c2c580be5c9eb987428f821a2a1ec commit 0d27ad33a44c2c580be5c9eb987428f821a2a1ec Author: Alfredo Dal'Ava Junior <alfredo@FreeBSD.org> AuthorDate: 2022-02-17 21:48:52 +0000 Commit: Alfredo Dal'Ava Junior <alfredo@FreeBSD.org> CommitDate: 2022-02-17 21:48:52 +0000 kldxref: add R_PPC_ADDR32 handler Implements R_PPC_ADDR32 handler for kldxref, addressing "kldxref: unhandled relocation type 1" when running "kldxref /boot/kernel" on powerpc 32 bits. Reviewed by: luporl MFC after: 2 days Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D33745 (cherry picked from commit 79f5d19890c3a703b3808af2dffe9d181a2e1696) --- usr.sbin/kldxref/ef_powerpc.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/usr.sbin/kldxref/ef_powerpc.c b/usr.sbin/kldxref/ef_powerpc.c index c50f518f892e..45eca477abcd 100644 --- a/usr.sbin/kldxref/ef_powerpc.c +++ b/usr.sbin/kldxref/ef_powerpc.c @@ -55,6 +55,7 @@ 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, addend; + Elf32_Addr *where32; Elf_Size rtype, symidx; const Elf_Rela *rela; @@ -63,6 +64,7 @@ ef_reloc(struct elf_file *ef, const void *reldata, int reltype, Elf_Off relbase, rela = (const Elf_Rela *)reldata; where = (Elf_Addr *) ((Elf_Off)dest - dataoff + rela->r_offset); + where32 = (Elf32_Addr *) ((Elf_Off)dest - dataoff + rela->r_offset); addend = rela->r_addend; rtype = ELF_R_TYPE(rela->r_info); symidx = ELF_R_SYM(rela->r_info); @@ -74,9 +76,14 @@ ef_reloc(struct elf_file *ef, const void *reldata, int reltype, Elf_Off relbase, case R_PPC_RELATIVE: /* word32|doubleword64 B + A */ *where = relbase + addend; break; - case R_PPC64_ADDR64: /* S + A */ + case R_PPC_ADDR32: /* word32 S + A */ + *where32 = EF_SYMADDR(ef, symidx) + addend; + break; +#ifdef __powerpc64__ + case R_PPC64_ADDR64: /* doubleword64 S + A */ *where = EF_SYMADDR(ef, symidx) + addend; break; +#endif default: warnx("unhandled relocation type %" PRI_ELF_SIZE, rtype); }