- 论坛徽章:
- 0
|
1. 局部变量在栈上的对齐;
2. little-endian.
------------------------------------------
$ gcc --version
gcc.exe (GCC) 4.5.0
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$gcc --save-temp test_2011-03-11.stack-align.c -o test_2011-03-11.stack-align.exe
------------------------------------------
.file "test_2011-03-11.stack-align.c"
.def ___main; .scl 2; .type 32; .endef
.section .rdata,"dr"
LC0:
.ascii "%p,%p\12\0"
.text
.globl _main
.def _main; .scl 2; .type 32; .endef
_main:
pushl %ebp
movl %esp, %ebp
andl $-16, %esp
subl $32, %esp
call ___main
movb $97, 31(%esp)
movl $4, 24(%esp)
leal 24(%esp), %eax
movl %eax, 8(%esp)
leal 31(%esp), %eax
movl %eax, 4(%esp)
movl $LC0, (%esp)
call _printf
call _getchar
movl $0, %eax
leave
ret
.def _printf; .scl 2; .type 32; .endef
.def _getchar; .scl 2; .type 32; .endef |
|