ghidra-lx-loader icon indicating copy to clipboard operation
ghidra-lx-loader copied to clipboard

Add fixups as Relocations to Ghidra's RelocationTable

Open tringenbach opened this issue 2 months ago • 0 comments

This PR adds the fixups as "Relocations" to Ghidra's RelocationTable.

Ghidra has analyzers that make use of this information. This results in more pointers being marked as pointers, which improves the overall decompiler experience.

This also gives us a way to mark fixups without using labels or comments. I find labels and comments for fixups get annoying and cluttered, because there is a lot of them, and Ghidra will sometimes stack them up when you create data structures that contain many fixups.

image

I think this is supposed to also allow you to move the segments around after import, but that is not something I tested, so it might need more work to support, not sure.

Here's some links on the Ghidra feature, perhaps they'll help in reviewing this PR:

  • https://ghidra.re/ghidra_docs/api/ghidra/program/model/reloc/RelocationTable.html
  • Here's how the MZ loader uses this api https://github.com/NationalSecurityAgency/ghidra/blob/cffea7e4c09780615b1f1519e10b76e92f582754/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/MzLoader.java#L347

Here's some info in Ghidra's online help too but I can't figure out how to link to it. Here's a screenshot instead: image

tringenbach avatar Dec 06 '25 17:12 tringenbach