Matthew Hoggan
Matthew Hoggan

Reputation: 7594

What type of assembly does gcc output with the -S flag

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?

Upvotes: 0

Views: 1819

Answers (3)

Macmade
Macmade

Reputation: 53960

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.

Upvotes: 3

Pubby
Pubby

Reputation: 53047

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?

Upvotes: 3

fghj
fghj

Reputation: 9394

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

Upvotes: 0

Related Questions