git: d1ce87ae0ddc - main - kldxref: Fix for 32-bit powerpc

From: Jessica Clarke <jrtc27_at_FreeBSD.org>
Date: Thu, 14 Dec 2023 16:44:25 UTC
The branch main has been updated by jrtc27:

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

commit d1ce87ae0ddca413b098b6be8f5d3b4da87422ef
Author:     Jessica Clarke <jrtc27@FreeBSD.org>
AuthorDate: 2023-12-14 16:37:34 +0000
Commit:     Jessica Clarke <jrtc27@FreeBSD.org>
CommitDate: 2023-12-14 16:37:34 +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")
---
 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;