Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compile intel assembly with gcc/mingw

Tags:

gcc

assembly

I want to compile intel syntax assembly using gcc. Is it possible? because I cant find something similar. I've only found this post.

Here is the code I am trying to compile.

    global  _main
    section .text
_main:
    mov eax, -1     
        ret

If this is not possible please provide alternative options in your answer.

like image 525
kechap Avatar asked Jan 18 '12 21:01

kechap


1 Answers

Adding a .intel_syntax directive works for me:

  .globl _main
  .intel_syntax

_main:
  mov eax, -1     
  ret

Assembling and running:

$ gcc -o example example.s; ./example; echo $?
255
like image 76
Carl Norum Avatar answered Nov 08 '22 19:11

Carl Norum