[Scummvm-cvs-logs] SF.net SVN: scummvm:[52558] scummvm/branches/gsoc2010-plugins/backends/ plugins/elf

dhewg at users.sourceforge.net dhewg at users.sourceforge.net
Sun Sep 5 14:53:16 CEST 2010


Revision: 52558
          http://scummvm.svn.sourceforge.net/scummvm/?rev=52558&view=rev
Author:   dhewg
Date:     2010-09-05 12:53:15 +0000 (Sun, 05 Sep 2010)

Log Message:
-----------
PLUGINS: Make the file stream a member of DLObject.

No point in passing it to functions all over the place. Release the
stream when it's not required anymore.

Modified Paths:
--------------
    scummvm/branches/gsoc2010-plugins/backends/plugins/elf/arm-loader.cpp
    scummvm/branches/gsoc2010-plugins/backends/plugins/elf/arm-loader.h
    scummvm/branches/gsoc2010-plugins/backends/plugins/elf/elf-loader.cpp
    scummvm/branches/gsoc2010-plugins/backends/plugins/elf/elf-loader.h
    scummvm/branches/gsoc2010-plugins/backends/plugins/elf/mips-loader.cpp
    scummvm/branches/gsoc2010-plugins/backends/plugins/elf/mips-loader.h
    scummvm/branches/gsoc2010-plugins/backends/plugins/elf/ppc-loader.cpp
    scummvm/branches/gsoc2010-plugins/backends/plugins/elf/ppc-loader.h

Modified: scummvm/branches/gsoc2010-plugins/backends/plugins/elf/arm-loader.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/backends/plugins/elf/arm-loader.cpp	2010-09-05 12:52:49 UTC (rev 52557)
+++ scummvm/branches/gsoc2010-plugins/backends/plugins/elf/arm-loader.cpp	2010-09-05 12:53:15 UTC (rev 52558)
@@ -33,12 +33,11 @@
 /**
  * Follow the instruction of a relocation section.
  *
- * @param DLFile		SeekableReadStream of File
  * @param fileOffset	Offset into the File
  * @param size			Size of relocation section
  * @param relSegment	Base address of relocated segment in memory (memory offset)
  */
