Using GCC to produce readable assembly?

后端 未结 10 1950
死守一世寂寞
死守一世寂寞 2020-11-22 06:13

I was wondering how to use GCC on my C source file to dump a mnemonic version of the machine code so I could see what my code was being compiled into. You can do this with J

10条回答
  •  情话喂你
    2020-11-22 07:01

    Use the -S (note: capital S) switch to GCC, and it will emit the assembly code to a file with a .s extension. For example, the following command:

    gcc -O2 -S foo.c

    will leave the generated assembly code on the file foo.s.

    Ripped straight from http://www.delorie.com/djgpp/v2faq/faq8_20.html (but removing erroneous -c)

提交回复
热议问题