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
This commit is contained in:
@@ -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++) {
|
||||
|
||||
Reference in New Issue
Block a user