Merge branch 'GP-5827_ghidra1_ElfMips64RelocationProcessing' into patch

This commit is contained in:
ghidra1
2025-07-15 18:28:19 -04:00
2 changed files with 9 additions and 7 deletions

View File

@@ -72,8 +72,6 @@ class MIPS_ElfRelocationContext extends ElfRelocationContext<MIPS_ElfRelocationH
int typeId = relocation.getType();
int symbolIndex = relocation.getSymbolIndex();
saveValueForNextReloc = nextRelocationHasSameOffset(relocation);
RelocationResult lastResult = RelocationResult.FAILURE;
if (getElfHeader().is64Bit()) {
@@ -99,7 +97,10 @@ class MIPS_ElfRelocationContext extends ElfRelocationContext<MIPS_ElfRelocationH
typeId >>= 8;
int nextRelocType = (n < 2) ? (typeId & 0xff) : 0;
if (nextRelocType == MIPS_ElfRelocationType.R_MIPS_NONE.typeId) {
saveValueForNextReloc = false;
saveValueForNextReloc = nextRelocationHasSameOffset(relocation);
}
else {
saveValueForNextReloc = true;
}
RelocationResult result =
@@ -117,6 +118,8 @@ class MIPS_ElfRelocationContext extends ElfRelocationContext<MIPS_ElfRelocationH
return lastResult;
}
// 32-bit ELF
saveValueForNextReloc = nextRelocationHasSameOffset(relocation);
return doRelocate(relocation, relocationAddress, typeId, symbolIndex);
}

View File

@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -358,8 +358,7 @@ public class MIPS_ElfRelocationHandler
value = symbolValue;
if (elfRelocationContext.extractAddend()) {
// extract addend based upon pointer size
addend = elf.is64Bit() ? (int) memory.getLong(relocationAddress)
: memory.getInt(relocationAddress);
addend = memory.getInt(relocationAddress);
}
newValue = value + addend;