git: 424089a0fc82 - main - loader: Fix powerpc64le by working around slof bug in qemu/slof
Date: Sun, 28 Dec 2025 05:48:53 UTC
The branch main has been updated by imp:
URL: https://cgit.FreeBSD.org/src/commit/?id=424089a0fc82ee9db8659b8c1099bbbde8999473
commit 424089a0fc82ee9db8659b8c1099bbbde8999473
Author: Warner Losh <imp@FreeBSD.org>
AuthorDate: 2025-12-28 05:27:03 +0000
Commit: Warner Losh <imp@FreeBSD.org>
CommitDate: 2025-12-28 05:27:03 +0000
loader: Fix powerpc64le by working around slof bug in qemu/slof
Fix powerpc 64 little endian booting by adding some padding. Due to
https://gitlab.com/slof/slof/-/blob/master/lib/libelf/elf32.c?ref_type=heads#L114
https://gitlab.com/slof/slof/-/blob/master/lib/libelf/elf32.c?ref_type=heads#L150
using <= instead of <, slof used to loop over the phdrs. It overruns by
1 and so on little endian it swizzles the first 32 bytes of .text. Work
around this by adding 32 bytes of padding after the headers. We should
fix this in slof, but it's in the just released QEMU 10.2, so we have to
pad things here for now.
Now powerpc64le + qemu works.
MFC After: 3 days (maybe EN too)
Reviewed by: adrian, jhibbits
Sponsored by: Netflix
---
stand/powerpc/ofw/ppc-common.ldscript | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/stand/powerpc/ofw/ppc-common.ldscript b/stand/powerpc/ofw/ppc-common.ldscript
index e12dee74824a..edd37eba8fca 100644
--- a/stand/powerpc/ofw/ppc-common.ldscript
+++ b/stand/powerpc/ofw/ppc-common.ldscript
@@ -9,7 +9,7 @@ PHDRS
SECTIONS
{
/* Read-only sections, merged into text segment: */
- . = 0x02c00000 + SIZEOF_HEADERS;
+ . = 0x02c00000 + SIZEOF_HEADERS + 32;
.interp : { *(.interp) } :text
.hash : { *(.hash) }
.dynsym : { *(.dynsym) }