svn commit: r240782 - head/sys/boot/common
Andreas Tobler
andreast at FreeBSD.org
Fri Sep 21 18:21:32 UTC 2012
Author: andreast
Date: Fri Sep 21 18:21:31 2012
New Revision: 240782
URL: http://svn.freebsd.org/changeset/base/240782
Log:
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
Modified:
head/sys/boot/common/reloc_elf.c
Modified: head/sys/boot/common/reloc_elf.c
==============================================================================
--- head/sys/boot/common/reloc_elf.c Fri Sep 21 13:42:30 2012 (r240781)
+++ head/sys/boot/common/reloc_elf.c Fri Sep 21 18:21:31 2012 (r240782)
@@ -193,6 +193,31 @@ __elfN(reloc)(struct elf_file *ef, symad
}
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);
#endif
More information about the svn-src-head
mailing list