Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Support ELFs #14

Open
tomsons26 opened this issue Aug 11, 2019 · 5 comments
Open

Feature Request: Support ELFs #14

tomsons26 opened this issue Aug 11, 2019 · 5 comments
Labels
enhancement New feature or request

Comments

@tomsons26
Copy link

In some games the unstripped ELF has been left in, currently trying to load these it throws
"Unable to load REL file! Reason: Relocation Data offset in header is past the file bounds!"

Also worth noting there's typically a .debug section in these ELF's containing partial?(seems to be the devs selected what to include as symbols for specialized debugging) debug symbols.
ELF's like these can be found though-ought the GC SDK.

@Cuyler36
Copy link
Owner

I don't think I'll be supporting ELF formatted binaries in this loader. I looked into doing it, but it seems like my choices are either to use the stock ELF loader Ghidra supplies or create a completely new one. If anyone else wants to implement it, then by all means go for it.

@Cuyler36 Cuyler36 added the enhancement New feature or request label Nov 11, 2019
@Kneesnap
Copy link

Kneesnap commented Sep 2, 2020

I would like to second the request for elf support. The stock Ghidra ELF loader does not seem to properly handle Gamecube elf files properly. It seemingly fails to decode the instructions in many functions, and creates unusable results. This is a shame because the game I'm working on has full debug symbol coverage in this elf and I have no way of utilizing it, since I can't actually load the elf in anything.

@Pokechu22
Copy link
Contributor

I've imported a few ELF files from Wii games without issue; the one thing you need to do when using the default ELF loader is change the language from normal powerpc to the gekko variant (otherwise, you will get unknown instructions). (I don't remember if you need to uncheck the show only recommended languages option for gekko to show up in that case).

@Pokechu22
Copy link
Contributor

Pokechu22 commented Mar 4, 2021

Oh, though I should add that importing like that does skip the other functionality provided by this (detecting SDA values and generating the default sections). For the first one I use a script to set up the SDA, and for the second I can use the following python:

from ghidra.app.util.importer import MessageLog
from gamecubeloader.common import SystemMemorySections
log = MessageLog()
SystemMemorySections.Create(currentProgram, log)
log.write(None, None)

@Pokechu22
Copy link
Contributor

For more recent versions, I was able to do this as a workaround instead:

from ghidra.app.util.importer import MessageLog
from gamecubeloader.common import SystemMemorySections
from ghidra.app.util.bin import ByteProvider
from ghidra.util.task import TaskMonitor
log = MessageLog()
SystemMemorySections.Create(ByteProvider.EMPTY_BYTEPROVIDER, currentProgram, TaskMonitor.DUMMY, log)
log.write(None, None)

The SDA portion is available as an analyzer (the GameCube/Wii program analyzer, which isn't checked by default).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants