0

The title of the post is the question. I can see it is not assembly language ment for the NASM assembler. What assemlby language is gcc's assembly output ment for?

Matthew Hoggan
  • 7,402
  • 16
  • 75
  • 140
  • Look up the difference between ["AT&T syntax" and "Intel syntax"](https://secure.wikimedia.org/wikipedia/en/wiki/X86_assembly_language#Syntax). – Greg Hewgill Nov 16 '11 at 00:47

3 Answers3

3

It's in AT&T syntax of the machine you're compiling on, while NASM uses Intel syntax.

-S -masm=intel will fix it: How do you use gcc to generate assembly code in Intel syntax?

Community
  • 1
  • 1
Pubby
  • 51,882
  • 13
  • 139
  • 180
3

Mainly, two assembly flavors exists.

  • Intel syntax
  • AT&T (GAS) syntax

GCC usually outputs assembly using the AT&T (GAS) syntax, while NASM uses the Intel syntax.

On some platforms, you can generate assembly in Intel syntax using:

-masm=intel

Unfortunately, this is not supported everywhere. For instance, if using OS X, only the AT&T syntax is supported.

Macmade
  • 52,708
  • 13
  • 106
  • 123
  • @ninjalj Right, but the NASM syntax is actually based on the Intel one. It's a kind of «simplified» Intel syntax. – Macmade Dec 06 '11 at 21:42
  • You don't say exactly that in your answer, which makes your answer misleading. See http://stackoverflow.com/questions/8406188/does-gcc-really-know-how-to-output-nasm-assembly/8406725#8406725 – ninjalj Dec 06 '11 at 21:48
  • Thank you... Are you actually trying to review all NASM related questions on StackOverflow to promote your own answer? – Macmade Dec 06 '11 at 21:50
  • I actually wondered where the OP got the idea that NASM uses Intel Syntax, so I looked at his questions, and found it out. – ninjalj Dec 06 '11 at 21:53
  • Actually not a problem : ) Good job explaining this to him. – Macmade Dec 06 '11 at 21:55
0

It is at&t assembler. Standard in unix world.

fghj
  • 8,898
  • 4
  • 28
  • 56