On Mon, 2009-01-19 at 05:16 -0500, Yang Zhang wrote: > Are there any good resources for learning about gcc's x86_64 assembly > output? When I run `gcc -S a.c` for a simple test C program like the > one below, I can completely understand the resulting go.s on a 32-bit > x86, but as soon as I run that on a 64-bit machine, I'm lost. I know > what the instructions are (i.e. I know how to use the AMD manuals), but > I'd like to learn about gcc's assembly output: the exact new calling > conventions (registers seem to be more liberally used over the stack now > even without opt), all these > .LFB/.LCFI/.LFE/.Lframe/.LSCIE/.LSFDE/.LASFDE/... labels, and so on. > Thanks in advance for any guidance. > > void foo(int a, int b, int c) { char xs[5]; char ys[10]; } > int main() { foo(1,2,3); return 0; } > Many of the local labels you see are coming from the DWARF2 unwind table. I don't know a lot about it, but I believe it's used for exception processing, for example, using a debugger. You can eliminate this table with the following options: $ gcc -O0 -g -Wa,-adhls -fno-asynchronous-unwind-tables \ > myProg.c > myProg.lst These options will also provide some comments in the assembly listing that refer back to the C source code. This should help you "cut to the chase" in trying to figure this out. Bob Plantz