Gcc Option Omit Frame Pointer
GccOptionOmitFramePointerÀÔ´Ï´Ù.
-fomit-frame-pointer ¶The Free Online Dictionary of Computing¿¡ µû¸£¸é, frame pointerÀÇ Á¤ÀÇ´Â ´ÙÀ½°ú °°½À´Ï´Ù:
A pointer to the current activation record in an implementation of a block structured language.
'-fomit-frame-pointer' ¿É¼ÇÀ» ¾²¸é frame pointer°¡ ÇÊ¿ä¾ø´Â ÇÔ¼öµéÀ» ÄÄÆÄÀÏÇÒ ¶§, frame pointer¸¦ »ý·«ÇÕ´Ï´Ù. µû¶ó¼ frame-pointer¸¦ ÀúÀåÇÏ°í, ´Ù½Ã ºÒ·¯¿À´Â ºÎºÐ¿¡ ÇØ´çÇÏ´Â ±â°è¾î¸¦ ¸¸µéÁö ¾Ê±â ¶§¹®¿¡ ¾à°£ÀÇ ¼º´É Çâ»óÀ» ±â´ëÇÒ ¼ö ÀÖ½À´Ï´Ù.
int global_int;
void bar(int a, int b) { global_int = a + b; } À§ ¼Ò½º¸¦ Á¦°¡ °¡Áø ½Ã½ºÅÛ¿¡¼ gcc·Î ÄÄÆÄÀÏÇÏ¸é ´ÙÀ½°ú °°Àº ¾î¼Àºí·¯¸¦ ¸¸µé¾î ÁÝ´Ï´Ù:
; **** void
; **** bar(int a, int b) ; **** { pushl %ebp movl %esp, %ebp ; **** global_int = a + b movl 12(%ebp). %eax addl 8(%ebp), %eax movl %eax, global_int ; **** } popl %ebp ret ¾Æ·¡ ¼Ò½º´Â ¶È°°Àº C ¼Ò½º¸¦ -fomit-frame-pointer ¿É¼ÇÀ» ½á¼ ¾î¼ÀºíÇÑ °ÍÀÔ´Ï´Ù (À§ÀÇ ¾î¼Àºí ¸®½ºÆ®¿Í ºñ±³Çغ¸½Ã±â ¹Ù¶ø´Ï´Ù):
; **** void
; **** bar(int a, int b) ; **** { ; **** global_int = a + b movl 8(%esp). %eax addl 4(%esp), %eax movl %eax, global_int ; **** } ret Áï, ù ¾î¼Àºí ¸®½ºÆ®¿¡¼, ÇÔ¼ö ù ºÎºÐ¿¡¼ pushl, movl ºÎºÐ°ú ¸¶Áö¸· ret À§ÀÇ poplÀÌ ºüÁ³½À´Ï´Ù. ¶ÇÇÑ ÇÔ¼öÀÇ ÀÎÀÚ¸¦ Àü´ÞÇÏ´Â ºÎºÐ¿¡¼ EBP ´ë½Å¿¡ ESP register¸¦ ¾´ °ÍÀ» º¼ ¼ö ÀÖ½À´Ï´Ù.
TODO: Á» ´õ ¼³¸íÀ» ºÙÀÏ °Í. -- ½Å¼º±¹
|