1use elflib::ElfParser;
2
3fn main() -> elflib::Result<()> {
4 let mut content =
7 std::fs::read("./test_binaries/build/mips64-linux-gnuabi64-gcc-main").unwrap();
8
9 let parser = ElfParser::new(&mut content)?;
10 let sections = parser.section_headers()?;
11 for section_res in sections {
12 let section = section_res?;
13 match section.data()? {
14 elflib::SectionData::RelocationSection(rel_section) => {
15 for rel_entry_res in rel_section.entries {
16 let rel_entry = rel_entry_res?;
17 println!("{:?}", rel_entry);
18 }
19 }
20 elflib::SectionData::SymbolTable(symbol_entries) => {
21 for symbol_res in symbol_entries {
22 let symbol = symbol_res?;
23 println!("{:?}", symbol.name());
24 }
25 }
26 _ => {}
27 }
28 }
29 Ok(())
30}