How do I compile to assembly instead of an executable with gcc. I know there is an -S flag, but where do I use it in the makefile. For example, if I use flags -O3 -o exe_name, where should I put the -S flag?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I suggest also using
-fverbose-asmbecause then the generated assembler has some generated comments which “explains” the code. For example:would generate in
foo.s(with some comments) the assembler code produced by compilingfoo.cAnd to understand what the GCC optimizations are doing one could even try
-fdump-tree-all(but this produces hundreds of files!).