|
楼主 |
发表于 2007-7-31 10:25:05
|
显示全部楼层
谢谢,增加知识了,我觉的也是因为gcc的版本问题,可能做了优化.根据你的提示,稍微修修改了一下参数.
cat hello.c
//==========================
#include <stdio.h>
int main(void)
{
printf("hello world! addr=0x%08x\n",printf);
}
//==========================
gcc -S hello.c
//======================
cat hello.s
//===========.file "hello.c"
.section .rodata
.LC0:
.string "hello world! addr=0x%08x\n"
.text
.globl main
.type main, @function
main:
leal 4(%esp), %ecx
andl $-16, %esp
pushl -4(%ecx)
pushl %ebp
movl %esp, %ebp
pushl %ecx
subl $20, %esp
movl $printf, 4(%esp)
movl $.LC0, (%esp)
call printf //=================编译后的汇编代码已经是printf了
addl $20, %esp
popl %ecx
popl %ebp
leal -4(%ecx), %esp
ret
.size main, .-main
.ident "GCC: (GNU) 4.1.2 (Ubuntu 4.1.2-0ubuntu4)"
.section .note.GNU-stack,"",@progbits
//====================
谢谢楼上! |
|