0

I'm new to x86 assembly and I'm following a practical work for the basics. I have 2 equivalent sample codes: One in AT&T syntax and the other on Intel syntax. When compiling theses with GCC, everything works fine for the AT&T syntax, but GCC gives me errors for the Intel version. Theses two files compiles nicely on my school computers, but won't on my personal one.

I must be missing some gcc configuration but I can't find anything on the net.

Here is the sample code:

    .intel_syntax noprefix
    .global main

    .text
main:
    mov     rdi, offset:message
    call    puts
    mov     rax, 0
    ret

message:
    .asciz "Hello, world!"

And the error messages:

$> gcc -o hello_intel hello_intel.S
hello_intel.S: Assembler messages:
hello_intel.S:6: Error: bad expression
hello_intel.S:6: Error: junk `message' after expression
Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
JM445
  • 168
  • 1
  • 12

0 Answers0