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

elf disasm fails at ELF entry address #4

Open
muff1n1634 opened this issue Oct 5, 2023 · 3 comments
Open

elf disasm fails at ELF entry address #4

muff1n1634 opened this issue Oct 5, 2023 · 3 comments
Labels
elf split elf split

Comments

@muff1n1634
Copy link

When running elf disasm on an (unstripped) ELF file (from a Wii game), it fails with the message:

Failed: Range 0x00000000-{e_entry} outside of section .init: {.init->sh_addr}-{.init->sh_addr + .init->sh_size}

It may not happen on every ELF file, but I tried it on at least 10 and they all had the same result, so I think it probably does.

An actual example, from an actual game:
Failed: Range 0x00000000-0x80004134 outside of section .init: 0x80004000-0x800064C4

Seems to be emitted from obj/sections.rs:152:

ensure!(
	self.contains_range(start..end),
	"Range {:#010X}-{:#010X} outside of section {}: {:#010X}-{:#010X}",
	start,
	end,
	self.name,
	self.address,
	self.address + self.size
);

I guess the problem is that it thinks the entry point is a range? No idea where that's determined, though.

i also don't know any rust i just grepped for the string


reproduction

  1. get an applicable ELF file
  2. dtk elf disasm <path/to/file.elf> .
  3. message, maybe

environment

OS: Windows 10 22H2
dtk -V: dtk 0.5.5 36bb5ddcc67dabaf5d00d7335a9e764c4c668ee7

also tried on macOS Catalina with 0.5.4
same stuff but im not on that computer rn so no specs

@encounter
Copy link
Owner

Unfortunately, trying to auto-split ELF files (especially Wii ones) turned out to not be very feasible after all. The file information available gets mangled pretty bad by the linker. But I'll still look to see if there's improvements to be made here.

Are you interested in setting up a decomp project for any of these, or just poking at disassembly?

@muff1n1634
Copy link
Author

I already have a project set up for another game with no symbols, but I wanted to see if I could set one up for a game with symbols so I could match the common libraries and move them over later. I thought since the ELFs have file names and boundaries (.text.1234 etc.) that elf disasm could split by object automatically, but for now I'll just set up splits manually. I've still got the symbols, so at least I don't have to do those by hand.

@encounter
Copy link
Owner

Cool! Check out dtk-template if you haven’t seen it already. It contains a template project structure and config documentation.

One solution may be to use elf config to extract a splits.txt and then fix it up manually.

@encounter encounter added the elf split elf split label Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
elf split elf split
Projects
None yet
Development

No branches or pull requests

2 participants