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?
views:
4548answers:
3
A:
Unfortunately gcc can't do this and conversion is difficult because some instructions in AT&T take operands in the same order as Intel, so you have to special case. In addition, some conversions for size where memory dereferencing and such can be difficult. Your best bet is to use a disassembler that will do what you want and make sure you reference symbol files and such. This'll get you 99% of the way.
Cody Brocious
2008-10-14 03:55:37
Sounds like someone should add an option for this to gcc seeing as it's free software and all.
Jason Dagit
2008-10-14 04:16:11
Good luck. Binutils (the component that handles all of this) is quite possibly the worst piece of software in the world to work with. Biggest mess of arcane, black voodoo code ever written.
Cody Brocious
2008-10-14 04:17:45
This may be a wrong answer - one should check Dagit's answer below for a working solution.
romandas
2010-01-11 17:48:25
This is definitely wrong. @hyperlogic, you should change the accepted answer
Nathan Fellman
2010-08-26 11:51:32
+24
A:
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.
I also see this sed script which is not perfect, but may work for you.
Jason Dagit
2008-10-14 04:36:30