invalid instruction suffix when assembling x86 assembly with as -


i wrote assembly program assemble as --32 when use pushl , popl in following code snippet:

  printhelloworld:     movl $10, %ecx     printtentimes:       pushl %ecx       movl $4, %eax       movl $1, %ebx       leal helloworld, %ecx       movl $14, %edx       int $0x80       popl %ecx     loop printtentimes     jmp exitcall 

but when tried assembly 64-bit machines, following error:

conditionalbranching.s: assembler messages: conditionalbranching.s:51: error: invalid instruction suffix `push' conditionalbranching.s:57: error: invalid instruction suffix `pop' 

so change pushl , popl pushq , popq, following error:

conditionalbranching.s: assembler messages: conditionalbranching.s:51: error: operand type mismatch `push' conditionalbranching.s:57: error: operand type mismatch `pop' 

how remove error , assemble 64-bit?

i think you're still trying push 32-bit eax rather having upgraded instruction correctly to:

pushq %rax 

that's based on fact error message complaining operand type mismatch rather suffix.

as per intel documentation, 32-bit register push instruction not encodable in 64-bit mode:

enter image description here


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -