Search code examples
assemblyx86assembliesdisassemblygnu-assembler

Error: no instruction mnemonic suffix given and no register operands


So basically I am trying to re-use some asm code disassembled from ELF binary using objdump on Linux 32 bit.

In the disassembled code, I see this:

repnz scas

and when I am trying to re-compile it(using gcc), I got this error:

Error: no instruction mnemonic suffix given and no register operands

I think it is a legal instruction, and I just don't know what's wrong here...

Could anyone give me some help?


Solution

  • As the error message says, the assembler can not figure out the operand size because there is no suffix or register operands. You will have to work that out from the context (or in your case the machine code), but chances are you want byte-sized operation so you should use scasb. The other options would be as usual for at&t, namely scasw or scasl for 16 or 32 bits, respectively.