diff options
author | Tony Puccinelli | 2010-07-21 08:50:30 +0000 |
---|---|---|
committer | Tony Puccinelli | 2010-07-21 08:50:30 +0000 |
commit | da414e62b8b61bb661bbf62517c8d249574732e2 (patch) | |
tree | c8025e1d996a207bfaf85d6cd8e63581ca7464fc /backends/platform/ds/arm9/source/dsloader.cpp | |
parent | 3d3e4e6c397a58d21dbc3be7fbe0c0173f193644 (diff) | |
download | scummvm-rg350-da414e62b8b61bb661bbf62517c8d249574732e2.tar.gz scummvm-rg350-da414e62b8b61bb661bbf62517c8d249574732e2.tar.bz2 scummvm-rg350-da414e62b8b61bb661bbf62517c8d249574732e2.zip |
switched out linker script for plugin linking on ds, added in check for RELA type relocations in ARM loader and coded for REL type relocations (DS now runs many games with Dynamic Plugins enabled)
svn-id: r51083
Diffstat (limited to 'backends/platform/ds/arm9/source/dsloader.cpp')
-rw-r--r-- | backends/platform/ds/arm9/source/dsloader.cpp | 69 |
1 files changed, 4 insertions, 65 deletions
diff --git a/backends/platform/ds/arm9/source/dsloader.cpp b/backends/platform/ds/arm9/source/dsloader.cpp index c0e8b63dbc..8ab64e226a 100644 --- a/backends/platform/ds/arm9/source/dsloader.cpp +++ b/backends/platform/ds/arm9/source/dsloader.cpp @@ -116,12 +116,6 @@ bool DLObject::relocate(Common::SeekableReadStream* DLFile, unsigned long offset a = *target; // Get full 32 bits of addend relocation = a + (Elf32_Addr)_segment; // Shift by main offset - /*TODO: - * if (SYM_TYPE(sym->st_info) == STT_FUNC && symbol addresses a thumb instruction) { - * relocation |= 1; - * } - */ - *target = relocation; DBG("R_ARM_ABS32: i=%d, a=%x, origTarget=%x, target=%x\n", i, a, origTarget, *target); @@ -129,74 +123,19 @@ bool DLObject::relocate(Common::SeekableReadStream* DLFile, unsigned long offset break; case R_ARM_THM_CALL: - - if (sym->st_shndx < SHN_LOPROC) { // Only shift for plugin section. - a = *target & 0x00000fff; // Get the correct bits for addend: - a += ((*target & 0x0fff0000) >> 4); // Bits 0-11 of the first half-word encode the 12 most significant bits of the branch offset, - // bits 0-11 of the next half-word encode the 12 least significant bits. - a = (a << 8) >> 8; // sign-extend - a = a << 1; // branch offset is in units of half-bytes - - relocation = a + (Elf32_Addr)_segment; // Shift by main offset - - /*TODO: - * if (SYM_TYPE(sym->st_info) == STT_FUNC && symbol addresses a thumb instruction) { - * relocation |= 1; - * } - */ - - relocation -= rel[i].r_offset; - - *target = relocation; - - DBG("R_ARM_THM_CALL: i=%d, a=%x, origTarget=%x, target=%x\n", i, a, origTarget, *target); - } + DBG("R_ARM_THM_CALL: PC-relative jump, ld takes care of necessary relocation work for us.\n"); break; case R_ARM_CALL: - if (sym->st_shndx < SHN_LOPROC) { // Only shift for plugin section. - a = *target & 0x00ffffff; - a = (a << 8) >> 6; // Calculate addend by sign-extending (insn[23:0] << 2) - relocation = a + (Elf32_Addr)_segment; // Shift by main offset - - /*TODO: - * if (SYM_TYPE(sym->st_info) == STT_FUNC && symbol addresses a thumb instruction) { - * relocation |= 1; - * } - */ - - relocation = relocation - rel[i].r_offset; - relocation = relocation >> 2; - *target &= 0xff000000; // Clean lower 26 target bits - *target |= (relocation & 0x00ffffff); - - DBG("R_ARM_CALL: i=%d, a=%x, origTarget=%x, target=%x\n", i, a, origTarget, *target); - } + DBG("R_ARM_CALL: PC-relative jump, ld takes care of necessary relocation work for us.\n"); break; case R_ARM_JUMP24: - if (sym->st_shndx < SHN_LOPROC) { // Only shift for plugin section. - a = *target & 0x00ffffff; - a = (a << 8) >> 6; // Calculate addend by sign-extending (insn[23:0] << 2) - relocation = a + (Elf32_Addr)_segment; // Shift by main offset - - /*TODO: - * if (SYM_TYPE(sym->st_info) == STT_FUNC && symbol addresses a thumb instruction) { - * relocation |= 1; - * } - */ - - relocation = relocation - rel[i].r_offset; - relocation = relocation >> 2; - *target &= 0xff000000; // Clean lower 26 target bits - *target |= (relocation & 0x00ffffff); - - DBG("R_ARM_CALL: i=%d, a=%x, origTarget=%x, target=%x\n", i, a, origTarget, *target); - } + DBG("R_ARM_JUMP24: PC-relative jump, ld takes care of all relocation work for us.\n"); break; case R_ARM_V4BX: - DBG("R_ARM_V4BX: No relocation calculation necessary\n"); + DBG("R_ARM_V4BX: No relocation calculation necessary.\n"); break; default: |