aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Heider2010-09-05 12:53:15 +0000
committerAndre Heider2010-09-05 12:53:15 +0000
commit402c71860f0a6f254604b1fbd1a763d470c859c0 (patch)
tree1bc6f9ba34632376b004d54794b19c380d29c75b
parent3b2a9734d15b1ddd5955e2634639122a1d4416cb (diff)
downloadscummvm-rg350-402c71860f0a6f254604b1fbd1a763d470c859c0.tar.gz
scummvm-rg350-402c71860f0a6f254604b1fbd1a763d470c859c0.tar.bz2
scummvm-rg350-402c71860f0a6f254604b1fbd1a763d470c859c0.zip
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. svn-id: r52558
-rw-r--r--backends/plugins/elf/arm-loader.cpp9
-rw-r--r--backends/plugins/elf/arm-loader.h4
-rw-r--r--backends/plugins/elf/elf-loader.cpp72
-rw-r--r--backends/plugins/elf/elf-loader.h22
-rw-r--r--backends/plugins/elf/mips-loader.cpp17
-rw-r--r--backends/plugins/elf/mips-loader.h6
-rw-r--r--backends/plugins/elf/ppc-loader.cpp26
-rw-r--r--backends/plugins/elf/ppc-loader.h4
8 files changed, 86 insertions, 74 deletions
diff --git a/backends/plugins/elf/arm-loader.cpp b/backends/plugins/elf/arm-loader.cpp
index ace3b51e3c..7534cb1d44 100644
--- a/backends/plugins/elf/arm-loader.cpp
+++ b/backends/plugins/elf/arm-loader.cpp
@@ -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 @@ bool ARMDLObject::relocate(Common::SeekableReadStream* DLFile, Elf32_Off offset,
}
// 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 @@ bool ARMDLObject::relocate(Common::SeekableReadStream* DLFile, Elf32_Off offset,
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 @@ bool ARMDLObject::relocateRels(Common::SeekableReadStream* DLFile, Elf32_Ehdr *e
return false;
}
- if (!relocate(DLFile, curShdr->sh_offset, curShdr->sh_size, _segment))
+ if (!relocate(curShdr->sh_offset, curShdr->sh_size, _segment))
return false;
}
}
diff --git a/backends/plugins/elf/arm-loader.h b/backends/plugins/elf/arm-loader.h
index 1d4e248a7b..3a3894d041 100644
--- a/backends/plugins/elf/arm-loader.h
+++ b/backends/plugins/elf/arm-loader.h
@@ -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() {}
diff --git a/backends/plugins/elf/elf-loader.cpp b/backends/plugins/elf/elf-loader.cpp
index 32e42daf7d..0503f81c42 100644
--- a/backends/plugins/elf/elf-loader.cpp
+++ b/backends/plugins/elf/elf-loader.cpp
@@ -66,9 +66,11 @@ void DLObject::unload() {
_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 @@ bool DLObject::readElfHeader(Common::SeekableReadStream* DLFile, Elf32_Ehdr *ehd
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 @@ bool DLObject::readProgramHeaders(Common::SeekableReadStream* DLFile, Elf32_Ehdr
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 @@ bool DLObject::loadSegment(Common::SeekableReadStream* DLFile, Elf32_Phdr *phdr)
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 @@ bool DLObject::loadSegment(Common::SeekableReadStream* DLFile, Elf32_Phdr *phdr)
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 @@ Elf32_Shdr * DLObject::loadSectionHeaders(Common::SeekableReadStream* DLFile, El
}
// 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 @@ Elf32_Shdr * DLObject::loadSectionHeaders(Common::SeekableReadStream* DLFile, El
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 @@ int DLObject::loadSymbolTable(Common::SeekableReadStream* DLFile, Elf32_Ehdr *eh
}
// 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 @@ int DLObject::loadSymbolTable(Common::SeekableReadStream* DLFile, Elf32_Ehdr *eh
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 @@ bool DLObject::loadStringTable(Common::SeekableReadStream* DLFile, Elf32_Shdr *s
}
// 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 @@ void DLObject::relocateSymbols(ptrdiff_t offset) {
}
}
-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 @@ bool DLObject::load(Common::SeekableReadStream* DLFile) {
relocateSymbols(_segmentOffset);
}
- if (ret && !relocateRels(DLFile, &ehdr, shdr))
+ if (ret && !relocateRels(&ehdr, shdr))
ret = false;
free(shdr);
@@ -323,28 +333,30 @@ bool DLObject::load(Common::SeekableReadStream* DLFile) {
}
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");
diff --git a/backends/plugins/elf/elf-loader.h b/backends/plugins/elf/elf-loader.h
index 9b80a0236f..ae226fc2b6 100644
--- a/backends/plugins/elf/elf-loader.h
+++ b/backends/plugins/elf/elf-loader.h
@@ -44,6 +44,8 @@
*/
class DLObject {
protected:
+ Common::SeekableReadStream* _file;
+
byte *_segment;
Elf32_Sym *_symtab;
char *_strtab;
@@ -57,19 +59,19 @@ protected:
void *_dtors_start, *_dtors_end;
virtual void unload();
- bool load(Common::SeekableReadStream* DLFile);
-
- 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 load();
+
+ 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;
diff --git a/backends/plugins/elf/mips-loader.cpp b/backends/plugins/elf/mips-loader.cpp
index bf6bb08319..9d5ffe7ebe 100644
--- a/backends/plugins/elf/mips-loader.cpp
+++ b/backends/plugins/elf/mips-loader.cpp
@@ -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 @@ bool MIPSDLObject::relocate(Common::SeekableReadStream* DLFile, Elf32_Off offset
}
// 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 @@ bool MIPSDLObject::relocate(Common::SeekableReadStream* DLFile, Elf32_Off offset
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 @@ bool MIPSDLObject::relocateRels(Common::SeekableReadStream* DLFile, Elf32_Ehdr *
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 @@ void MIPSDLObject::relocateSymbols(Elf32_Addr offset) {
}
}
-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 @@ bool MIPSDLObject::loadSegment(Common::SeekableReadStream* DLFile, Elf32_Phdr *p
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;
}
diff --git a/backends/plugins/elf/mips-loader.h b/backends/plugins/elf/mips-loader.h
index d910e07eda..bd90e968d7 100644
--- a/backends/plugins/elf/mips-loader.h
+++ b/backends/plugins/elf/mips-loader.h
@@ -37,10 +37,10 @@ protected:
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:
diff --git a/backends/plugins/elf/ppc-loader.cpp b/backends/plugins/elf/ppc-loader.cpp
index dff8143e43..5029bfe57e 100644
--- a/backends/plugins/elf/ppc-loader.cpp
+++ b/backends/plugins/elf/ppc-loader.cpp
@@ -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 @@ bool PPCDLObject::relocate(Common::SeekableReadStream* DLFile, Elf32_Off offset,
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 @@ bool PPCDLObject::relocate(Common::SeekableReadStream* DLFile, Elf32_Off offset,
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 @@ bool PPCDLObject::relocate(Common::SeekableReadStream* DLFile, Elf32_Off offset,
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 @@ bool PPCDLObject::relocate(Common::SeekableReadStream* DLFile, Elf32_Off offset,
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 @@ bool PPCDLObject::relocateRels(Common::SeekableReadStream* DLFile, Elf32_Ehdr *e
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 @@ bool PPCDLObject::relocateRels(Common::SeekableReadStream* DLFile, Elf32_Ehdr *e
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;
}
}
diff --git a/backends/plugins/elf/ppc-loader.h b/backends/plugins/elf/ppc-loader.h
index 3424586a90..1bda5874ec 100644
--- a/backends/plugins/elf/ppc-loader.h
+++ b/backends/plugins/elf/ppc-loader.h
@@ -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() {}