-
Notifications
You must be signed in to change notification settings - Fork 163
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
Failing to parse section headers of MIPS LE 32-bit ELF correctly on 64-bit PPC BE host #420
Comments
sajattack
changed the title
Failing to parse section headers of MIPS LE 32-bit ELF correctly on 64-bit PPC BE 64-bit host
Failing to parse section headers of MIPS LE 32-bit ELF correctly on 64-bit PPC BE host
Aug 14, 2024
It looks like I should be using |
Reopening, from_fd doesn't work either. use std::{fs::File, io::{Seek, SeekFrom}};
use goblin::elf32::{header::Header, section_header::SectionHeader, section_header::SHT_REL};
fn main() {
let mut fd = File::open("psp-cube-example").unwrap();
let header = Header::from_fd(&mut fd).unwrap();
println!("header: {:?}" , header);
//fd.rewind().unwrap();
let section_headers = SectionHeader::from_fd(
&mut fd,
header.e_shoff.into(),
header.e_shnum.into(),
).unwrap();
let reloc_count = section_headers.iter().filter(|sh| sh.sh_type == SHT_REL).count();
println!("reloc_count: {}", reloc_count);
println!("section_headers: {:?}", section_headers);
}
Actual values:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello, I seem to have stumbled upon some endian-awareness issues, unless you think I'm somehow misusing the library.
I have this goblin program (simplified from my actual usecase for ease of troubleshooting)
and I have this 32-bit MIPS2 LE ELF file (uploaded as zip because github is dumb)
psp-cube-example.zip
When I run this program on x86_64 Little Endian - I get the correct result.
goblin_repro_x86_64.txt
When I run this program on 64-bit PowerPC - I do not.
goblin_repro_ppc64.txt
I am using the default
endian_fd
feature of goblin.Here is the output of readelf -S
Let me know if there's any other details you need, I hope you may be able to reproduce using qemu-system-ppc64, but I have not explored it myself.
For extra background on what I'm actually doing, because it's kind of fun 😄
I'm trying to use rust-psp to compile a psp homebrew app on a ps3 running linux. And I hit this assertion in our psp executable repacker: https://github.com/overdrivenpotato/rust-psp/blob/bfaa487ea4881395cc64fdd82158745885222a29/cargo-psp/src/bin/prxgen.rs#L98
The text was updated successfully, but these errors were encountered: