m4b / bingrep

like ~~grep~~ UBER, but for binaries

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mach-O universal binary are always reported not a 64bit binary file

Inndy opened this issue · comments

commented

Mach-O universal binary are always reported is_64: false

[ 12/22 15:31:29 ] inndy @ Inndys-MBPR ~/repo/bingrep/target/release (master)
$ file /usr/lib/libc++.dylib
/usr/lib/libc++.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [i386:Mach-O dynamically linked shared library i386]
/usr/lib/libc++.dylib (for architecture x86_64):	Mach-O 64-bit dynamically linked shared library x86_64
/usr/lib/libc++.dylib (for architecture i386):	Mach-O dynamically linked shared library i386
[ 12/22 15:32:20 ] inndy @ Inndys-MBPR ~/repo/bingrep/target/release (master)
$ ./bingrep /usr/lib/libc++.dylib | tail

Libraries(2):
/usr/lib/libc++abi.dylib
/usr/lib/libSystem.B.dylib

Name: /usr/lib/libc++.1.dylib
is_64: false
is_lib: true
little_endian: true
entry: 0
commented

Hi @Inndy thanks for the report!

So for fat binaries, the approach that bingrep takes is to print every binary in the container.

In this case, your tail is seeing the 32-bit libc++, so it (correctly) reports is_64 as false. You can verify this by using less and searching for "is_64: true"

If you have any suggestions on ways to make this clearer/more ergonomic, I'm all ears.

I've also considered an arch switch printer for osx, but I dunno.

commented

I have confirmed that. Thanks for your reply and great work!