aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2025-12-28 05:27:03 +0000
committerDimitry Andric <dim@FreeBSD.org>2026-05-29 22:56:56 +0000
commit5d2b9a17b9c6885179f7b32c2e82e182268f9517 (patch)
treedba7605fd414f9b0ea12a01b37ea71af811382f4
parentc5ad71c31160114752f5a4c1524349772105f6d0 (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 (cherry picked from commit 424089a0fc82ee9db8659b8c1099bbbde8999473) (cherry picked from commit 0b2011f50cd31ce384445ed04a554c0cf5e5300f)
-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) }