[ CnUnix ] in KIDS ±Û ¾´ ÀÌ(By): illuza (ťƼÇÏ´Ï) ³¯ Â¥ (Date): 2002³â 10¿ù 15ÀÏ È­¿äÀÏ ¿ÀÈÄ 10½Ã 05ºÐ 02ÃÊ Á¦ ¸ñ(Title): [Áú¹®] gcc·Î ÄÄÆÄÀÏÇÒ ¶§ ±× ¼Ò½º¿¡ ´ëÇÑ assembly code¸¦ Ãâ·Â½ÃÅ°´Â ¿É¼ÇÀÌ ÀÖ³ª¿ä? ¿¹¸¦ µé¾î, a = b + c;¶ó´Â °Ô ÀÖ´Ù¸é, ´ëÃæ mov eax, b add eax, c mov dword ptr [ebx], eax ÀÌ·± ½ÄÀ¸·Î, ¹°·Ð gcc´Â À§¿¡¼­Ã³·³ intel ¹®¹ýÀÌ ¾Æ´ÏÁö¸¸, ³ªÅ¸³¾ ¼ö ÀÖ³ª¿ä? [ CnUnix ] in KIDS ±Û ¾´ ÀÌ(By): guest (guaset) ³¯ Â¥ (Date): 2002³â 10¿ù 15ÀÏ È­¿äÀÏ ¿ÀÈÄ 10½Ã 18ºÐ 52ÃÊ Á¦ ¸ñ(Title): Re: [Áú¹®] gcc·Î ÄÄÆÄÀÏÇÒ ¶§ gcc source.c -S cat source.s [ CnUnix ] in KIDS ±Û ¾´ ÀÌ(By): akira (Park_S_J_) ³¯ Â¥ (Date): 2002³â 10¿ù 15ÀÏ È­¿äÀÏ ¿ÀÈÄ 11½Ã 18ºÐ 33ÃÊ Á¦ ¸ñ(Title): Re: [Áú¹®] gcc·Î ÄÄÆÄÀÏÇÒ ¶§ % gcc -g -c a.c % objdump -S a.o a.o: file format elf32-i386 Disassembly of section .text: 00000000
: main() { 0: 55 push %ebp 1: 89 e5 mov %esp,%ebp 3: 83 ec 0c sub $0xc,%esp int a,b,c; a = b + c; 6: 8b 45 f4 mov 0xfffffff4(%ebp),%eax 9: 03 45 f8 add 0xfffffff8(%ebp),%eax c: 89 45 fc mov %eax,0xfffffffc(%ebp) a = b * c; f: 8b 45 f8 mov 0xfffffff8(%ebp),%eax 12: 0f af 45 f4 imul 0xfffffff4(%ebp),%eax 16: 89 45 fc mov %eax,0xfffffffc(%ebp) } 19: c9 leave 1a: c3 ret 1b: 90 nop ÀÌ·³ ÂÍ ´õ ¸ÚÁø°¡? ±Ùµ¥ Ȥ½Ã Àú 0xfffffffc¸¦ -4·Î ³ª¿À°Ô ÇÏ´Â ¹ý ¾Æ½Ã´Â ºÐ? [ CnUnix ] in KIDS ±Û ¾´ ÀÌ(By): terzeron (microkid) ³¯ Â¥ (Date): 2002³â 10¿ù 15ÀÏ È­¿äÀÏ ¿ÀÈÄ 11½Ã 43ºÐ 21ÃÊ Á¦ ¸ñ(Title): Re: [Áú¹®] gcc·Î ÄÄÆÄÀÏÇÒ ¶§ int a, b = -4, c = 5; a = b + c; gcc -S test.c as -a test.s (gasÀÎ °æ¿ì, Sun¿¡¼­´Â as -Sa test.s) GAS LISTING test.s page 1 1 .file "test.c" 2 .version "01.01" 3 gcc2_compiled.: 4 .text 5 .p2align 2,0x90 6 .globl main 7 .type main,@function 8 main: 9 0000 55 pushl %ebp 11 0003 83EC18 subl $24,%esp 12 0006 C745F8FC movl $-4,-8(%ebp) 12 FFFFFF 13 000d C745F405 movl $5,-12(%ebp) 13 000000 14 0014 8B45F8 movl -8(%ebp),%eax 15 0017 8B55F4 movl -12(%ebp),%edx 16 001a 8D0C02 leal (%edx,%eax),%ecx 17 001d 894DFC movl %ecx,-4(%ebp) 18 0020 31C0 xorl %eax,%eax 19 0022 EB00 jmp .L2 20 .p2align 2,0x90 21 .L2: 22 0024 C9 leave 23 0025 C3 ret 24 .Lfe1: 25 .size main,.Lfe1-main 26 .ident "[ASM_FILE_END]GCC: (c) 2.95.2 19991024 (r 6 .globl main elease)" GAS LISTING test.s page 2 DEFINED SYMBOLS *ABS*:00000000 test.c test.s:3 .text:00000000 gcc2_compiled. test.s:8 .text:00000000 main NO UNDEFINED SYMBOLS