1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-18 10:35:55 +00:00

Implement elfN(reloc) for powerpc. With this change the kernel is now able to

resolve dependencies of modules at boot time and load additional modules when
needed.

MFC after:	1 week
This commit is contained in:
Andreas Tobler 2012-09-21 18:21:31 +00:00
parent 4b1b92312e
commit 777813c555
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=240782

View File

@ -192,6 +192,31 @@ __elfN(reloc)(struct elf_file *ef, symaddr_fn *symaddr, const void *reldata,
return (EFTYPE);
}
return (0);
#elif defined(__powerpc__)
Elf_Size w;
const Elf_Rela *rela;
switch (reltype) {
case ELF_RELOC_RELA:
rela = reldata;
if (relbase + rela->r_offset >= dataaddr &&
relbase + rela->r_offset < dataaddr + len) {
switch (ELF_R_TYPE(rela->r_info)) {
case R_PPC_RELATIVE:
w = relbase + rela->r_addend;
bcopy(&w, (u_char *)data + (relbase +
rela->r_offset - dataaddr), sizeof(w));
break;
default:
printf("\nunhandled relocation type %u\n",
(u_int)ELF_R_TYPE(rela->r_info));
return (EFTYPE);
}
}
break;
}
return (0);
#else
return (EOPNOTSUPP);