- 컴파일은 인간이 이해할 수 있는 형식 언어 (C ,C++ 등) 로 작성된 소스 코드를 CPU 가
이해할 수 있는 기계어로 번역하는 과정
+ 인스트럭션과 어셈블리
- 기계어를 다른 말로 머신 인스턱션(machine insturction ) 즉, 기계 명령이라 한다.
- objdump -S likelike123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231likelike: file format elf32-i386Disassembly of section .init:080482b0 <_init>:80482b0: 53 push %ebx80482b1: 83 ec 08 sub $0x8,%esp80482b4: e8 97 00 00 00 call 8048350 <__x86.get_pc_thunk.bx>80482b9: 81 c3 47 1d 00 00 add $0x1d47,%ebx80482bf: 8b 83 fc ff ff ff mov -0x4(%ebx),%eax80482c5: 85 c0 test %eax,%eax80482c7: 74 05 je 80482ce <_init+0x1e>80482c9: e8 32 00 00 00 call 8048300 <__gmon_start__@plt>80482ce: 83 c4 08 add $0x8,%esp80482d1: 5b pop %ebx80482d2: c3 retDisassembly of section .plt:080482e0 <puts@plt-0x10>:80482e0: ff 35 04 a0 04 08 pushl 0x804a00480482e6: ff 25 08 a0 04 08 jmp *0x804a00880482ec: 00 00 add %al,(%eax)...080482f0 <puts@plt>:80482f0: ff 25 0c a0 04 08 jmp *0x804a00c80482f6: 68 00 00 00 00 push $0x080482fb: e9 e0 ff ff ff jmp 80482e0 <_init+0x30>08048300 <__gmon_start__@plt>:8048300: ff 25 10 a0 04 08 jmp *0x804a0108048306: 68 08 00 00 00 push $0x8804830b: e9 d0 ff ff ff jmp 80482e0 <_init+0x30>08048310 <__libc_start_main@plt>:8048310: ff 25 14 a0 04 08 jmp *0x804a0148048316: 68 10 00 00 00 push $0x10804831b: e9 c0 ff ff ff jmp 80482e0 <_init+0x30>Disassembly of section .text:08048320 <_start>:8048320: 31 ed xor %ebp,%ebp8048322: 5e pop %esi8048323: 89 e1 mov %esp,%ecx8048325: 83 e4 f0 and $0xfffffff0,%esp8048328: 50 push %eax8048329: 54 push %esp804832a: 52 push %edx804832b: 68 b0 84 04 08 push $0x80484b08048330: 68 40 84 04 08 push $0x80484408048335: 51 push %ecx8048336: 56 push %esi8048337: 68 1d 84 04 08 push $0x804841d804833c: e8 cf ff ff ff call 8048310 <__libc_start_main@plt>8048341: f4 hlt8048342: 66 90 xchg %ax,%ax8048344: 66 90 xchg %ax,%ax8048346: 66 90 xchg %ax,%ax8048348: 66 90 xchg %ax,%ax804834a: 66 90 xchg %ax,%ax804834c: 66 90 xchg %ax,%ax804834e: 66 90 xchg %ax,%ax08048350 <__x86.get_pc_thunk.bx>:8048350: 8b 1c 24 mov (%esp),%ebx8048353: c3 ret8048354: 66 90 xchg %ax,%ax8048356: 66 90 xchg %ax,%ax8048358: 66 90 xchg %ax,%ax804835a: 66 90 xchg %ax,%ax804835c: 66 90 xchg %ax,%ax804835e: 66 90 xchg %ax,%ax08048360 <deregister_tm_clones>:8048360: b8 23 a0 04 08 mov $0x804a023,%eax8048365: 2d 20 a0 04 08 sub $0x804a020,%eax804836a: 83 f8 06 cmp $0x6,%eax804836d: 77 01 ja 8048370 <deregister_tm_clones+0x10>804836f: c3 ret8048370: b8 00 00 00 00 mov $0x0,%eax8048375: 85 c0 test %eax,%eax8048377: 74 f6 je 804836f <deregister_tm_clones+0xf>8048379: 55 push %ebp804837a: 89 e5 mov %esp,%ebp804837c: 83 ec 18 sub $0x18,%esp804837f: c7 04 24 20 a0 04 08 movl $0x804a020,(%esp)8048386: ff d0 call *%eax8048388: c9 leave8048389: c3 ret804838a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi08048390 <register_tm_clones>:8048390: b8 20 a0 04 08 mov $0x804a020,%eax8048395: 2d 20 a0 04 08 sub $0x804a020,%eax804839a: c1 f8 02 sar $0x2,%eax804839d: 89 c2 mov %eax,%edx804839f: c1 ea 1f shr $0x1f,%edx80483a2: 01 d0 add %edx,%eax80483a4: d1 f8 sar %eax80483a6: 75 01 jne 80483a9 <register_tm_clones+0x19>80483a8: c3 ret80483a9: ba 00 00 00 00 mov $0x0,%edx80483ae: 85 d2 test %edx,%edx80483b0: 74 f6 je 80483a8 <register_tm_clones+0x18>80483b2: 55 push %ebp80483b3: 89 e5 mov %esp,%ebp80483b5: 83 ec 18 sub $0x18,%esp80483b8: 89 44 24 04 mov %eax,0x4(%esp)80483bc: c7 04 24 20 a0 04 08 movl $0x804a020,(%esp)80483c3: ff d2 call *%edx80483c5: c9 leave80483c6: c3 ret80483c7: 89 f6 mov %esi,%esi80483c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi080483d0 <__do_global_dtors_aux>:80483d0: 80 3d 20 a0 04 08 00 cmpb $0x0,0x804a02080483d7: 75 13 jne 80483ec <__do_global_dtors_aux+0x1c>80483d9: 55 push %ebp80483da: 89 e5 mov %esp,%ebp80483dc: 83 ec 08 sub $0x8,%esp80483df: e8 7c ff ff ff call 8048360 <deregister_tm_clones>80483e4: c6 05 20 a0 04 08 01 movb $0x1,0x804a02080483eb: c9 leave80483ec: f3 c3 repz ret80483ee: 66 90 xchg %ax,%ax080483f0 <frame_dummy>:80483f0: a1 10 9f 04 08 mov 0x8049f10,%eax80483f5: 85 c0 test %eax,%eax80483f7: 74 1f je 8048418 <frame_dummy+0x28>80483f9: b8 00 00 00 00 mov $0x0,%eax80483fe: 85 c0 test %eax,%eax8048400: 74 16 je 8048418 <frame_dummy+0x28>8048402: 55 push %ebp8048403: 89 e5 mov %esp,%ebp8048405: 83 ec 18 sub $0x18,%esp8048408: c7 04 24 10 9f 04 08 movl $0x8049f10,(%esp)804840f: ff d0 call *%eax8048411: c9 leave8048412: e9 79 ff ff ff jmp 8048390 <register_tm_clones>8048417: 90 nop8048418: e9 73 ff ff ff jmp 8048390 <register_tm_clones>0804841d <main>:#include <stdio.h>int main(){804841d: 55 push %ebp804841e: 89 e5 mov %esp,%ebp8048420: 83 e4 f0 and $0xfffffff0,%esp8048423: 83 ec 10 sub $0x10,%espprintf("I like you\n");8048426: c7 04 24 d0 84 04 08 movl $0x80484d0,(%esp)804842d: e8 be fe ff ff call 80482f0 <puts@plt>return 0;8048432: b8 00 00 00 00 mov $0x0,%eax}8048437: c9 leave8048438: c3 ret8048439: 66 90 xchg %ax,%ax804843b: 66 90 xchg %ax,%ax804843d: 66 90 xchg %ax,%ax804843f: 90 nop08048440 <__libc_csu_init>:8048440: 55 push %ebp8048441: 57 push %edi8048442: 31 ff xor %edi,%edi8048444: 56 push %esi8048445: 53 push %ebx8048446: e8 05 ff ff ff call 8048350 <__x86.get_pc_thunk.bx>804844b: 81 c3 b5 1b 00 00 add $0x1bb5,%ebx8048451: 83 ec 1c sub $0x1c,%esp8048454: 8b 6c 24 30 mov 0x30(%esp),%ebp8048458: 8d b3 0c ff ff ff lea -0xf4(%ebx),%esi804845e: e8 4d fe ff ff call 80482b0 <_init>8048463: 8d 83 08 ff ff ff lea -0xf8(%ebx),%eax8048469: 29 c6 sub %eax,%esi804846b: c1 fe 02 sar $0x2,%esi804846e: 85 f6 test %esi,%esi8048470: 74 27 je 8048499 <__libc_csu_init+0x59>8048472: 8d b6 00 00 00 00 lea 0x0(%esi),%esi8048478: 8b 44 24 38 mov 0x38(%esp),%eax804847c: 89 2c 24 mov %ebp,(%esp)804847f: 89 44 24 08 mov %eax,0x8(%esp)8048483: 8b 44 24 34 mov 0x34(%esp),%eax8048487: 89 44 24 04 mov %eax,0x4(%esp)804848b: ff 94 bb 08 ff ff ff call *-0xf8(%ebx,%edi,4)8048492: 83 c7 01 add $0x1,%edi8048495: 39 f7 cmp %esi,%edi8048497: 75 df jne 8048478 <__libc_csu_init+0x38>8048499: 83 c4 1c add $0x1c,%esp804849c: 5b pop %ebx804849d: 5e pop %esi804849e: 5f pop %edi804849f: 5d pop %ebp80484a0: c3 ret80484a1: eb 0d jmp 80484b0 <__libc_csu_fini>80484a3: 90 nop80484a4: 90 nop80484a5: 90 nop80484a6: 90 nop80484a7: 90 nop80484a8: 90 nop80484a9: 90 nop80484aa: 90 nop80484ab: 90 nop80484ac: 90 nop80484ad: 90 nop80484ae: 90 nop80484af: 90 nop080484b0 <__libc_csu_fini>:80484b0: f3 c3 repz retDisassembly of section .fini:080484b4 <_fini>:80484b4: 53 push %ebx80484b5: 83 ec 08 sub $0x8,%esp80484b8: e8 93 fe ff ff call 8048350 <__x86.get_pc_thunk.bx>80484bd: 81 c3 43 1b 00 00 add $0x1b43,%ebx80484c3: 83 c4 08 add $0x8,%esp80484c6: 5b pop %ebx80484c7: c3 ret
- objdump 명령은 바이너리 파일의 정보를 보기 위한 명령이다.
'SYSTEM PROGRAMMING' 카테고리의 다른 글
SHELL PROGRAMMING (0) | 2015.08.10 |
---|---|
GCC Compiiler - 02. 알아 두면 유용한 C소스 컴파일 과정 (0) | 2015.08.06 |
버추얼박스(VirtualBox) 공유폴더 사용하기 Host-Windows, Guest-Ubuntu(Linux) (0) | 2015.08.06 |
IOCP 의 단계적 구현 (0) | 2015.08.06 |
stored procedure 와 아닌 코드.. (0) | 2015.08.05 |