Unhandled relocation type 286 (0x11e) / R_AARCH64_LDST64_ABS_LO12_NC
Ralim opened this issue · comments
Is your feature request related to a problem? Please describe.
R_AARCH64_LDST64_ABS_LO12_NC is unhandled when loading AARCH64 binaries
Describe the solution you'd like
Ghidra to support these 🤟🏼
Describe alternatives you've considered
Added my pot shot guess of the fix at the end, but my confidence is ~=0, so if someone could at least sanity check would be fantastic ❤️
Additional context
I think this should be fairly simple given R_AARCH64_LDST32_ABS_LO12_NC
is already handled.
My guessed patch is that we need something like this:
// LD/ST32: (S+A) & 0xFF8
case AARCH64_ElfRelocationConstants.R_AARCH64_LDST64_ABS_LO12_NC: {
int oldValue = memory.getInt(relocationAddress, isBigEndianInstructions);
newValue = (int)((symbolValue + addend) & 0xff8) >> 2;
newValue = oldValue | (newValue << 10);
memory.setInt(relocationAddress, (int)newValue, isBigEndianInstructions);
break;
}
Not not 100% sure tbh, not my area of expertise (at least not yet)
Based on https://github.com/llvm-mirror/lld/blob/master/ELF/Arch/AArch64.cpp#L371, I think it will have to be >> 3
, not >> 2
. Otherwise, it should behave the same as R_AARCH64_LDST32_ABS_LO12_NC
.
Thank you for the information. Support for this missing relocation has been added for Ghidra 10.0.3.