Fix 26-bit reloc truncation (was 30 bit...)

Hopefully didn't affect anything?
This commit is contained in:
Unknown W. Brackets 2013-08-22 23:21:20 -07:00
parent 2ef650aa2d
commit 083fa71c1a

View File

@ -91,7 +91,7 @@ void ElfReader::LoadRelocations(Elf32_Rel *rels, int numRelocs)
//add on to put in correct address space
if (log)
DEBUG_LOG(LOADER,"j/jal reloc %08x", addr);
op = (op & 0xFC000000) | (((op&0x03FFFFFF)+(relocateTo>>2))&0x03FFFFFFF);
op = (op & 0xFC000000) | (((op&0x03FFFFFF)+(relocateTo>>2))&0x03FFFFFF);
break;
case R_MIPS_HI16: //lui part of lui-addiu pairs
@ -288,7 +288,7 @@ void ElfReader::LoadRelocations2(int rel_seg)
case 3: // R_MIPS_26
case 6: // R_MIPS_J26
case 7: // R_MIPS_JAL26
op = (op&0xFC000000) | (((op&0x03FFFFFF)+(relocate_to>>2))&0x03FFFFFFF);
op = (op&0xFC000000) | (((op&0x03FFFFFF)+(relocate_to>>2))&0x03FFFFFF);
break;
case 4: // R_MIPS_HI16
addr = ((op<<16)+lo16)+relocate_to;
@ -297,7 +297,7 @@ void ElfReader::LoadRelocations2(int rel_seg)
op = (op&0xffff0000) | (addr>>16 );
break;
case 1:
case 5: // R)MIPS_LO16
case 5: // R_MIPS_LO16
op = (op&0xffff0000) | (((op&0xffff)+relocate_to)&0xffff);
break;
default: