How do you get assembler output from C/C++ source in gcc? -


How does it?

If I want to analyze how something is compiling, how will I get the emission code emitted?

Use the -s option for GCC (or G ++ ).

  gcc -s helloworld.c   

This will run the preprocessor (cpp) on helloworld.c, stop the initial compilation and then before executing the assembler .

By default this will output a file to helloworld.s . The output file can still be set using the -o option.

  gcc-s-o my_asm_output.s helloworld.c   

This only works if you have the original source optional If you only have the result If the object is the file, then - disassemble option (or -d form briefly) using objdump .

  obzump-s - dysassable hellcarold & gt; This option works best if the debugging option is enabled for the Helloworld.dump   

object file (at -g compile time) and the file is not snatched .

Running file helloworld gives you some prompts as the level of detail that you will get by using objdump.

Comments