Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Sep 2012 18:21:32 +0000 (UTC)
From:      Andreas Tobler <andreast@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r240782 - head/sys/boot/common
Message-ID:  <201209211821.q8LILWiD081478@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201209211821.q8LILWiD081478>