diff options
author | Tony Puccinelli | 2010-07-27 06:27:45 +0000 |
---|---|---|
committer | Tony Puccinelli | 2010-07-27 06:27:45 +0000 |
commit | 58f3e81f0073f55a892802b562081300345ca23d (patch) | |
tree | 0e2bb58497a4bdf74100aeba0ca690b8f0b1d204 /backends/plugins/arm-relocs.cpp | |
parent | 4e530debd2b2cb79078b705792fc599d328d6c7c (diff) | |
download | scummvm-rg350-58f3e81f0073f55a892802b562081300345ca23d.tar.gz scummvm-rg350-58f3e81f0073f55a892802b562081300345ca23d.tar.bz2 scummvm-rg350-58f3e81f0073f55a892802b562081300345ca23d.zip |
Continued abstraction of generic ELF-loader, splitting off MIPS-processor specific things into their own files and testing on the PS2
svn-id: r51345
Diffstat (limited to 'backends/plugins/arm-relocs.cpp')
-rw-r--r-- | backends/plugins/arm-relocs.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/backends/plugins/arm-relocs.cpp b/backends/plugins/arm-relocs.cpp index 66e466a58a..b00fb42f4a 100644 --- a/backends/plugins/arm-relocs.cpp +++ b/backends/plugins/arm-relocs.cpp @@ -134,3 +134,31 @@ bool DLObject::relocate(Common::SeekableReadStream* DLFile, unsigned long offset free(rel); return true; } + +bool DLObject::relocateRels(Common::SeekableReadStream* DLFile, Elf32_Ehdr *ehdr, Elf32_Shdr *shdr) { + + // Loop over sections, finding relocation sections + for (int i = 0; i < ehdr->e_shnum; i++) { + + Elf32_Shdr *curShdr = &(shdr[i]); + + if ((curShdr->sh_type == SHT_REL || curShdr->sh_type == SHT_RELA) && // Check for a relocation section + curShdr->sh_entsize == sizeof(Elf32_Rel) && // Check for proper relocation size + (int)curShdr->sh_link == _symtab_sect && // Check that the sh_link connects to our symbol table + 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 (curShdr->sh_type == SHT_RELA) { + seterror("RELA entries not supported yet!\n"); + return false; + } + + if (!relocate(DLFile, curShdr->sh_offset, curShdr->sh_size, _segment)) { + return false; + } + + } + } + + return true; +} |