우분투 gutsy-security 에서 gcc를 설치하였습니다.
apt-get install build-essential 이라고 입력하여 설치하였는데요,
gcc로 컴파일 시에 ebp 프레임포인터 방식을 사용하지 않습니다.
전 이 기능이 마음에 들지 않아 끄고 싶은데 방법을 모르겠습니다. 도와주세요 ㅠ_ㅠ
# gcc -v
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.1.3 --program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --enable-mpfr --enable-checking=release i486-linux-gnu
Thread model: posix
gcc version 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)
gcc -v 해봤는데 -fomit-frame-pointer 는 들어가 있지 않아요.
root@nohead:~# cat helloworld.c
#include
int main(int argc, char *argv[])
{
printf("hello, chpie\n");
}
root@nohead:~# gdb ./a.out -q
Using host libthread_db library "/lib/tls/i686/cmov/libthread_db.so.1".
(gdb) disassemble main
Dump of assembler code for function main:
0x080483f8 : lea 0x4(%esp),%ecx
0x080483fc : and $0xfffffff0,%esp
0x080483ff : pushl 0xfffffffc(%ecx)
0x08048402 : push %ebp
0x08048403 : mov %esp,%ebp
0x08048405 : push %ebx
0x08048406 : push %ecx
0x08048407 : sub $0x20,%esp
0x0804840a : mov %ecx,%ebx
0x0804840c : movl $0x80483d4,0x4(%esp)
0x08048414 : movl $0x8048514,(%esp)
0x0804841b : call 0x8048340
0x08048420 : mov 0x4(%ebx),%eax
0x08048423 : add $0x4,%eax
0x08048426 : mov (%eax),%eax
0x08048428 : mov %eax,0x4(%esp)
0x0804842c : lea 0xfffffff4(%ebp),%eax
0x0804842f : mov %eax,(%esp)
0x08048432 : call 0x8048330
0x08048437 : add $0x20,%esp
0x0804843a : pop %ecx
0x0804843b : pop %ebx
0x0804843c : pop %ebp
0x0804843d : lea 0xfffffffc(%ecx),%esp
0x08048440 : ret
End of assembler dump.
(gdb)
댓글 달기