git: e33e621428c1 - stable/13 - kldxref: Fix for 32-bit powerpc

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Thu, 18 Jan 2024 22:26:22 UTC
The branch stable/13 has been updated by jhb:

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

commit e33e621428c1d11dfa3b9d9253580d102dd996c3
Author:     Jessica Clarke <jrtc27@FreeBSD.org>
AuthorDate: 2023-12-14 16:37:34 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-01-18 21:30:15 +0000

    kldxref: Fix for 32-bit powerpc
    
    R_PPC_RELATIVE lost its 32-bit handling in the libelf conversion.
    
    Reported by:    bapt
    Fixes:          0299afdff145 ("kldxref: Make use of libelf to be a portable cross tool")
    
    (cherry picked from commit d1ce87ae0ddca413b098b6be8f5d3b4da87422ef)
---
 usr.sbin/kldxref/ef_powerpc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/usr.sbin/kldxref/ef_powerpc.c b/usr.sbin/kldxref/ef_powerpc.c
index 068c8117e4a6..ab33e170b488 100644
--- a/usr.sbin/kldxref/ef_powerpc.c
+++ b/usr.sbin/kldxref/ef_powerpc.c
@@ -69,7 +69,8 @@ ef_ppc_reloc(struct elf_file *ef, const void *reldata, Elf_Type reltype,
 				le64enc(where, val);
 			else
 				be64enc(where, val);
-		}
+		} else
+			be32enc(where, val);
 		break;
 	case R_PPC_ADDR32:	/* word32 S + A */
 		val = EF_SYMADDR(ef, symidx) + addend;