ghidra icon indicating copy to clipboard operation
ghidra copied to clipboard

mips_gp0_value error

Open ekardon opened this issue 4 years ago • 8 comments

Hi,

I am trying to reverse engineer a firmware and while importing a file i get the following error. I tried the latest public version on windows 10 machine, before posting this apperently it's still not a solved issue.

----- Loading /F:/Users/MONSTER/Downloads/FW/needed/psi -----
Skipping empty section [.mdebug.abi32]
_mips_gp0_value=0x42ab00
Finished importing referenced libraries for: psi
  [libc.so.0] -> [/libc.so.0] (previously imported)
----- [psi] Resolve 83 external symbols -----
Resolved 81 symbols to library libc.so.0
Unresolved external symbols which remain: 2

I don't understand what is going on as there is no more information about it. I hope someone can figure out.

ekardon avatar May 04 '20 02:05 ekardon

It's not an error, just a log message: https://github.com/NationalSecurityAgency/ghidra/blob/bcb825fb029232175625bc85653ec0e810b1252e/Ghidra/Processors/MIPS/src/main/java/ghidra/app/util/bin/format/elf/extend/MIPS_ElfExtension.java#L650-L676

ryanmkurtz avatar May 04 '20 11:05 ryanmkurtz

then why it's not resolved in the actual code. there is no other dependency that it says i have to import. so i'm kinda stuck here. as you can see on my previous post it says 2 unresolved external symbols.

image

ekardon avatar May 04 '20 14:05 ekardon

then why it's not resolved in the actual code. there is no other dependency that it says i have to import. so i'm kinda stuck here. as you can see on my previous post it says 2 unresolved external symbols.

image

It is resolved. The symbol _gp was set set to 0x0042ab00. The code there is where that value is being assigned. That address is not in a memory block though which is why it is red. This is a common problem for mips binaries. At the moment you will have to create the memory block yourself to make the red markers go away. You can just create an uninitialized memory block starting at _gp ending at _gp + __heap_size

astrelsky avatar May 07 '20 13:05 astrelsky

@ekardon, was this a satisfactory resolution?

emteere avatar May 11 '20 19:05 emteere

At the moment you will have to create the memory block yourself to make the red markers go away. You can just create an uninitialized memory block starting at _gp ending at _gp + __heap_size

Would you mind explaining how to do that?

amlamarra avatar Jul 29 '22 16:07 amlamarra

For me, the decompiler is using an offset to this _mips_gp0_value instead of symbol names. I can see the symbols in the disassembly. Is there any way to fix this for the decompiler?

image

amlamarra avatar Jul 29 '22 17:07 amlamarra

For me, the decompiler is using an offset to this _mips_gp0_value instead of symbol names. I can see the symbols in the disassembly. Is there any way to fix this for the decompiler?

image

I've just encountered the same issue. Did you ever figure out how to work around this?

nanomad avatar May 25 '23 20:05 nanomad

I have not.

amlamarra avatar May 26 '23 12:05 amlamarra