Using GCC to produce readable assembly?

后端 未结 10 2099
死守一世寂寞
死守一世寂寞 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:03

    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 -c foo.c

提交回复
热议问题