Generating assembly from C code

19 views
Skip to first unread message

Mandar Mitra

unread,
Jan 24, 2025, 2:18:47 PMJan 24
to isi-mt...@googlegroups.com
Some of you asked about translating simple C programs into assembly code, and looking at the result to understand what happens at the instruction level, for a given high-level program.

You can run gcc as shown in the following example:

$ gcc -g -O0 -c -fverbose-asm -Wa,-adhlmn,-L hello.c > hello.S

This saves the generated assembly along with the corresponding high-level statements in hello.S.

You can also take a look at https://godbolt.org/ which provides a similar online facility.
Reply all
Reply to author
Forward
0 new messages