2

I have bunch of binaries built for the SSE4 (Streaming SIMD Extensions 4) instruction set. I’d like to run them on a processor that has no support for the instruction set. It is natural that I get the illegal hardware instruction error when tried to run this binaries. But some binaries still work because they actually does not use SSE4.

I’m seeking for a quick method to determine if a binary actually uses SSE4 instruction set. So I could scan bunch of files and get list those that require rebuild.

1
  • You can look at the compiled assembly code
    – Ramhound
    Mar 3, 2015 at 20:27

1 Answer 1

3

This file has a fairly good list of assembly instructions and their corresponding instruction set for use with vim:

https://raw.githubusercontent.com/Shirk/vim-gas/master/syntax/gas.vim

If you've got objdump on your system, it's straightforward to dump a binary as assembly, with

objdump -d FILEPATH

So combining these two things you can list which families are used by a binary. I created a python script which I've used to automate this in the past.

http://pastebin.com/raw/AaRZdQLc

Sample outputs: (This one has SSE4 instructions) $ ./binary_families.py /bin/busybox These instruction families were used: 186_Base, 386_Base, 8086_Base, ARM_THUMB, Base, KATMAI_Base, KATMAI_MMX, KATMAI_SSE, NEHALEM_Base, P6_Base, PENT_3DNOW, PENT_Base, PENT_MMX, PRESCOTT_SSE3, SANDYBRIDGE_AVX, SSE2, SSE41, SSE42, X64_Base, X64_MMX, X64_SSE, X64_SSE2 These instructions could not be categorized: bndmov, cltd, cltq, cmova, cmovae, cmovb, cmovbe, cmove, cmovg, cmovge, cmovl, cmovle, cmovne, cmovns, cmovs, cqto, cvtsi2sdl, cwtl, decl, divl, divq, flds, fldt, fstpt, idivl, ja, jae, jb, jbe, je, jg, jge, jl, jle, jne, jnp, jns, jp, js, leaveq, lock, movabs, movsbl, movsbq, movsbw, movslq, movswl, movswq, movzbl, movzwl, mull, negl, nopl, nopw, notb, notq, rep, repnz, repz, seta, setae, setb, setbe, sete, setg, setge, setl, setle, setne, setnp, setns, setp, tzcnt, vinserti128, vmovdqu64

(This does not) $ ./binary_families.py /bin/ls
These instruction families were used: 186_Base, 386_Base, 8086_Base, ARM_THUMB, KATMAI_SSE, P6_Base, PENT_MMX, SSE2, X64_Base, X64_MMX, X64_SSE, X64_SSE2 These instructions could not be categorized: cltq, cmova, cmovae, cmovb, cmovbe, cmove, cmovg, cmovge, cmovle, cmovne, cmovns, cmovs, fadds, fildll, fistpll, flds, fldt, fstpt, ja, jae, jb, jbe, je, jg, jge, jl, jle, jne, jns, jo, js, movabs, movsbl, movslq, movzbl, movzwl, nopl, nopw, rep, repnz, repz, seta, setb, sete, setg, setge, setl, setle, setne, setp

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.