Assembler generated by gcc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The most simple C program

int main()
{
  return 13 ;
}


Results in following with 'gcc -S <file>' (gcc version 3.2.2)


	.file	"tt.c"
	.text
.globl main
	.type	main,@function
main:
	pushl	%ebp
	movl	%esp, %ebp
	subl	$8, %esp
	andl	$-16, %esp
	movl	$0, %eax
	subl	%eax, %esp
	movl	$13, %eax
	leave
	ret
.Lfe1:
	.size	main,.Lfe1-main
	.ident	"GCC: (GNU) 3.2.2"


I would have expected 'main' to only contain

	movl $13, %eax
	leave
	ret

So now I wonder why all the statements before these 3 statements are in
'main'. I've searched in several assembler tutorials and manuals but did
not find an explanation.
Thanks for any tips (to some webpage or ...)

toon



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux