This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Some questions bout assemblycode build with gcc
- To: gcc at gcc dot gnu dot org
- Subject: Some questions bout assemblycode build with gcc
- From: Stephan Kallnik <skallnik at ba-mosbach dot de>
- Date: Mon, 11 Dec 2000 11:11:08 +0100
I have build this following c programm with the two different gcc
compilers:
#include <stdio.h>
#include <string.h>
void func (char *str_ptr) {
char stack_temp[4];
// strcpy(stack_temp,str_ptr);
}
int main ( ) {
func("TEST");
return 0;
}
No i have some question to two different assembler instruction, which
the gcc build:
gcc 2.91:
0x80483d0 <main>: push %ebp
0x80483d1 <main+1>: mov %esp,%ebp
0x80483d3 <main+3>: push $0x8048464
0x80483d8 <main+8>: call 0x80483c0 <func>
0x80483dd <main+13>: add $0x4,%esp
0x80483e0 <main+16>: xor %eax,%eax
0x80483e2 <main+18>: jmp 0x80483f0 <main+32>
0x80483e4 <main+20>: lea 0x0(%esi),%esi
0x80483ea <main+26>: lea 0x0(%edi),%edi
0x80483f0 <main+32>: mov %ebp,%esp
0x80483f2 <main+34>: pop %ebp
0x80483f3 <main+35>: ret
First question is: What does the lines main+18 til main+26 do?
gcc 2.95:
this compiler generates two extra lines like between main+1 and main+3:
sub $0x8,%esp
add $0xfffffff4,%esp
What will this lines do or for what they reserve the space in the stack?
This extralines are similar in the function func. But when you debug the
stack while you write a string in stack_temp, you see that they are
placed at the same position as in the build with gcc 2.91
I know this are perhaps simple questions but i don't know.
But thank for some answer