Adubbz / Ghidra-Switch-Loader

Nintendo Switch loader for Ghidra
ISC License
286 stars 43 forks source link

Disassemble .plt section and mark functions as thunks #60

Open TSRBerry opened 1 month ago

TSRBerry commented 1 month ago

This PR closes #19 by disassembling the entire .plt section and creating thunked functions for every PltEntry referencing external functions.

For entries referencing functions in the same binary the AARCH64PltThunkAnalyzer will now be able to take care of them.

I mainly used ghidra's ElfProgramBuilder as a template and added the necessary steps from it.

That said, I don't know a lot about ELF or file formats in general, so I'm not sure if there are any missing cases or if this solution is incorrect. I tested it with a few binaries myself and the results look right, but I lack the experience to actually judge that.

TSRBerry commented 3 weeks ago

I just found out how to do this properly, so I updated the PR and changed the description a little bit.