aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2025-12-28 05:27:03 +0000
committerWarner Losh <imp@FreeBSD.org>2025-12-28 05:27:03 +0000
commit424089a0fc82ee9db8659b8c1099bbbde8999473 (patch)
treedff55567bfd89dded82d539744d30fccd1e8c381
parentf22cffe43343d9d48c731952d94976c5deb9659e (diff)
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
-rw-r--r--stand/powerpc/ofw/ppc-common.ldscript2
1 files changed, 1 insertions, 1 deletions
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) }