GP-710 Added support for additional PIC30 ELF relocations (closes #2792)

This commit is contained in:
ghidra1 2021-02-23 12:27:48 -05:00
parent d12d1ec739
commit 9c1fed6a13

View File

@ -155,15 +155,25 @@ public class PIC30_ElfRelocationHandler extends ElfRelocationHandler {
if (elf.e_machine() == ElfConstants.EM_DSPIC30F) {
switch (type) {
case R_PIC30_16: // 2
newValue = (symbolValue + addend + oldShortValue) & 0xffff;
case R_PIC30_FILE_REG_WORD: // 6
newValue = (symbolValue + addend + oldShortValue);
memory.setShort(relocationAddress, (short) newValue);
break;
case R_PIC30_32: // 3
newValue = symbolValue + addend + oldValue;
memory.setInt(relocationAddress, newValue);
break;
case R_PIC30_FILE_REG_BYTE: // 4 short
case R_PIC30_FILE_REG: // 5 short
int reloc = symbolValue;
reloc += addend;
reloc += oldShortValue;
reloc &= 0x1fff;
newValue = reloc | (oldShortValue & ~0x1fff);
memory.setShort(relocationAddress, (short) newValue);
break;
case R_PIC30_FILE_REG_WORD_WITH_DST: // 7
int reloc = symbolValue >> 1;
reloc = symbolValue >> 1;
reloc += addend;
reloc += oldValue >> 4;
reloc &= 0x7fff;