• 컴파일은 인간이 이해할 수 있는 형식 언어 (C ,C++ 등) 로 작성된 소스 코드를 CPU 가  
    이해할 수 있는 기계어로 번역하는 과정
+ 인스트럭션과 어셈블리
  • 기계어를 다른 말로 머신 인스턱션(machine insturction ) 즉, 기계 명령이라 한다.
  • objdump -S likelike


    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    likelike:     file format elf32-i386
     
     
    Disassembly of section .init:
     
    080482b0 <_init>:
     80482b0:    53                       push   %ebx
     80482b1:    83 ec 08                 sub    $0x8,%esp
     80482b4:    e8 97 00 00 00           call   8048350 <__x86.get_pc_thunk.bx>
     80482b9:    81 c3 47 1d 00 00        add    $0x1d47,%ebx
     80482bf:    8b 83 fc ff ff ff        mov    -0x4(%ebx),%eax
     80482c5:    85 c0                    test   %eax,%eax
     80482c7:    74 05                    je     80482ce <_init+0x1e>
     80482c9:    e8 32 00 00 00           call   8048300 <__gmon_start__@plt>
     80482ce:    83 c4 08                 add    $0x8,%esp
     80482d1:    5b                       pop    %ebx
     80482d2:    c3                       ret    
     
    Disassembly of section .plt:
     
    080482e0 <puts@plt-0x10>:
     80482e0:    ff 35 04 a0 04 08        pushl  0x804a004
     80482e6:    ff 25 08 a0 04 08        jmp    *0x804a008
     80482ec:    00 00                    add    %al,(%eax)
        ...
     
    080482f0 <puts@plt>:
     80482f0:    ff 25 0c a0 04 08        jmp    *0x804a00c
     80482f6:    68 00 00 00 00           push   $0x0
     80482fb:    e9 e0 ff ff ff           jmp    80482e0 <_init+0x30>
     
    08048300 <__gmon_start__@plt>:
     8048300:    ff 25 10 a0 04 08        jmp    *0x804a010
     8048306:    68 08 00 00 00           push   $0x8
     804830b:    e9 d0 ff ff ff           jmp    80482e0 <_init+0x30>
     
    08048310 <__libc_start_main@plt>:
     8048310:    ff 25 14 a0 04 08        jmp    *0x804a014
     8048316:    68 10 00 00 00           push   $0x10
     804831b:    e9 c0 ff ff ff           jmp    80482e0 <_init+0x30>
     
    Disassembly of section .text:
     
    08048320 <_start>:
     8048320:    31 ed                    xor    %ebp,%ebp
     8048322:    5e                       pop    %esi
     8048323:    89 e1                    mov    %esp,%ecx
     8048325:    83 e4 f0                 and    $0xfffffff0,%esp
     8048328:    50                       push   %eax
     8048329:    54                       push   %esp
     804832a:    52                       push   %edx
     804832b:    68 b0 84 04 08           push   $0x80484b0
     8048330:    68 40 84 04 08           push   $0x8048440
     8048335:    51                       push   %ecx
     8048336:    56                       push   %esi
     8048337:    68 1d 84 04 08           push   $0x804841d
     804833c:    e8 cf ff ff ff           call   8048310 <__libc_start_main@plt>
     8048341:    f4                       hlt    
     8048342:    66 90                    xchg   %ax,%ax
     8048344:    66 90                    xchg   %ax,%ax
     8048346:    66 90                    xchg   %ax,%ax
     8048348:    66 90                    xchg   %ax,%ax
     804834a:    66 90                    xchg   %ax,%ax
     804834c:    66 90                    xchg   %ax,%ax
     804834e:    66 90                    xchg   %ax,%ax
     
    08048350 <__x86.get_pc_thunk.bx>:
     8048350:    8b 1c 24                 mov    (%esp),%ebx
     8048353:    c3                       ret    
     8048354:    66 90                    xchg   %ax,%ax
     8048356:    66 90                    xchg   %ax,%ax
     8048358:    66 90                    xchg   %ax,%ax
     804835a:    66 90                    xchg   %ax,%ax
     804835c:    66 90                    xchg   %ax,%ax
     804835e:    66 90                    xchg   %ax,%ax
     
    08048360 <deregister_tm_clones>:
     8048360:    b8 23 a0 04 08           mov    $0x804a023,%eax
     8048365:    2d 20 a0 04 08           sub    $0x804a020,%eax
     804836a:    83 f8 06                 cmp    $0x6,%eax
     804836d:    77 01                    ja     8048370 <deregister_tm_clones+0x10>
     804836f:    c3                       ret    
     8048370:    b8 00 00 00 00           mov    $0x0,%eax
     8048375:    85 c0                    test   %eax,%eax
     8048377:    74 f6                    je     804836f <deregister_tm_clones+0xf>
     8048379:    55                       push   %ebp
     804837a:    89 e5                    mov    %esp,%ebp
     804837c:    83 ec 18                 sub    $0x18,%esp
     804837f:    c7 04 24 20 a0 04 08     movl   $0x804a020,(%esp)
     8048386:    ff d0                    call   *%eax
     8048388:    c9                       leave  
     8048389:    c3                       ret    
     804838a:    8d b6 00 00 00 00        lea    0x0(%esi),%esi
     
    08048390 <register_tm_clones>:
     8048390:    b8 20 a0 04 08           mov    $0x804a020,%eax
     8048395:    2d 20 a0 04 08           sub    $0x804a020,%eax
     804839a:    c1 f8 02                 sar    $0x2,%eax
     804839d:    89 c2                    mov    %eax,%edx
     804839f:    c1 ea 1f                 shr    $0x1f,%edx
     80483a2:    01 d0                    add    %edx,%eax
     80483a4:    d1 f8                    sar    %eax
     80483a6:    75 01                    jne    80483a9 <register_tm_clones+0x19>
     80483a8:    c3                       ret    
     80483a9:    ba 00 00 00 00           mov    $0x0,%edx
     80483ae:    85 d2                    test   %edx,%edx
     80483b0:    74 f6                    je     80483a8 <register_tm_clones+0x18>
     80483b2:    55                       push   %ebp
     80483b3:    89 e5                    mov    %esp,%ebp
     80483b5:    83 ec 18                 sub    $0x18,%esp
     80483b8:    89 44 24 04              mov    %eax,0x4(%esp)
     80483bc:    c7 04 24 20 a0 04 08     movl   $0x804a020,(%esp)
     80483c3:    ff d2                    call   *%edx
     80483c5:    c9                       leave  
     80483c6:    c3                       ret    
     80483c7:    89 f6                    mov    %esi,%esi
     80483c9:    8d bc 27 00 00 00 00     lea    0x0(%edi,%eiz,1),%edi
     
    080483d0 <__do_global_dtors_aux>:
     80483d0:    80 3d 20 a0 04 08 00     cmpb   $0x0,0x804a020
     80483d7:    75 13                    jne    80483ec <__do_global_dtors_aux+0x1c>
     80483d9:    55                       push   %ebp
     80483da:    89 e5                    mov    %esp,%ebp
     80483dc:    83 ec 08                 sub    $0x8,%esp
     80483df:    e8 7c ff ff ff           call   8048360 <deregister_tm_clones>
     80483e4:    c6 05 20 a0 04 08 01     movb   $0x1,0x804a020
     80483eb:    c9                       leave  
     80483ec:    f3 c3                    repz ret 
     80483ee:    66 90                    xchg   %ax,%ax
     
    080483f0 <frame_dummy>:
     80483f0:    a1 10 9f 04 08           mov    0x8049f10,%eax
     80483f5:    85 c0                    test   %eax,%eax
     80483f7:    74 1f                    je     8048418 <frame_dummy+0x28>
     80483f9:    b8 00 00 00 00           mov    $0x0,%eax
     80483fe:    85 c0                    test   %eax,%eax
     8048400:    74 16                    je     8048418 <frame_dummy+0x28>
     8048402:    55                       push   %ebp
     8048403:    89 e5                    mov    %esp,%ebp
     8048405:    83 ec 18                 sub    $0x18,%esp
     8048408:    c7 04 24 10 9f 04 08     movl   $0x8049f10,(%esp)
     804840f:    ff d0                    call   *%eax
     8048411:    c9                       leave  
     8048412:    e9 79 ff ff ff           jmp    8048390 <register_tm_clones>
     8048417:    90                       nop
     8048418:    e9 73 ff ff ff           jmp    8048390 <register_tm_clones>
     
    0804841d <main>:
    #include <stdio.h>
     
    int main()
    {
     804841d:    55                       push   %ebp
     804841e:    89 e5                    mov    %esp,%ebp
     8048420:    83 e4 f0                 and    $0xfffffff0,%esp
     8048423:    83 ec 10                 sub    $0x10,%esp
        printf("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                       leave  
     8048438:    c3                       ret    
     8048439:    66 90                    xchg   %ax,%ax
     804843b:    66 90                    xchg   %ax,%ax
     804843d:    66 90                    xchg   %ax,%ax
     804843f:    90                       nop
     
    08048440 <__libc_csu_init>:
     8048440:    55                       push   %ebp
     8048441:    57                       push   %edi
     8048442:    31 ff                    xor    %edi,%edi
     8048444:    56                       push   %esi
     8048445:    53                       push   %ebx
     8048446:    e8 05 ff ff ff           call   8048350 <__x86.get_pc_thunk.bx>
     804844b:    81 c3 b5 1b 00 00        add    $0x1bb5,%ebx
     8048451:    83 ec 1c                 sub    $0x1c,%esp
     8048454:    8b 6c 24 30              mov    0x30(%esp),%ebp
     8048458:    8d b3 0c ff ff ff        lea    -0xf4(%ebx),%esi
     804845e:    e8 4d fe ff ff           call   80482b0 <_init>
     8048463:    8d 83 08 ff ff ff        lea    -0xf8(%ebx),%eax
     8048469:    29 c6                    sub    %eax,%esi
     804846b:    c1 fe 02                 sar    $0x2,%esi
     804846e:    85 f6                    test   %esi,%esi
     8048470:    74 27                    je     8048499 <__libc_csu_init+0x59>
     8048472:    8d b6 00 00 00 00        lea    0x0(%esi),%esi
     8048478:    8b 44 24 38              mov    0x38(%esp),%eax
     804847c:    89 2c 24                 mov    %ebp,(%esp)
     804847f:    89 44 24 08              mov    %eax,0x8(%esp)
     8048483:    8b 44 24 34              mov    0x34(%esp),%eax
     8048487:    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,%edi
     8048495:    39 f7                    cmp    %esi,%edi
     8048497:    75 df                    jne    8048478 <__libc_csu_init+0x38>
     8048499:    83 c4 1c                 add    $0x1c,%esp
     804849c:    5b                       pop    %ebx
     804849d:    5e                       pop    %esi
     804849e:    5f                       pop    %edi
     804849f:    5d                       pop    %ebp
     80484a0:    c3                       ret    
     80484a1:    eb 0d                    jmp    80484b0 <__libc_csu_fini>
     80484a3:    90                       nop
     80484a4:    90                       nop
     80484a5:    90                       nop
     80484a6:    90                       nop
     80484a7:    90                       nop
     80484a8:    90                       nop
     80484a9:    90                       nop
     80484aa:    90                       nop
     80484ab:    90                       nop
     80484ac:    90                       nop
     80484ad:    90                       nop
     80484ae:    90                       nop
     80484af:    90                       nop
     
    080484b0 <__libc_csu_fini>:
     80484b0:    f3 c3                    repz ret 
     
    Disassembly of section .fini:
     
    080484b4 <_fini>:
     80484b4:    53                       push   %ebx
     80484b5:    83 ec 08                 sub    $0x8,%esp
     80484b8:    e8 93 fe ff ff           call   8048350 <__x86.get_pc_thunk.bx>
     80484bd:    81 c3 43 1b 00 00        add    $0x1b43,%ebx
     80484c3:    83 c4 08                 add    $0x8,%esp
     80484c6:    5b                       pop    %ebx
     80484c7:    c3                       ret    
     
  • objdump 명령은 바이너리 파일의 정보를 보기 위한 명령이다. 


Posted by 뉴암스테르담
l