mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 10:49:34 +02:00
GP-1029 Detect and mark unsupported EXTERNAL data relocation and correct MIPS compound relocation processing bug.
This commit is contained in:
parent
066b285446
commit
e89a8dcde3
9 changed files with 102 additions and 14 deletions
|
@ -59,6 +59,7 @@ public class ARM_ElfRelocationHandler extends ElfRelocationHandler {
|
|||
|
||||
long offset = (int) relocationAddress.getOffset();
|
||||
|
||||
Address symbolAddr = elfRelocationContext.getSymbolAddress(sym);
|
||||
long symbolValue = elfRelocationContext.getSymbolValue(sym);
|
||||
|
||||
int newValue = 0;
|
||||
|
@ -85,6 +86,10 @@ public class ARM_ElfRelocationHandler extends ElfRelocationHandler {
|
|||
if (elfRelocationContext.extractAddend()) {
|
||||
addend = memory.getInt(relocationAddress);
|
||||
}
|
||||
if (addend != 0 && isUnsupportedExternalRelocation(program, relocationAddress,
|
||||
symbolAddr, symbolName, addend, elfRelocationContext.getLog())) {
|
||||
addend = 0; // prefer bad fixup for EXTERNAL over really-bad fixup
|
||||
}
|
||||
newValue = (int) (symbolValue + addend);
|
||||
if (isThumb) {
|
||||
newValue |= 1;
|
||||
|
@ -354,8 +359,9 @@ public class ARM_ElfRelocationHandler extends ElfRelocationHandler {
|
|||
oldValue = (oldValue ^ 0x8000) - 0x8000;
|
||||
|
||||
oldValue += symbolValue;
|
||||
if (type == ARM_ElfRelocationConstants.R_ARM_MOVT_ABS)
|
||||
if (type == ARM_ElfRelocationConstants.R_ARM_MOVT_ABS) {
|
||||
oldValue >>= 16;
|
||||
}
|
||||
|
||||
newValue &= 0xfff0f000;
|
||||
newValue |= ((oldValue & 0xf000) << 4) |
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue