Page 1 of 1

How to use jtool to extract speicific arch binary

PostPosted: Wed Aug 09, 2017 3:34 am
by Wingzero
I found jtool seems supports extract specific arch for a binary, just like what lipo does.
But I am stuck at how to use it:
Code: Select all
xuan:jtool xuan$ ./jtool -arch arm64 -e ~/Desktop/6240854.decrypted
File name not specified


I don't find option to specify output file neither
Please help, thanks

Answer: use -arch arm64 -e arch. this tells jtool you want to extract the architecture slice. Otherwise -e takes segment names or dylib/framework names as well for SLC.

Re: How to use jtool to extract speicific arch binary

PostPosted: Fri Aug 11, 2017 2:53 am
by Wingzero
I tried it print something like:

Code: Select all
xuanliu:jtool xuanliu$ ./jtool -arch arm64 -e arch ~/Desktop/6240854.decrypted
Warning: Binding offset (12864184) is past end of file (10000000) - File may be truncated, or header may be corrupt
Selected architecture (arm64) starts at 11747328 and spans 13338704 bytes - written to /Users/xuanliu/Desktop/6240854.decrypted.arch_arm64


However, I compared it with what lipo extracted:

Code: Select all
xuanliu:jtool xuanliu$ ls -l ~/Desktop/6240854.decrypted.arch_arm64
-rw-------  1 xuanliu  staff  13338704 Aug 11 10:41 /Users/xuanliu/Desktop/6240854.decrypted.arch_arm64
xuanliu:jtool xuanliu$ ls -l arm64.d
-rw-r--r--  1 xuanliu  staff  13355088 Aug 11 10:40 arm64.decrypted


Does the size matters?

Re: How to use jtool to extract speicific arch binary

PostPosted: Fri Aug 11, 2017 3:10 am
by Wingzero
OK, so I did further investigation,

lipo will export the binary with a fat header before the true bin header begins, although the binary only have arm64 included.
jtool just export the specified arch without the fat header. So no data loss thank god.

And J adds: If you want lipo to do the same as jtool, use -thin and not -extract. But lipo sucks (literally :-) . Jtool is better