How do you use gcc to generate assembly code in Intel syntax?

[Origin]: http://stackoverflow.com/questions/199966/how-do-you-use-gcc-to-generate-assembly-code-in-intel-syntax

The gcc -S option will generate assembly code in AT&T syntax, is there a way to generate files in Intel syntax? Or is there a way to convert between the two?

shareedit

Have you tried this?

gcc -S -masm=intel test.c

Untested, but I found it in this forum where someone claimed it worked for them.

I just tried this on the mac and it failed, so I looked in my man page:

   -masm=dialect
       Output asm instructions using selected dialect.  Supported choices
       are intel or att (the default one).  Darwin does not support intel.

It may work on your platform.

For Mac OSX:

clang++ -S -mllvm --x86-asm-syntax=intel test.cpp

Source: http://stackoverflow.com/a/11957826/950427

shareedit
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s