0

Possible Duplicate:
Using GCC to produce readable assembly?

For example, when I try:

gcc -c myprogram

it will give me an object file, which is in binary form. What I would like to get is just an assembly file (right before it is processed by an assembler to produce the object file). Is there a way to do it in gcc?

Community
  • 1
  • 1
  • 2
    Specifically, you want the second and subsequent answers (at time of writing), since the accepted answer assembles and then disassembles. – Steve Jessop Jan 06 '12 at 12:07

2 Answers2

8

just write gcc -S file.c, and you will get file.s which is assembly.

asaelr
  • 5,438
  • 1
  • 16
  • 22
4

Yes. It's -S. See the manual.

Mr Lister
  • 45,515
  • 15
  • 108
  • 150