mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-03 09:49:23 +02:00
GP-710 Added support for additional PIC30 ELF relocations (closes #2792)
This commit is contained in:
parent
d12d1ec739
commit
9c1fed6a13
1 changed files with 12 additions and 2 deletions
|
@ -155,15 +155,25 @@ public class PIC30_ElfRelocationHandler extends ElfRelocationHandler {
|
||||||
if (elf.e_machine() == ElfConstants.EM_DSPIC30F) {
|
if (elf.e_machine() == ElfConstants.EM_DSPIC30F) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case R_PIC30_16: // 2
|
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);
|
memory.setShort(relocationAddress, (short) newValue);
|
||||||
break;
|
break;
|
||||||
case R_PIC30_32: // 3
|
case R_PIC30_32: // 3
|
||||||
newValue = symbolValue + addend + oldValue;
|
newValue = symbolValue + addend + oldValue;
|
||||||
memory.setInt(relocationAddress, newValue);
|
memory.setInt(relocationAddress, newValue);
|
||||||
break;
|
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
|
case R_PIC30_FILE_REG_WORD_WITH_DST: // 7
|
||||||
int reloc = symbolValue >> 1;
|
reloc = symbolValue >> 1;
|
||||||
reloc += addend;
|
reloc += addend;
|
||||||
reloc += oldValue >> 4;
|
reloc += oldValue >> 4;
|
||||||
reloc &= 0x7fff;
|
reloc &= 0x7fff;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue