aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLexi Winter <ivy@FreeBSD.org>2026-04-18 12:07:10 +0000
committerLexi Winter <ivy@FreeBSD.org>2026-04-18 12:07:10 +0000
commitba94d75749721fae999f756cb227638f9d4398a8 (patch)
tree1fb8708303b89c470022810c7543d3a38d010130
parent25e776a5438005db59c6d474b5d47c42d2a341b9 (diff)
stand/common/load_elf: Do kernel module relocations for PPC
reloc_ptr() skips relocations for the kernel module, because on most platforms the kernel is ET_EXEC and this is not required. On PPC, the kernel is ET_DYN and we need to relocate here, otherwise the module metadata will not be loaded properly and the kernel module will have an incorrect version, preventing module dependencies from resolving. This fixes loading kernel modules from loader.conf on powerpc. Diagnosed by: jrtc27 Reviewed by: jrtc27, adrian Sponsored by: https://www.patreon.com/bsdivy Differential Revision: https://reviews.freebsd.org/D56457
-rw-r--r--stand/common/load_elf.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/stand/common/load_elf.c b/stand/common/load_elf.c
index 10131f7ccb88..a6ea60c74b84 100644
--- a/stand/common/load_elf.c
+++ b/stand/common/load_elf.c
@@ -1282,10 +1282,11 @@ __elfN(reloc_ptr)(struct preloaded_file *mp, elf_file_t ef,
int error;
/*
- * The kernel is already relocated, but we still want to apply
- * offset adjustments.
+ * On most platforms, the kernel is already relocated, but we still
+ * want to apply offset adjustments. For PowerPC, the kernel is
+ * ET_DYN rather than ET_EXEC and we still need to relocate here.
*/
- if (ef->kernel)
+ if (ef->kernel && ef->ehdr->e_type != ET_DYN)
return (EOPNOTSUPP);
for (n = 0; n < ef->relsz / sizeof(r); n++) {