www.delorie.com/djgpp/v2faq/faq070.html | search |
| Previous | Next | Up | Top |
Q: How can I create a file where I can see the C code and its assembly translation together?
gcc -O2 -S -c foo.cwill leave the generated assembly code on the file foo.s. If you want to see the C code together with the assembly it was converted to, use a command line like this:
gcc -c -Wa,-a,-ad [other GCC options] foo.c > foo.lstwhich will output the combined C/assembly listing to the file foo.lst.
If you need to both get the assembly code and to compile/link the program, you can either give the -save-temps option to GCC (which will leave all the temporary files including the .s file in the current directory), or use the -Wa,aln=foo.s option which instructs the assembler to output the assembly translation of the C code (together with the hex machine code and some additional info) to the file named after the =.
webmaster donations bookstore | delorie software privacy |
Copyright ⌐ 1998 by Eli Zaretskii | Updated Sep 1998 |
You can help support this site by visiting the advertisers that sponsor it! (only once each, though)