mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-06 12:00:04 +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) {
|
switch (type) {
|
||||||
case ARM_ElfRelocationConstants.R_ARM_PC24: { // Target class: ARM Instruction
|
case ARM_ElfRelocationConstants.R_ARM_PC24: { // Target class: ARM Instruction
|
||||||
int oldValue = memory.getInt(relocationAddress, instructionBigEndian);
|
int oldValue = memory.getInt(relocationAddress, instructionBigEndian);
|
||||||
newValue = (int) (symbolValue + addend);
|
if (elfRelocationContext.extractAddend()) {
|
||||||
newValue -= (offset + 8); // PC relative, PC will be 8 bytes after inst start
|
addend = (oldValue << 8 >> 6); // extract addend and sign-extend with *4 factor
|
||||||
if (isThumb) {
|
|
||||||
newValue |= 1;
|
|
||||||
}
|
}
|
||||||
// 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) {
|
if ((oldValue & 0xf0000000) == 0xf0000000) {
|
||||||
newValue = (oldValue & 0xfe000000) | (((newValue >> 1) & 1) << 24) |
|
newValue = (oldValue & 0xfe000000) | (((newValue >> 1) & 1) << 24) |
|
||||||
((newValue >> 2) & 0x00ffffff);
|
((newValue >> 2) & 0x00ffffff);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue