Error when using GAS with .intel_syntax

Viewed 1135

According to some documentation and this answer, it is possible to use GAS in Linux with the Intel syntax instead of the default AT&T syntax.

I tried to compile the following simple code, contained in a dedicated file file.s:

.intel_syntax noprefix

section .data

section .text
        global _start

_start:
        mov eax, 1      # some random comments

        mov ebx, 0      

        int 80h         

If I run as file.s -o file.o, the following error is produced:

is2_exit.s: Assembler messages:
is2_exit.s:3: Error: no such instruction: `section .data'
is2_exit.s:5: Error: no such instruction: `section .text'
is2_exit.s:6: Error: no such instruction: `global _start'
is2_exit.s:13: Error: junk `h' after expression

It seems that the .intel_syntax is not considered at all. What's wrong?

1 Answers
Related