[floss-cec] Re: Assembling using gcc.

  • From: "Vimal Joseph" <vimalekm@xxxxxxxxx>
  • To: floss-cec@xxxxxxxxxxxxx
  • Date: Sat, 27 Jan 2007 09:06:51 +0530

On 1/26/07, Binulal N Achary <binulal@xxxxxxxxx> wrote:

Qn: How do we get the assembled code for any program from gcc?

http://www.delorie.com/djgpp/v2faq/faq8_20.html says:

Use the -S (note: capital S) switch to GCC, and it will emit the
assembly code to a file with a .s extension. For example, the
following command:

 gcc -O2 -S -c foo.c

will 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 -g -Wa,-a,-ad [other GCC options] foo.c > foo.lst

which will output the combined C/assembly listing to the file foo.lst.

FLOSS Cell Mailing List
College of Engineering Chengannur

Other related posts: