Skip to content
This repository has been archived by the owner on Jan 10, 2025. It is now read-only.

Test move binary is parsed correctly by the GoblinParser #555

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/elf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1973,4 +1973,11 @@ mod test {
SECTION_NAME_LENGTH_MAXIMUM
);
}
#[test]
fn test_move_binary() {
// Binary compiled from move-mv-llvm-compiler/tests/rbpf-tests/eq-u32.move program.
let elf_bytes = std::fs::read("tests/elfs/move_u32_eq_check.so").unwrap();
let p = GoblinParser::parse(&elf_bytes).expect("Failed to parse move binary");
assert!(p.section_headers().count() == 10, "Incorrect section entries");
}
}
1 change: 1 addition & 0 deletions src/elf_parser_glue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ pub trait ElfRelocation: Clone {
}

/// The Goblin based ELF parser.
#[derive(Debug)]
pub struct GoblinParser<'a> {
elf: Elf<'a>,
header: Elf64Ehdr,
Expand Down
Binary file added tests/elfs/move_u32_eq_check.so
Binary file not shown.
Loading