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

后端 未结 17 1990
天命终不由人
天命终不由人 2020-11-22 02:43

How does one do this?

If I want to analyze how something is getting compiled, how would I get the emitted assembly code?

17条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-22 03:00

    As mentioned before, look at the -S flag.

    It's also worth looking at the '-fdump-tree' family of flags, in particular '-fdump-tree-all', which lets you see some of gcc's intermediate forms. These can often be more readable than assembler (at least to me), and let you see how optimisation passes perform.

提交回复
热议问题