MIPS64: relocation issue
See original GitHub issueDescribe the bug
MIPS64 relocation handler discards the old symbol value resulting in symbols having the EA as their value. This binary is built to load at 0x0, so basically all of my .rel.dyn
relocations are NULL pointers.
For example readelf shows:
000000667788 000000001203 R_MIPS_REL32
Type2: R_MIPS_64
Type3: R_MIPS_NONE
with file data of: 000000667788: 00 00 00 00 XX YY ZZ WW
and ghidra loads: 000000667788: 00 00 00 00 00 00 00 00
R_MIPS_REL32
handling has saveValue true and symbolIndex
0x0, resulting in symbolValue 0x0
Fall through in R_MIPS_32
extractAddend() false
R_MIPS_64
handling has saveValue false, addend 0x0, and symbolValue 0x0 resulting in overwriting the previous value with 0x0
Environment (please complete the following information):
- OS: 20.04
- Java Version: 17.0.4
- Ghidra Version: 10.2-DEV b88cf85d5cef4e766e6093223b6320ee5ae7a113
- Ghidra Origin: eclipse
Issue Analytics
- State:
- Created a year ago
- Comments:14 (6 by maintainers)
Top Results From Across the Web
D80390 [mips] Support 64-bit relative relocations - LLVM
In case of 64-bit PC-relative relocation we need the following chain: R_MIPS_PC32 | R_MIPS_64. The first relocation calculates an offset, but ...
Read more >How does a linker relocate branch instructions in MIPS?
1 Answer 1 ... My guess is that this linker does not handle branch instructions ( bne or beq ) to external labels....
Read more >SYSTEM V APPLICATION BINARY INTERFACE
The MIPS ISA provides instruction encodings to move, load, and store values for up to four co-processors. Only co-processor 1 is specified in...
Read more >MIPS relocatable kernel & KASLR - LWN.net
This series adds the ability for the MIPS kernel to relocate itself at runtime, optionally to an address determined at random each boot....
Read more >[mips] Emit all three relocation operations for each relocation entry ...
GitLab Community Edition. ... [mips] Emit all three relocation operations for each relocation entry on Mips64 ... New Mips64 ABIs should provide enough....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I believe the intent of this relocation for symbolIndex==0 is:
***Could the issue be caused by the
R_MIPS_REL32
using the upper 32-bits instead of the lower 32-bits of the affected 64-bit location? It is using a 32-bitoldValue
read from the relocation address. Since this code is shared for both 32-bit and 64-bit MIPS thatoldValue
read may be flawed for 64-bit MIPS and should have been a 64-bit read.Closed by 8c1fd57b72c84d99e8dca998ff0d1c22161bc4c4