variables
Thanks, with that command-line I could anderestand a simple program as followed:
C-CODE
------
int a = 1;
int main(void)
{
int b = 2;
a = b;
}
ASSEMBLER CODE
--------------
.file "Variaveis.c" .version "01.01"
gcc2_compiled.:
globl a
data
.align 4
.type a,@object
.size a,4 ; Global Variable Size Definition a (4 bytes)
a:
.long 1 ; Global Variable a = 1
text
.align 4
globl main
.type main,@function
main:
pushl %ebp movl %esp,%ebp subl $24,%esp movl $2,-4(%ebp) ; Local Variable b = 2 movl -4(%ebp),%eax movl %eax,a ; a = b
L2:
leave
ret
Lfe1:
.size main,.Lfe1-main .ident "GCC: (GNU) 2.95.3 20010315 (release) (conectiva)"
ARE THE COMMENTS CORRECT ?
Em Aug 2002, Dmitry Trunikov escreveu:
Quoted 11 lines
Quoted 1 line · RCS
Can anyone explain me how global and local variables from C are treated
in
Quoted 3 lines
assembler?
Is that write that local variables are storage in the stack?Yes.
You can compile c-program to asm-source. Try gcc -Sprogram.c----------
_________________________________________________________
Oi! Você quer um iG-mail gratuito?
Então clique aqui: http://registro.ig.com.br/