m4b / goblin

An impish, cross-platform binary parsing crate, written in Rust
MIT License
1.2k stars 160 forks source link

Support for COFF object files #324

Closed koutheir closed 1 year ago

koutheir commented 2 years ago

COFF object files are not supported. The function goblin::peek() doesn't seem to support this COFF format.

This lack of support causes the issue #36 in bingrep, reproducible as follows:

$ rustup target add x86_64-pc-windows-gnu
$ echo "" | rustc --target x86_64-pc-windows-gnu --emit obj - --crate-type lib
$ bingrep rust_out.o
Unknown magic: 0x38664

Whereas:

$ file rust_out.o
rust_out.o: Intel amd64 COFF object file, not stripped, 3 sections, symbol offset=0x8c, 10 symbols, 1st section name ".text"
m4b commented 2 years ago

i'm hoping a hero comes along and fixes this issue :) @koutheir it sounds like peek just needs to be made aware of coff object file magic numbers?

koutheir commented 2 years ago

it sounds like peek just needs to be made aware of coff object file magic numbers?

That should help.