Mail Archives: djgpp/2000/02/26/19:45:23
On Sat, 26 Feb 2000, Trancelucid wrote:
>
> > There is a switch to get GCC to show its assembler opcodes. Browse
> > the GCC manual:
> > C:\>info gcc
>
> Would you know what the switch is? I did a search for both "assembler"
> and "opcode", as well as browse through the menus, but could'nt find
> anything :(
Well the DJGPP FAQ has all you need in section 8.20. ususally the -S
switch is what you need. Anyway heres the relevant section of the FAQ
since it is very small.
*A*: 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 -Wa,-a,-ad [other GCC options] foo.c > foo.lst
which 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 `='.
Hope this helps,
Grendel
Hi, I'm a signature virus. plz set me as your signature and help me spread
:)
- Raw text -