why gcc 4.x default reserve 8 bytes for stack on linux when calling a method?

Posted by nikcname on Stack Overflow See other posts from Stack Overflow or by nikcname
Published on 2010-03-08T03:12:32Z Indexed on 2010/03/08 4:21 UTC
Read the original article Hit count: 476

Filed under:
|
|
|

as a beginner of asm, I am checking gcc -S generated asm code to learn.

why gcc 4.x default reserve 8 bytes for stack when calling a method?

func18 is the empty function with no return no param no local var defined. I can't figure out why 8 bytes is reserved here (neither any forum/site mention for the reason, ppl seems take it for granted) is it for the %ebp just push? or return type?! many thx!

      .globl _func18
  _func18:
     pushl   %ebp 
     movl    %esp, %ebp 
     subl    $8, %esp 
     .text 

© Stack Overflow or respective owner

why gcc 4.x default reserve 8 bytes for stack on linux when calling a method?

Posted by nikcname on Stack Overflow See other posts from Stack Overflow or by nikcname
Published on 2010-03-08T03:12:32Z Indexed on 2010/03/08 3:17 UTC
Read the original article Hit count: 476

Filed under:
|
|
|
|

as a beginner of asm, I am checking gcc -S generated asm code to learn.

why gcc 4.x default reserve 8 bytes for stack when calling a method?

func18 is the empty function with no return no param no local var defined. I can't figure out why 8 bytes is reserved here (neither any forum/site mention for the reason, ppl seems take it for granted) is it for the %ebp just push? or return type?! many thx!

      .globl _func18
  _func18:
     pushl   %ebp 
     movl    %esp, %ebp 
     subl    $8, %esp 
     .text 

© Stack Overflow or respective owner

Related posts about assembly

Related posts about linux