mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 19:42:36 +02:00
Merge remote-tracking branch 'origin/GT-3654_ghidra1_ELF_R_ARM_PC24' into Ghidra_9.2
This commit is contained in:
commit
b9d16db00e
1 changed files with 4 additions and 5 deletions
|
@ -66,12 +66,11 @@ public class ARM_ElfRelocationHandler extends ElfRelocationHandler {
|
|||
switch (type) {
|
||||
case ARM_ElfRelocationConstants.R_ARM_PC24: { // Target class: ARM Instruction
|
||||
int oldValue = memory.getInt(relocationAddress, instructionBigEndian);
|
||||
newValue = (int) (symbolValue + addend);
|
||||
newValue -= (offset + 8); // PC relative, PC will be 8 bytes after inst start
|
||||
if (isThumb) {
|
||||
newValue |= 1;
|
||||
if (elfRelocationContext.extractAddend()) {
|
||||
addend = (oldValue << 8 >> 6); // extract addend and sign-extend with *4 factor
|
||||
}
|
||||
// is this a BLX instruction, must put the lower half word in bit24
|
||||
newValue = (int) (symbolValue - offset + addend);
|
||||
// if this a BLX instruction, must set bit24 to identify half-word
|
||||
if ((oldValue & 0xf0000000) == 0xf0000000) {
|
||||
newValue = (oldValue & 0xfe000000) | (((newValue >> 1) & 1) << 24) |
|
||||
((newValue >> 2) & 0x00ffffff);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue