MP_01 Gruntgerüst

This commit is contained in:
Johannes Theiner 2018-03-12 15:20:16 +01:00
parent 9f71fa1ae6
commit 83923c1e71
11 changed files with 221 additions and 342 deletions

2
01_ENV/build-c.sh Executable file
View File

@ -0,0 +1,2 @@
clang-6.0 -c func1.c main.c
clang-6.0 -o test.out -s func1.o main.o

0
01_ENV/build.sh Normal file → Executable file
View File

0
01_ENV/clean.sh Normal file → Executable file
View File

5
01_ENV/func1.c Normal file
View File

@ -0,0 +1,5 @@
#define func1
int func2(int x) {
return x + 10;
}

1
01_ENV/func1.h Normal file
View File

@ -0,0 +1 @@
int func2(int x);

BIN
01_ENV/func1.o Normal file

Binary file not shown.

View File

@ -1,5 +1,7 @@
#include <stdio.h> #include <stdio.h>
#include "func1.h"
int global = 8150; int global = 8150;
@ -16,6 +18,7 @@ int main(int argc, char **argv)
{ {
int local=4711; int local=4711;
printf("Hello, world!\nglobal=%d local=%d\n", global, local); printf("Hello, world!\nglobal=%d local=%d\n", global, local);
printf("Hallo Welt %d\n" ,func2(2));
local = sum(global, local); local = sum(global, local);
return local; return local;
} }

BIN
01_ENV/main.o Normal file

Binary file not shown.

View File

@ -1,58 +0,0 @@
.data
.align 4
.globl global
.type global,@object
.size global,4
global:
.long 8150
.text
.align 4
.globl sum
.type sum,@function
sum:
enter $8,$0
.L461:
.L465:
movl $451,-4(%ebp)
movl 8(%ebp),%eax
addl 12(%ebp),%eax
movl %eax,-4(%ebp)
movl -4(%ebp),%eax
movl %eax,-8(%ebp)
jmp .L463
.L463:
movl -8(%ebp),%eax
leave
ret
.size sum,.-sum
.align 4
.globl main
.type main,@function
main:
enter $8,$0
.L469:
.L473:
movl $4711,-4(%ebp)
pushl -4(%ebp)
pushl global
pushl $.L475
call printf
addl $12, %esp
pushl -4(%ebp)
pushl global
call sum
addl $8, %esp
movl %eax,-4(%ebp)
movl -4(%ebp),%eax
movl %eax,-8(%ebp)
jmp .L471
.L471:
movl -8(%ebp),%eax
leave
ret
.size main,.-main
.section .rodata
.size .L475,34
.L475:
.ascii "Hello, world!\012global=%d local=%d\012\0"
.ident "PCC: Portable C Compiler 1.2.0.DEVEL 20160115 for i686-pc-linux-gnu"

View File

@ -1,324 +1,250 @@
a.out: file format elf32-i386 a.out: Dateiformat elf64-x86-64
Disassembly of section .init: Disassembly of section .init:
08048278 <_init>: 0000000000400378 <_init>:
8048278: 53 push %ebx 400378: 48 83 ec 08 sub $0x8,%rsp
8048279: 83 ec 08 sub $0x8,%esp 40037c: 48 8b 05 75 0c 20 00 mov 0x200c75(%rip),%rax # 600ff8 <__gmon_start__>
804827c: e8 8f 00 00 00 call 8048310 <__x86.get_pc_thunk.bx> 400383: 48 85 c0 test %rax,%rax
8048281: 81 c3 7f 1d 00 00 add $0x1d7f,%ebx 400386: 74 02 je 40038a <_init+0x12>
8048287: 8b 83 fc ff ff ff mov -0x4(%ebx),%eax 400388: ff d0 callq *%rax
804828d: 85 c0 test %eax,%eax 40038a: e8 61 00 00 00 callq 4003f0 <__do_global_ctors_aux>
804828f: 74 05 je 8048296 <_init+0x1e> 40038f: 48 83 c4 08 add $0x8,%rsp
8048291: e8 2a 00 00 00 call 80482c0 <__gmon_start__@plt> 400393: c3 retq
8048296: e8 45 01 00 00 call 80483e0 <__do_global_ctors_aux>
804829b: 83 c4 08 add $0x8,%esp
804829e: 5b pop %ebx
804829f: c3 ret
Disassembly of section .plt: Disassembly of section .plt:
080482a0 <printf@plt-0x10>: 00000000004003a0 <.plt>:
80482a0: ff 35 04 a0 04 08 pushl 0x804a004 4003a0: ff 35 62 0c 20 00 pushq 0x200c62(%rip) # 601008 <_GLOBAL_OFFSET_TABLE_+0x8>
80482a6: ff 25 08 a0 04 08 jmp *0x804a008 4003a6: ff 25 64 0c 20 00 jmpq *0x200c64(%rip) # 601010 <_GLOBAL_OFFSET_TABLE_+0x10>
80482ac: 00 00 add %al,(%eax) 4003ac: 0f 1f 40 00 nopl 0x0(%rax)
...
080482b0 <printf@plt>: 00000000004003b0 <printf@plt>:
80482b0: ff 25 0c a0 04 08 jmp *0x804a00c 4003b0: ff 25 62 0c 20 00 jmpq *0x200c62(%rip) # 601018 <printf@GLIBC_2.2.5>
80482b6: 68 00 00 00 00 push $0x0 4003b6: 68 00 00 00 00 pushq $0x0
80482bb: e9 e0 ff ff ff jmp 80482a0 <_init+0x28> 4003bb: e9 e0 ff ff ff jmpq 4003a0 <.plt>
080482c0 <__gmon_start__@plt>:
80482c0: ff 25 10 a0 04 08 jmp *0x804a010
80482c6: 68 08 00 00 00 push $0x8
80482cb: e9 d0 ff ff ff jmp 80482a0 <_init+0x28>
080482d0 <__libc_start_main@plt>:
80482d0: ff 25 14 a0 04 08 jmp *0x804a014
80482d6: 68 10 00 00 00 push $0x10
80482db: e9 c0 ff ff ff jmp 80482a0 <_init+0x28>
Disassembly of section .text: Disassembly of section .text:
080482e0 <_start>: 00000000004003c0 <_start>:
80482e0: 31 ed xor %ebp,%ebp 4003c0: 31 ed xor %ebp,%ebp
80482e2: 5e pop %esi 4003c2: 49 89 d1 mov %rdx,%r9
80482e3: 89 e1 mov %esp,%ecx 4003c5: 5e pop %rsi
80482e5: 83 e4 f0 and $0xfffffff0,%esp 4003c6: 48 89 e2 mov %rsp,%rdx
80482e8: 50 push %eax 4003c9: 48 83 e4 f0 and $0xfffffffffffffff0,%rsp
80482e9: 54 push %esp 4003cd: 50 push %rax
80482ea: 52 push %edx 4003ce: 54 push %rsp
80482eb: 68 30 85 04 08 push $0x8048530 4003cf: 49 c7 c0 00 06 40 00 mov $0x400600,%r8
80482f0: 68 d0 84 04 08 push $0x80484d0 4003d6: 48 c7 c1 90 05 40 00 mov $0x400590,%rcx
80482f5: 51 push %ecx 4003dd: 48 c7 c7 28 05 40 00 mov $0x400528,%rdi
80482f6: 56 push %esi 4003e4: ff 15 06 0c 20 00 callq *0x200c06(%rip) # 600ff0 <__libc_start_main@GLIBC_2.2.5>
80482f7: 68 8c 84 04 08 push $0x804848c 4003ea: f4 hlt
80482fc: e8 cf ff ff ff call 80482d0 <__libc_start_main@plt> 4003eb: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1)
8048301: f4 hlt
8048302: 66 90 xchg %ax,%ax
8048304: 66 90 xchg %ax,%ax
8048306: 66 90 xchg %ax,%ax
8048308: 66 90 xchg %ax,%ax
804830a: 66 90 xchg %ax,%ax
804830c: 66 90 xchg %ax,%ax
804830e: 66 90 xchg %ax,%ax
08048310 <__x86.get_pc_thunk.bx>: 00000000004003f0 <__do_global_ctors_aux>:
8048310: 8b 1c 24 mov (%esp),%ebx 4003f0: 8b 05 36 0c 20 00 mov 0x200c36(%rip),%eax # 60102c <initialized.1836>
8048313: c3 ret 4003f6: 85 c0 test %eax,%eax
8048314: 66 90 xchg %ax,%ax 4003f8: 74 06 je 400400 <__do_global_ctors_aux+0x10>
8048316: 66 90 xchg %ax,%ax 4003fa: f3 c3 repz retq
8048318: 66 90 xchg %ax,%ax 4003fc: 0f 1f 40 00 nopl 0x0(%rax)
804831a: 66 90 xchg %ax,%ax 400400: 55 push %rbp
804831c: 66 90 xchg %ax,%ax 400401: 53 push %rbx
804831e: 66 90 xchg %ax,%ax 400402: 48 83 ec 08 sub $0x8,%rsp
400406: 48 8b 05 33 0a 20 00 mov 0x200a33(%rip),%rax # 600e40 <__CTOR_LIST__>
40040d: c7 05 15 0c 20 00 01 movl $0x1,0x200c15(%rip) # 60102c <initialized.1836>
400414: 00 00 00
400417: 48 83 f8 ff cmp $0xffffffffffffffff,%rax
40041b: 48 89 c1 mov %rax,%rcx
40041e: 74 38 je 400458 <__do_global_ctors_aux+0x68>
400420: 48 8d 15 19 0a 20 00 lea 0x200a19(%rip),%rdx # 600e40 <__CTOR_LIST__>
400427: 48 85 c0 test %rax,%rax
40042a: 48 8d 58 ff lea -0x1(%rax),%rbx
40042e: 48 8d 14 c2 lea (%rdx,%rax,8),%rdx
400432: 74 1a je 40044e <__do_global_ctors_aux+0x5e>
400434: 48 89 d8 mov %rbx,%rax
400437: 48 f7 d8 neg %rax
40043a: 48 8d 2c c2 lea (%rdx,%rax,8),%rbp
40043e: 66 90 xchg %ax,%ax
400440: ff 54 dd 00 callq *0x0(%rbp,%rbx,8)
400444: 48 83 eb 01 sub $0x1,%rbx
400448: 48 83 fb ff cmp $0xffffffffffffffff,%rbx
40044c: 75 f2 jne 400440 <__do_global_ctors_aux+0x50>
40044e: 48 83 c4 08 add $0x8,%rsp
400452: 5b pop %rbx
400453: 5d pop %rbp
400454: c3 retq
400455: 0f 1f 00 nopl (%rax)
400458: 48 83 3d e8 09 20 00 cmpq $0x0,0x2009e8(%rip) # 600e48 <__CTOR_LIST__+0x8>
40045f: 00
400460: 74 ec je 40044e <__do_global_ctors_aux+0x5e>
400462: b8 01 00 00 00 mov $0x1,%eax
400467: eb 0a jmp 400473 <__do_global_ctors_aux+0x83>
400469: 0f 1f 80 00 00 00 00 nopl 0x0(%rax)
400470: 48 89 d0 mov %rdx,%rax
400473: 48 85 c9 test %rcx,%rcx
400476: 48 8d 50 01 lea 0x1(%rax),%rdx
40047a: 75 f4 jne 400470 <__do_global_ctors_aux+0x80>
40047c: eb a2 jmp 400420 <__do_global_ctors_aux+0x30>
40047e: 66 90 xchg %ax,%ax
08048320 <__ctors>: 0000000000400480 <__do_global_dtors_aux>:
8048320: e8 34 01 00 00 call 8048459 <__x86.get_pc_thunk.ax> 400480: 8b 05 a2 0b 20 00 mov 0x200ba2(%rip),%eax # 601028 <_edata>
8048325: 05 db 1c 00 00 add $0x1cdb,%eax 400486: 85 c0 test %eax,%eax
804832a: 56 push %esi 400488: 75 46 jne 4004d0 <__do_global_dtors_aux+0x50>
804832b: 53 push %ebx 40048a: 48 8b 05 c7 09 20 00 mov 0x2009c7(%rip),%rax # 600e58 <__DTOR_LIST__+0x8>
804832c: 8d 64 24 fc lea -0x4(%esp),%esp 400491: 48 85 c0 test %rax,%rax
8048330: 8d 88 24 ff ff ff lea -0xdc(%eax),%ecx 400494: 74 2a je 4004c0 <__do_global_dtors_aux+0x40>
8048336: 8b 11 mov (%ecx),%edx 400496: 53 push %rbx
8048338: 83 fa ff cmp $0xffffffff,%edx 400497: 48 8d 1d ba 09 20 00 lea 0x2009ba(%rip),%rbx # 600e58 <__DTOR_LIST__+0x8>
804833b: 74 2b je 8048368 <__ctors+0x48> 40049e: 66 90 xchg %ax,%ax
804833d: 8d 5a ff lea -0x1(%edx),%ebx 4004a0: 48 83 c3 08 add $0x8,%rbx
8048340: 8d 34 91 lea (%ecx,%edx,4),%esi 4004a4: ff d0 callq *%rax
8048343: 8d 04 9d 00 00 00 00 lea 0x0(,%ebx,4),%eax 4004a6: 48 8b 03 mov (%rbx),%rax
804834a: 29 c6 sub %eax,%esi 4004a9: 48 85 c0 test %rax,%rax
804834c: 85 d2 test %edx,%edx 4004ac: 75 f2 jne 4004a0 <__do_global_dtors_aux+0x20>
804834e: 74 0a je 804835a <__ctors+0x3a> 4004ae: c7 05 70 0b 20 00 01 movl $0x1,0x200b70(%rip) # 601028 <_edata>
8048350: ff 14 9e call *(%esi,%ebx,4) 4004b5: 00 00 00
8048353: 85 db test %ebx,%ebx 4004b8: 5b pop %rbx
8048355: 8d 5b ff lea -0x1(%ebx),%ebx 4004b9: c3 retq
8048358: 75 f6 jne 8048350 <__ctors+0x30> 4004ba: 66 0f 1f 44 00 00 nopw 0x0(%rax,%rax,1)
804835a: 8d 64 24 04 lea 0x4(%esp),%esp 4004c0: c7 05 5e 0b 20 00 01 movl $0x1,0x200b5e(%rip) # 601028 <_edata>
804835e: 5b pop %ebx 4004c7: 00 00 00
804835f: 5e pop %esi 4004ca: c3 retq
8048360: c3 ret 4004cb: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1)
8048361: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 4004d0: f3 c3 repz retq
8048368: 8b 71 04 mov 0x4(%ecx),%esi 4004d2: 0f 1f 40 00 nopl 0x0(%rax)
804836b: 85 f6 test %esi,%esi 4004d6: 66 2e 0f 1f 84 00 00 nopw %cs:0x0(%rax,%rax,1)
804836d: 74 eb je 804835a <__ctors+0x3a> 4004dd: 00 00 00
804836f: ba 01 00 00 00 mov $0x1,%edx
8048374: eb 04 jmp 804837a <__ctors+0x5a>
8048376: 66 90 xchg %ax,%ax
8048378: 89 c2 mov %eax,%edx
804837a: 8d 42 01 lea 0x1(%edx),%eax
804837d: 8b 1c 81 mov (%ecx,%eax,4),%ebx
8048380: 85 db test %ebx,%ebx
8048382: 75 f4 jne 8048378 <__ctors+0x58>
8048384: eb b7 jmp 804833d <__ctors+0x1d>
8048386: 8d 76 00 lea 0x0(%esi),%esi
8048389: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
08048390 <__dtors>: 00000000004004e0 <__call___do_global_ctors_aux>:
8048390: e8 c4 00 00 00 call 8048459 <__x86.get_pc_thunk.ax> 4004e0: 48 83 ec 08 sub $0x8,%rsp
8048395: 05 6b 1c 00 00 add $0x1c6b,%eax 4004e4: 48 83 c4 08 add $0x8,%rsp
804839a: 53 push %ebx 4004e8: c3 retq
804839b: 8d 64 24 f8 lea -0x8(%esp),%esp 4004e9: 0f 1f 80 00 00 00 00 nopl 0x0(%rax)
804839f: 8d 90 2c ff ff ff lea -0xd4(%eax),%edx
80483a5: 89 d3 mov %edx,%ebx
80483a7: 83 c3 04 add $0x4,%ebx
80483aa: 8b 42 04 mov 0x4(%edx),%eax
80483ad: 85 c0 test %eax,%eax
80483af: 74 1a je 80483cb <__dtors+0x3b>
80483b1: eb 0d jmp 80483c0 <__dtors+0x30>
80483b3: 90 nop
80483b4: 90 nop
80483b5: 90 nop
80483b6: 90 nop
80483b7: 90 nop
80483b8: 90 nop
80483b9: 90 nop
80483ba: 90 nop
80483bb: 90 nop
80483bc: 90 nop
80483bd: 90 nop
80483be: 90 nop
80483bf: 90 nop
80483c0: 8d 5b 04 lea 0x4(%ebx),%ebx
80483c3: ff d0 call *%eax
80483c5: 8b 03 mov (%ebx),%eax
80483c7: 85 c0 test %eax,%eax
80483c9: 75 f5 jne 80483c0 <__dtors+0x30>
80483cb: 8d 64 24 08 lea 0x8(%esp),%esp
80483cf: 5b pop %ebx
80483d0: c3 ret
80483d1: eb 0d jmp 80483e0 <__do_global_ctors_aux>
80483d3: 90 nop
80483d4: 90 nop
80483d5: 90 nop
80483d6: 90 nop
80483d7: 90 nop
80483d8: 90 nop
80483d9: 90 nop
80483da: 90 nop
80483db: 90 nop
80483dc: 90 nop
80483dd: 90 nop
80483de: 90 nop
80483df: 90 nop
080483e0 <__do_global_ctors_aux>: 00000000004004f0 <__call___do_global_dtors_aux>:
80483e0: e8 74 00 00 00 call 8048459 <__x86.get_pc_thunk.ax> 4004f0: 48 83 ec 08 sub $0x8,%rsp
80483e5: 05 1b 1c 00 00 add $0x1c1b,%eax 4004f4: 48 83 c4 08 add $0x8,%rsp
80483ea: 8b 90 24 00 00 00 mov 0x24(%eax),%edx 4004f8: c3 retq
80483f0: 85 d2 test %edx,%edx 4004f9: 0f 1f 00 nopl (%rax)
80483f2: 74 04 je 80483f8 <__do_global_ctors_aux+0x18>
80483f4: c3 ret
80483f5: 8d 76 00 lea 0x0(%esi),%esi
80483f8: c7 80 24 00 00 00 01 movl $0x1,0x24(%eax)
80483ff: 00 00 00
8048402: e9 19 ff ff ff jmp 8048320 <__ctors>
8048407: 89 f6 mov %esi,%esi
8048409: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
08048410 <__do_global_dtors_aux>: 00000000004004fc <sum>:
8048410: 53 push %ebx
8048411: e8 fa fe ff ff call 8048310 <__x86.get_pc_thunk.bx>
8048416: 81 c3 ea 1b 00 00 add $0x1bea,%ebx
804841c: 8d 64 24 f8 lea -0x8(%esp),%esp
8048420: 8b 83 20 00 00 00 mov 0x20(%ebx),%eax
8048426: 85 c0 test %eax,%eax
8048428: 75 0f jne 8048439 <__do_global_dtors_aux+0x29>
804842a: e8 61 ff ff ff call 8048390 <__dtors>
804842f: c7 83 20 00 00 00 01 movl $0x1,0x20(%ebx)
8048436: 00 00 00
8048439: 8d 64 24 08 lea 0x8(%esp),%esp
804843d: 5b pop %ebx
804843e: c3 ret
804843f: 90 nop
08048440 <__call___do_global_ctors_aux>:
8048440: 8d 64 24 f4 lea -0xc(%esp),%esp
8048444: 8d 64 24 0c lea 0xc(%esp),%esp
8048448: c3 ret
8048449: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
08048450 <__call___do_global_dtors_aux>:
8048450: 8d 64 24 f4 lea -0xc(%esp),%esp
8048454: 8d 64 24 0c lea 0xc(%esp),%esp
8048458: c3 ret
08048459 <__x86.get_pc_thunk.ax>:
8048459: 90 nop
804845a: 90 nop
804845b: 90 nop
804845c: 90 nop
804845d: 90 nop
804845e: 90 nop
804845f: 90 nop
8048460: 90 nop
8048461: 8b 04 24 mov (%esp),%eax
8048464: c3 ret
8048465: 66 90 xchg %ax,%ax
8048467: 90 nop
08048468 <sum>:
int global = 8150; int global = 8150;
int sum(int,int); int sum(int,int);
4004fc: 55 push %rbp
4004fd: 48 89 e5 mov %rsp,%rbp
400500: 48 83 ec 10 sub $0x10,%rsp
400504: 89 7d f8 mov %edi,-0x8(%rbp)
400507: 89 75 f4 mov %esi,-0xc(%rbp)
int sum(int a, int b){ int sum(int a, int b){
8048468: c8 08 00 00 enter $0x8,$0x0 40050a: c7 45 fc c3 01 00 00 movl $0x1c3,-0x4(%rbp)
int result = 451; int result = 451;
804846c: c7 45 fc c3 01 00 00 movl $0x1c3,-0x4(%ebp) 400511: 8b 45 f8 mov -0x8(%rbp),%eax
400514: 03 45 f4 add -0xc(%rbp),%eax
400517: 89 45 fc mov %eax,-0x4(%rbp)
result = a + b; result = a + b;
8048473: 8b 45 08 mov 0x8(%ebp),%eax 40051a: 8b 45 fc mov -0x4(%rbp),%eax
8048476: 03 45 0c add 0xc(%ebp),%eax 40051d: 89 45 f0 mov %eax,-0x10(%rbp)
8048479: 89 45 fc mov %eax,-0x4(%ebp) 400520: eb 00 jmp 400522 <sum+0x26>
return result; return result;
804847c: 8b 45 fc mov -0x4(%ebp),%eax 400522: 8b 45 f0 mov -0x10(%rbp),%eax
804847f: 89 45 f8 mov %eax,-0x8(%ebp) 400525: c9 leaveq
8048482: eb 00 jmp 8048484 <sum+0x1c> 400526: c3 retq
} 400527: 90 nop
8048484: 8b 45 f8 mov -0x8(%ebp),%eax
8048487: c9 leave
8048488: c3 ret
8048489: 8d 76 00 lea 0x0(%esi),%esi
0804848c <main>: 0000000000400528 <main>:
}
int main(int argc, char **argv) int main(int argc, char **argv)
400528: 55 push %rbp
400529: 48 89 e5 mov %rsp,%rbp
40052c: 48 83 ec 30 sub $0x30,%rsp
400530: 89 7d f8 mov %edi,-0x8(%rbp)
400533: 48 89 75 f0 mov %rsi,-0x10(%rbp)
{ {
804848c: c8 08 00 00 enter $0x8,$0x0 400537: c7 45 fc 67 12 00 00 movl $0x1267,-0x4(%rbp)
int local=4711; int local=4711;
8048490: c7 45 fc 67 12 00 00 movl $0x1267,-0x4(%ebp) 40053e: 48 b8 18 06 40 00 00 movabs $0x400618,%rax
400545: 00 00 00
400548: 48 89 45 e8 mov %rax,-0x18(%rbp)
40054c: 8b 45 fc mov -0x4(%rbp),%eax
40054f: 89 45 e4 mov %eax,-0x1c(%rbp)
400552: 8b 55 e4 mov -0x1c(%rbp),%edx
400555: 8b 35 c9 0a 20 00 mov 0x200ac9(%rip),%esi # 601024 <global>
40055b: 48 8b 7d e8 mov -0x18(%rbp),%rdi
40055f: 31 c0 xor %eax,%eax
400561: e8 4a fe ff ff callq 4003b0 <printf@plt>
printf("Hello, world!\nglobal=%d local=%d\n", global, local); printf("Hello, world!\nglobal=%d local=%d\n", global, local);
8048497: ff 75 fc pushl -0x4(%ebp) 400566: 8b 45 fc mov -0x4(%rbp),%eax
804849a: ff 35 1c a0 04 08 pushl 0x804a01c 400569: 89 45 e0 mov %eax,-0x20(%rbp)
80484a0: 68 58 85 04 08 push $0x8048558 40056c: 8b 75 e0 mov -0x20(%rbp),%esi
80484a5: e8 06 fe ff ff call 80482b0 <printf@plt> 40056f: 8b 3d af 0a 20 00 mov 0x200aaf(%rip),%edi # 601024 <global>
80484aa: 83 c4 0c add $0xc,%esp 400575: e8 82 ff ff ff callq 4004fc <sum>
40057a: 89 45 fc mov %eax,-0x4(%rbp)
printf(func1(2));
40057d: 8b 45 fc mov -0x4(%rbp),%eax
400580: 89 45 dc mov %eax,-0x24(%rbp)
400583: eb 00 jmp 400585 <main+0x5d>
local = sum(global, local); local = sum(global, local);
80484ad: ff 75 fc pushl -0x4(%ebp) 400585: 8b 45 dc mov -0x24(%rbp),%eax
80484b0: ff 35 1c a0 04 08 pushl 0x804a01c 400588: c9 leaveq
80484b6: e8 ad ff ff ff call 8048468 <sum> 400589: c3 retq
80484bb: 83 c4 08 add $0x8,%esp 40058a: 66 0f 1f 44 00 00 nopw 0x0(%rax,%rax,1)
80484be: 89 45 fc mov %eax,-0x4(%ebp)
return local;
80484c1: 8b 45 fc mov -0x4(%ebp),%eax
80484c4: 89 45 f8 mov %eax,-0x8(%ebp)
80484c7: eb 00 jmp 80484c9 <main+0x3d>
}
80484c9: 8b 45 f8 mov -0x8(%ebp),%eax
80484cc: c9 leave
80484cd: c3 ret
80484ce: 66 90 xchg %ax,%ax
080484d0 <__libc_csu_init>: 0000000000400590 <__libc_csu_init>:
80484d0: 55 push %ebp 400590: 41 57 push %r15
80484d1: 57 push %edi 400592: 41 56 push %r14
80484d2: 56 push %esi 400594: 41 89 ff mov %edi,%r15d
80484d3: 53 push %ebx 400597: 41 55 push %r13
80484d4: e8 37 fe ff ff call 8048310 <__x86.get_pc_thunk.bx> 400599: 41 54 push %r12
80484d9: 81 c3 27 1b 00 00 add $0x1b27,%ebx 40059b: 4c 8d 25 9e 08 20 00 lea 0x20089e(%rip),%r12 # 600e40 <__CTOR_LIST__>
80484df: 83 ec 0c sub $0xc,%esp 4005a2: 55 push %rbp
80484e2: 8b 6c 24 20 mov 0x20(%esp),%ebp 4005a3: 48 8d 2d 96 08 20 00 lea 0x200896(%rip),%rbp # 600e40 <__CTOR_LIST__>
80484e6: 8d b3 24 ff ff ff lea -0xdc(%ebx),%esi 4005aa: 53 push %rbx
80484ec: e8 87 fd ff ff call 8048278 <_init> 4005ab: 49 89 f6 mov %rsi,%r14
80484f1: 8d 83 24 ff ff ff lea -0xdc(%ebx),%eax 4005ae: 49 89 d5 mov %rdx,%r13
80484f7: 29 c6 sub %eax,%esi 4005b1: 4c 29 e5 sub %r12,%rbp
80484f9: c1 fe 02 sar $0x2,%esi 4005b4: 48 83 ec 08 sub $0x8,%rsp
80484fc: 85 f6 test %esi,%esi 4005b8: 48 c1 fd 03 sar $0x3,%rbp
80484fe: 74 25 je 8048525 <__libc_csu_init+0x55> 4005bc: e8 b7 fd ff ff callq 400378 <_init>
8048500: 31 ff xor %edi,%edi 4005c1: 48 85 ed test %rbp,%rbp
8048502: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 4005c4: 74 20 je 4005e6 <__libc_csu_init+0x56>
8048508: 83 ec 04 sub $0x4,%esp 4005c6: 31 db xor %ebx,%ebx
804850b: ff 74 24 2c pushl 0x2c(%esp) 4005c8: 0f 1f 84 00 00 00 00 nopl 0x0(%rax,%rax,1)
804850f: ff 74 24 2c pushl 0x2c(%esp) 4005cf: 00
8048513: 55 push %ebp 4005d0: 4c 89 ea mov %r13,%rdx
8048514: ff 94 bb 24 ff ff ff call *-0xdc(%ebx,%edi,4) 4005d3: 4c 89 f6 mov %r14,%rsi
804851b: 83 c7 01 add $0x1,%edi 4005d6: 44 89 ff mov %r15d,%edi
804851e: 83 c4 10 add $0x10,%esp 4005d9: 41 ff 14 dc callq *(%r12,%rbx,8)
8048521: 39 f7 cmp %esi,%edi 4005dd: 48 83 c3 01 add $0x1,%rbx
8048523: 75 e3 jne 8048508 <__libc_csu_init+0x38> 4005e1: 48 39 dd cmp %rbx,%rbp
8048525: 83 c4 0c add $0xc,%esp 4005e4: 75 ea jne 4005d0 <__libc_csu_init+0x40>
8048528: 5b pop %ebx 4005e6: 48 83 c4 08 add $0x8,%rsp
8048529: 5e pop %esi 4005ea: 5b pop %rbx
804852a: 5f pop %edi 4005eb: 5d pop %rbp
804852b: 5d pop %ebp 4005ec: 41 5c pop %r12
804852c: c3 ret 4005ee: 41 5d pop %r13
804852d: 8d 76 00 lea 0x0(%esi),%esi 4005f0: 41 5e pop %r14
4005f2: 41 5f pop %r15
4005f4: c3 retq
4005f5: 90 nop
4005f6: 66 2e 0f 1f 84 00 00 nopw %cs:0x0(%rax,%rax,1)
4005fd: 00 00 00
08048530 <__libc_csu_fini>: 0000000000400600 <__libc_csu_fini>:
8048530: f3 c3 repz ret 400600: f3 c3 repz retq
Disassembly of section .fini: Disassembly of section .fini:
08048534 <_fini>: 0000000000400604 <_fini>:
8048534: 53 push %ebx 400604: 48 83 ec 08 sub $0x8,%rsp
8048535: 83 ec 08 sub $0x8,%esp 400608: e8 73 fe ff ff callq 400480 <__do_global_dtors_aux>
8048538: e8 d3 fd ff ff call 8048310 <__x86.get_pc_thunk.bx> 40060d: 48 83 c4 08 add $0x8,%rsp
804853d: 81 c3 c3 1a 00 00 add $0x1ac3,%ebx 400611: c3 retq
8048543: e8 c8 fe ff ff call 8048410 <__do_global_dtors_aux>
8048548: 83 c4 08 add $0x8,%esp
804854b: 5b pop %ebx
804854c: c3 ret

BIN
01_ENV/test.out Executable file

Binary file not shown.