-bool ARMDLObject::relocate(Common::SeekableReadStream* DLFile, Elf32_Off offset, Elf32_Word size, byte *relSegment) {
+bool ARMDLObject::relocate(Elf32_Off offset, Elf32_Word size, byte *relSegment) {
 	Elf32_Rel *rel = 0; //relocation entry
 
 	// Allocate memory for relocation table
@@ -48,7 +47,7 @@
 	}
 
 	// Read in our relocation table
-	if (!DLFile->seek(offset, SEEK_SET) || DLFile->read(rel, size) != size) {
+	if (!_file->seek(offset, SEEK_SET) || _file->read(rel, size) != size) {
 		warning("elfloader: Relocation table load failed.");
 		free(rel);
 		return false;
@@ -112,7 +111,7 @@
 	return true;
 }
 
-bool ARMDLObject::relocateRels(Common::SeekableReadStream* DLFile, Elf32_Ehdr *ehdr, Elf32_Shdr *shdr) {
+bool ARMDLObject::relocateRels(Elf32_Ehdr *ehdr, Elf32_Shdr *shdr) {
 	// Loop over sections, finding relocation sections
 	for (uint32 i = 0; i < ehdr->e_shnum; i++) {
 		Elf32_Shdr *curShdr = &(shdr[i]);
@@ -128,7 +127,7 @@
 				return false;
 			}
 
-			if (!relocate(DLFile, curShdr->sh_offset, curShdr->sh_size, _segment))
+			if (!relocate(curShdr->sh_offset, curShdr->sh_size, _segment))
 				return false;
 		}
 	}

Modified: scummvm/branches/gsoc2010-plugins/backends/plugins/elf/arm-loader.h
===================================================================
--- scummvm/branches/gsoc2010-plugins/backends/plugins/elf/arm-loader.h	2010-09-05 12:52:49 UTC (rev 52557)
+++ scummvm/branches/gsoc2010-plugins/backends/plugins/elf/arm-loader.h	2010-09-05 12:53:15 UTC (rev 52558)
@@ -32,8 +32,8 @@
 
 class ARMDLObject : public DLObject {
 protected:
-	virtual bool relocate(Common::SeekableReadStream* DLFile, Elf32_Off offset, Elf32_Word size, byte *relSegment);
-	virtual bool relocateRels(Common::SeekableReadStream* DLFile, Elf32_Ehdr *ehdr, Elf32_Shdr *shdr);
+	virtual bool relocate(Elf32_Off offset, Elf32_Word size, byte *relSegment);
+	virtual bool relocateRels(Elf32_Ehdr *ehdr, Elf32_Shdr *shdr);
 
 public:
 	ARMDLObject() : DLObject() {}

Modified: scummvm/branches/gsoc2010-plugins/backends/plugins/elf/elf-loader.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/backends/plugins/elf/elf-loader.cpp	2010-09-05 12:52:49 UTC (rev 52557)
+++ scummvm/branches/gsoc2010-plugins/backends/plugins/elf/elf-loader.cpp	2010-09-05 12:53:15 UTC (rev 52558)
@@ -66,9 +66,11 @@
 	_segmentVMA = 0;
 }
 
-bool DLObject::readElfHeader(Common::SeekableReadStream* DLFile, Elf32_Ehdr *ehdr) {
+bool DLObject::readElfHeader(Elf32_Ehdr *ehdr) {
+	assert(_file);
+
 	// Start reading the elf header. Check for errors and magic
-	if (DLFile->read(ehdr, sizeof(*ehdr)) != sizeof(*ehdr) ||
+	if (_file->read(ehdr, sizeof(*ehdr)) != sizeof(*ehdr) ||
 			memcmp(ehdr->e_ident, ELFMAG, SELFMAG)) {
 		warning("elfloader: No ELF file.");
 		return false;
@@ -127,10 +129,12 @@
 	return true;
 }
 
-bool DLObject::readProgramHeaders(Common::SeekableReadStream* DLFile, Elf32_Ehdr *ehdr, Elf32_Phdr *phdr, Elf32_Half num) {
+bool DLObject::readProgramHeaders(Elf32_Ehdr *ehdr, Elf32_Phdr *phdr, Elf32_Half num) {
+	assert(_file);
+
 	// Read program header
-	if (!DLFile->seek(ehdr->e_phoff + sizeof(*phdr) * num, SEEK_SET) ||
-			DLFile->read(phdr, sizeof(*phdr)) != sizeof(*phdr)) {
+	if (!_file->seek(ehdr->e_phoff + sizeof(*phdr) * num, SEEK_SET) ||
+			_file->read(phdr, sizeof(*phdr)) != sizeof(*phdr)) {
 		warning("elfloader: Program header load failed.");
 		return false;
 	}
@@ -147,7 +151,7 @@
 	return true;
 }
 
-bool DLObject::loadSegment(Common::SeekableReadStream* DLFile, Elf32_Phdr *phdr) {
+bool DLObject::loadSegment(Elf32_Phdr *phdr) {
 	// Attempt to allocate memory for segment
 	uint32 extra = phdr->p_vaddr % phdr->p_align;	// Get extra length TODO: check logic here
 	debug(2, "elfloader: Extra mem is %x", extra);
@@ -174,8 +178,8 @@
 	debug(2, "elfloader: Reading the segment into memory");
 
 	// Read the segment into memory
-	if (!DLFile->seek(phdr->p_offset, SEEK_SET) ||
-			DLFile->read(_segment, phdr->p_filesz) != phdr->p_filesz) {
+	if (!_file->seek(phdr->p_offset, SEEK_SET) ||
+			_file->read(_segment, phdr->p_filesz) != phdr->p_filesz) {
 		warning("elfloader: Segment load failed.");
 		return false;
 	}
@@ -185,7 +189,9 @@
 	return true;
 }
 
-Elf32_Shdr * DLObject::loadSectionHeaders(Common::SeekableReadStream* DLFile, Elf32_Ehdr *ehdr) {
+Elf32_Shdr * DLObject::loadSectionHeaders(Elf32_Ehdr *ehdr) {
+	assert(_file);
+
 	Elf32_Shdr *shdr = 0;
 
 	// Allocate memory for section headers
@@ -195,8 +201,8 @@
 	}
 
 	// Read from file into section headers
-	if (!DLFile->seek(ehdr->e_shoff, SEEK_SET) ||
-			DLFile->read(shdr, ehdr->e_shnum * sizeof(*shdr)) !=
+	if (!_file->seek(ehdr->e_shoff, SEEK_SET) ||
+			_file->read(shdr, ehdr->e_shnum * sizeof(*shdr)) !=
 			ehdr->e_shnum * sizeof(*shdr)) {
 		warning("elfloader: Section headers load failed.");
 		return 0;
@@ -205,7 +211,9 @@
 	return shdr;
 }
 
-int DLObject::loadSymbolTable(Common::SeekableReadStream* DLFile, Elf32_Ehdr *ehdr, Elf32_Shdr *shdr) {
+int DLObject::loadSymbolTable(Elf32_Ehdr *ehdr, Elf32_Shdr *shdr) {
+	assert(_file);
+
 	// Loop over sections, looking for symbol table linked to a string table
 	for (uint32 i = 0; i < ehdr->e_shnum; i++) {
 		if (shdr[i].sh_type == SHT_SYMTAB &&
@@ -232,8 +240,8 @@
 	}
 
 	// Read symbol table into memory
-	if (!DLFile->seek(shdr[_symtab_sect].sh_offset, SEEK_SET) ||
-			DLFile->read(_symtab, shdr[_symtab_sect].sh_size) !=
+	if (!_file->seek(shdr[_symtab_sect].sh_offset, SEEK_SET) ||
+			_file->read(_symtab, shdr[_symtab_sect].sh_size) !=
 			shdr[_symtab_sect].sh_size) {
 		warning("elfloader: Symbol table load failed.");
 		return -1;
@@ -246,7 +254,9 @@
 	return _symtab_sect;
 }
 
-bool DLObject::loadStringTable(Common::SeekableReadStream* DLFile, Elf32_Shdr *shdr) {
+bool DLObject::loadStringTable(Elf32_Shdr *shdr) {
+	assert(_file);
+
 	uint32 string_sect = shdr[_symtab_sect].sh_link;
 
 	// Allocate memory for string table
@@ -256,8 +266,8 @@
 	}
 
 	// Read string table into memory
-	if (!DLFile->seek(shdr[string_sect].sh_offset, SEEK_SET) ||
-			DLFile->read(_strtab, shdr[string_sect].sh_size) !=
+	if (!_file->seek(shdr[string_sect].sh_offset, SEEK_SET) ||
+			_file->read(_strtab, shdr[string_sect].sh_size) !=
 			shdr[string_sect].sh_size) {
 		warning("elfloader: Symbol table strings load failed.");
 		return false;
@@ -280,32 +290,32 @@
 	}
 }
 
-bool DLObject::load(Common::SeekableReadStream* DLFile) {
+bool DLObject::load() {
 	Elf32_Ehdr ehdr;
 	Elf32_Phdr phdr;
 	Elf32_Shdr *shdr;
 	bool ret = true;
 
-	if (readElfHeader(DLFile, &ehdr) == false)
+	if (readElfHeader(&ehdr) == false)
 		return false;
 
 	for (uint32 i = 0; i < ehdr.e_phnum; i++) {	//Load our segments
 		debug(2, "elfloader: Loading segment %d", i);
 
-		if (readProgramHeaders(DLFile, &ehdr, &phdr, i) == false)
+		if (readProgramHeaders(&ehdr, &phdr, i) == false)
 			return false;
 
-		if (!loadSegment(DLFile, &phdr))
+		if (!loadSegment(&phdr))
 			return false;
 	}
 
-	if (!(shdr = loadSectionHeaders(DLFile, &ehdr)))
+	if (!(shdr = loadSectionHeaders(&ehdr)))
 		ret = false;
 
-	if (ret && ((_symtab_sect = loadSymbolTable(DLFile, &ehdr, shdr)) < 0))
+	if (ret && ((_symtab_sect = loadSymbolTable(&ehdr, shdr)) < 0))
 		ret = false;
 
-	if (ret && !loadStringTable(DLFile, shdr))
+	if (ret && !loadStringTable(shdr))
 		ret = false;
 
 	if (ret) {
@@ -314,7 +324,7 @@
 		relocateSymbols(_segmentOffset);
 	}
 
-	if (ret && !relocateRels(DLFile, &ehdr, shdr))
+	if (ret && !relocateRels(&ehdr, shdr))
 		ret = false;
 
 	free(shdr);
@@ -323,28 +333,30 @@
 }
 
 bool DLObject::open(const char *path) {
-	Common::SeekableReadStream* DLFile;
 	void *ctors_start, *ctors_end;
 
 	debug(2, "elfloader: open(\"%s\")", path);
 
-	Common::FSNode file(path);
+	_file = Common::FSNode(path).createReadStream();
 
-	if (!(DLFile = file.createReadStream())) {
-		warning("elfloader: %s not found.", path);
+	if (!_file) {
+		warning("elfloader: File %s not found.", path);
 		return false;
 	}
 
 	debug(2, "elfloader: %s found!", path);
 
 	/*Try to load and relocate*/
-	if (!load(DLFile)) {
+	if (!load()) {
 		unload();
 		return false;
 	}
 
 	debug(2, "elfloader: Loaded!");
 
+	delete _file;
+	_file = 0;
+
 	flushDataCache(_segment, _segmentSize);
 
 	ctors_start = symbol("___plugin_ctors");

Modified: scummvm/branches/gsoc2010-plugins/backends/plugins/elf/elf-loader.h
===================================================================
--- scummvm/branches/gsoc2010-plugins/backends/plugins/elf/elf-loader.h	2010-09-05 12:52:49 UTC (rev 52557)
+++ scummvm/branches/gsoc2010-plugins/backends/plugins/elf/elf-loader.h	2010-09-05 12:53:15 UTC (rev 52558)
@@ -44,6 +44,8 @@
  */
 class DLObject {
 protected:
+	Common::SeekableReadStream* _file;
+
 	byte *_segment;
 	Elf32_Sym *_symtab;
 	char *_strtab;
@@ -57,19 +59,19 @@
 	void *_dtors_start, *_dtors_end;
 
 	virtual void unload();
-	bool load(Common::SeekableReadStream* DLFile);
+	bool load();
 
-	bool readElfHeader(Common::SeekableReadStream* DLFile, Elf32_Ehdr *ehdr);
-	bool readProgramHeaders(Common::SeekableReadStream* DLFile, Elf32_Ehdr *ehdr, Elf32_Phdr *phdr, Elf32_Half num);
-	virtual bool loadSegment(Common::SeekableReadStream* DLFile, Elf32_Phdr *phdr);
-	Elf32_Shdr *loadSectionHeaders(Common::SeekableReadStream* DLFile, Elf32_Ehdr *ehdr);
-	int loadSymbolTable(Common::SeekableReadStream* DLFile, Elf32_Ehdr *ehdr, Elf32_Shdr *shdr);
-	bool loadStringTable(Common::SeekableReadStream* DLFile, Elf32_Shdr *shdr);
+	bool readElfHeader(Elf32_Ehdr *ehdr);
+	bool readProgramHeaders(Elf32_Ehdr *ehdr, Elf32_Phdr *phdr, Elf32_Half num);
+	virtual bool loadSegment(Elf32_Phdr *phdr);
+	Elf32_Shdr *loadSectionHeaders(Elf32_Ehdr *ehdr);
+	int loadSymbolTable(Elf32_Ehdr *ehdr, Elf32_Shdr *shdr);
+	bool loadStringTable(Elf32_Shdr *shdr);
 	virtual void relocateSymbols(ptrdiff_t offset);
 
 	// architecture specific
-	virtual bool relocate(Common::SeekableReadStream* DLFile, Elf32_Off offset, Elf32_Word size, byte *relSegment) = 0;
-	virtual bool relocateRels(Common::SeekableReadStream* DLFile, Elf32_Ehdr *ehdr, Elf32_Shdr *shdr) = 0;
+	virtual bool relocate(Elf32_Off offset, Elf32_Word size, byte *relSegment) = 0;
+	virtual bool relocateRels(Elf32_Ehdr *ehdr, Elf32_Shdr *shdr) = 0;
 
 	// platform specific
 	virtual void *allocSegment(size_t boundary, size_t size) const = 0;

Modified: scummvm/branches/gsoc2010-plugins/backends/plugins/elf/mips-loader.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/backends/plugins/elf/mips-loader.cpp	2010-09-05 12:52:49 UTC (rev 52557)
+++ scummvm/branches/gsoc2010-plugins/backends/plugins/elf/mips-loader.cpp	2010-09-05 12:53:15 UTC (rev 52558)
@@ -32,12 +32,11 @@
 /**
  * Follow the instruction of a relocation section.
  *
- * @param DLFile		SeekableReadStream of File
  * @param fileOffset	Offset into the File
  * @param size			Size of relocation section
  * @param relSegment	Base address of relocated segment in memory (memory offset)
  */
-bool MIPSDLObject::relocate(Common::SeekableReadStream* DLFile, Elf32_Off offset, Elf32_Word size, byte *relSegment) {
+bool MIPSDLObject::relocate(Elf32_Off offset, Elf32_Word size, byte *relSegment) {
 	Elf32_Rel *rel = 0;	// relocation entry
 
 	// Allocate memory for relocation table
@@ -47,7 +46,7 @@
 	}
 
 	// Read in our relocation table
-	if (!DLFile->seek(offset, SEEK_SET) || DLFile->read(rel, size) != size) {
+	if (!_file->seek(offset, SEEK_SET) || _file->read(rel, size) != size) {
 		warning("elfloader: Relocation table load failed.");
 		free(rel);
 		return false;
@@ -221,7 +220,7 @@
 	return true;
 }
 
-bool MIPSDLObject::relocateRels(Common::SeekableReadStream* DLFile, Elf32_Ehdr *ehdr, Elf32_Shdr *shdr) {
+bool MIPSDLObject::relocateRels(Elf32_Ehdr *ehdr, Elf32_Shdr *shdr) {
 	// Loop over sections, finding relocation sections
 	for (uint32 i = 0; i < ehdr->e_shnum; i++) {
 
@@ -234,10 +233,10 @@
 				curShdr->sh_info < ehdr->e_shnum &&					// Check that the relocated section exists
 				(shdr[curShdr->sh_info].sh_flags & SHF_ALLOC)) {  	// Check if relocated section resides in memory
 			if (!ShortsMan.inGeneralSegment((char *) shdr[curShdr->sh_info].sh_addr)) {			// regular segment
-				if (!relocate(DLFile, curShdr->sh_offset, curShdr->sh_size, _segment))
+				if (!relocate(curShdr->sh_offset, curShdr->sh_size, _segment))
 					return false;
 			} else { 	// In Shorts segment
-				if (!relocate(DLFile, curShdr->sh_offset, curShdr->sh_size, (byte *) _shortsSegment->getOffset()))
+				if (!relocate(curShdr->sh_offset, curShdr->sh_size, (byte *) _shortsSegment->getOffset()))
 					return false;
 			}
 		}
@@ -267,7 +266,7 @@
 	}
 }
 
-bool MIPSDLObject::loadSegment(Common::SeekableReadStream* DLFile, Elf32_Phdr *phdr) {
+bool MIPSDLObject::loadSegment(Elf32_Phdr *phdr) {
 	byte *baseAddress = 0;
 
 	// We need to take account of non-allocated segment for shorts
@@ -308,8 +307,8 @@
 	debug(2, "elfloader: Reading the segment into memory");
 
 	// Read the segment into memory
-	if (!DLFile->seek(phdr->p_offset, SEEK_SET) ||
-			DLFile->read(baseAddress, phdr->p_filesz) != phdr->p_filesz) {
+	if (!_file->seek(phdr->p_offset, SEEK_SET) ||
+			_file->read(baseAddress, phdr->p_filesz) != phdr->p_filesz) {
 		warning("elfloader: Segment load failed.");
 		return false;
 	}

Modified: scummvm/branches/gsoc2010-plugins/backends/plugins/elf/mips-loader.h
===================================================================
--- scummvm/branches/gsoc2010-plugins/backends/plugins/elf/mips-loader.h	2010-09-05 12:52:49 UTC (rev 52557)
+++ scummvm/branches/gsoc2010-plugins/backends/plugins/elf/mips-loader.h	2010-09-05 12:53:15 UTC (rev 52558)
@@ -37,10 +37,10 @@
 	ShortSegmentManager::Segment *_shortsSegment;			// For assigning shorts ranges
 	uint32 _gpVal;									// Value of Global Pointer
 
-	virtual bool relocate(Common::SeekableReadStream* DLFile, Elf32_Off offset, Elf32_Word size, byte *relSegment);
-	virtual bool relocateRels(Common::SeekableReadStream* DLFile, Elf32_Ehdr *ehdr, Elf32_Shdr *shdr);
+	virtual bool relocate(Elf32_Off offset, Elf32_Word size, byte *relSegment);
+	virtual bool relocateRels(Elf32_Ehdr *ehdr, Elf32_Shdr *shdr);
 	virtual void relocateSymbols(Elf32_Addr offset);
-	virtual bool loadSegment(Common::SeekableReadStream* DLFile, Elf32_Phdr *phdr);
+	virtual bool loadSegment(Elf32_Phdr *phdr);
 	virtual void unload();
 
 public:

Modified: scummvm/branches/gsoc2010-plugins/backends/plugins/elf/ppc-loader.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/backends/plugins/elf/ppc-loader.cpp	2010-09-05 12:52:49 UTC (rev 52557)
+++ scummvm/branches/gsoc2010-plugins/backends/plugins/elf/ppc-loader.cpp	2010-09-05 12:53:15 UTC (rev 52558)
@@ -30,7 +30,7 @@
 
 #include "common/debug.h"
 
-bool PPCDLObject::relocate(Common::SeekableReadStream* DLFile, Elf32_Off offset, Elf32_Word size, byte *relSegment) {
+bool PPCDLObject::relocate(Elf32_Off offset, Elf32_Word size, byte *relSegment) {
 	Elf32_Rela *rel = NULL;
 
 	if (!(rel = (Elf32_Rela *)malloc(size))) {
@@ -38,7 +38,7 @@
 		return false;
 	}
 
-	if (!DLFile->seek(offset, SEEK_SET) || DLFile->read(rel, size) != size) {
+	if (!_file->seek(offset, SEEK_SET) || _file->read(rel, size) != size) {
 		warning("elfloader: Relocation table load failed.");
 		free(rel);
 		return false;
@@ -46,7 +46,7 @@
 
 	uint32 cnt = size / sizeof(*rel);
 
-	debug(2, "elfloader: Loaded relocation table. %d entries. base address=%p\n", cnt, relSegment);
+	debug(2, "elfloader: Loaded relocation table. %d entries. base address=%p", cnt, relSegment);
 
 	uint32 *src;
 	uint32 value;
@@ -64,30 +64,30 @@
 		switch (REL_TYPE(rel[i].r_info)) {
 		case R_PPC_ADDR32:
 			*src = value;
-			debug(8, "elfloader: R_PPC_ADDR32 -> 0x%08x\n", *src);
+			debug(8, "elfloader: R_PPC_ADDR32 -> 0x%08x", *src);
 			break;
 		case R_PPC_ADDR16_LO:
 			*((uint16 *) src) = value;
-			debug(8, "elfloader: R_PPC_ADDR16_LO -> 0x%08x\n", *src);
+			debug(8, "elfloader: R_PPC_ADDR16_LO -> 0x%08x", *src);
 			break;
 		case R_PPC_ADDR16_HI:
 			*(uint16 *) src = value >> 16;
-			debug(8, "elfloader: R_PPC_ADDR16_HA -> 0x%08x\n", *src);
+			debug(8, "elfloader: R_PPC_ADDR16_HA -> 0x%08x", *src);
 			break;
 		case R_PPC_ADDR16_HA:
 			*(uint16 *) src = (value + 0x8000) >> 16;
-			debug(8, "elfloader: R_PPC_ADDR16_HA -> 0x%08x\n", *src);
+			debug(8, "elfloader: R_PPC_ADDR16_HA -> 0x%08x", *src);
 			break;
 		case R_PPC_REL24:
 			*src = (*src & ~0x03fffffc) | ((value - (uint32) src) & 0x03fffffc);
-			debug(8, "elfloader: R_PPC_REL24 -> 0x%08x\n", *src);
+			debug(8, "elfloader: R_PPC_REL24 -> 0x%08x", *src);
 			break;
 		case R_PPC_REL32:
 			*src = value - (uint32) src;
-			debug(8, "elfloader: R_PPC_REL32 -> 0x%08x\n", *src);
+			debug(8, "elfloader: R_PPC_REL32 -> 0x%08x", *src);
 			break;
 		default:
-			warning("elfloader: Unknown relocation type %d\n", REL_TYPE(rel[i].r_info));
+			warning("elfloader: Unknown relocation type %d", REL_TYPE(rel[i].r_info));
 			free(rel);
 			return false;
 		}
@@ -97,7 +97,7 @@
 	return true;
 }
 
-bool PPCDLObject::relocateRels(Common::SeekableReadStream* DLFile, Elf32_Ehdr *ehdr, Elf32_Shdr *shdr) {
+bool PPCDLObject::relocateRels(Elf32_Ehdr *ehdr, Elf32_Shdr *shdr) {
 	for (uint32 i = 0; i < ehdr->e_shnum; i++) {
 		Elf32_Shdr *curShdr = &(shdr[i]);
 
@@ -106,7 +106,7 @@
 				int32(curShdr->sh_link) == _symtab_sect &&
 				curShdr->sh_info < ehdr->e_shnum &&
 				(shdr[curShdr->sh_info].sh_flags & SHF_ALLOC)) {
-			warning("elfloader: REL entries not supported!\n");
+			warning("elfloader: REL entries not supported!");
 			return false;
 		}
 
@@ -115,7 +115,7 @@
 				int32(curShdr->sh_link) == _symtab_sect &&
 				curShdr->sh_info < ehdr->e_shnum &&
 				(shdr[curShdr->sh_info].sh_flags & SHF_ALLOC)) {
-			if (!relocate(DLFile, curShdr->sh_offset, curShdr->sh_size, _segment))
+			if (!relocate(curShdr->sh_offset, curShdr->sh_size, _segment))
 				return false;
 		}
 	}

Modified: scummvm/branches/gsoc2010-plugins/backends/plugins/elf/ppc-loader.h
===================================================================
--- scummvm/branches/gsoc2010-plugins/backends/plugins/elf/ppc-loader.h	2010-09-05 12:52:49 UTC (rev 52557)
+++ scummvm/branches/gsoc2010-plugins/backends/plugins/elf/ppc-loader.h	2010-09-05 12:53:15 UTC (rev 52558)
@@ -32,8 +32,8 @@
 
 class PPCDLObject : public DLObject {
 protected:
-	virtual bool relocate(Common::SeekableReadStream* DLFile, Elf32_Off offset, Elf32_Word size, byte *relSegment);
-	virtual bool relocateRels(Common::SeekableReadStream* DLFile, Elf32_Ehdr *ehdr, Elf32_Shdr *shdr);
+	virtual bool relocate(Elf32_Off offset, Elf32_Word size, byte *relSegment);
+	virtual bool relocateRels(Elf32_Ehdr *ehdr, Elf32_Shdr *shdr);
 
 public:
     PPCDLObject() : DLObject() {}


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list