kechap
kechap

Reputation: 2087

Compile intel assembly with gcc/mingw

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.

Upvotes: 11

Views: 11043

Answers (1)

Carl Norum
Carl Norum

Reputation: 224844

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

Upvotes: 11

Related Questions