diff --git a/01_ENV/build-c.sh b/01_ENV/build-c.sh new file mode 100755 index 0000000..7665a29 --- /dev/null +++ b/01_ENV/build-c.sh @@ -0,0 +1,2 @@ +clang-6.0 -c func1.c main.c +clang-6.0 -o test.out -s func1.o main.o diff --git a/01_ENV/build.sh b/01_ENV/build.sh old mode 100644 new mode 100755 diff --git a/01_ENV/clean.sh b/01_ENV/clean.sh old mode 100644 new mode 100755 diff --git a/01_ENV/func1.c b/01_ENV/func1.c new file mode 100644 index 0000000..89d4cf8 --- /dev/null +++ b/01_ENV/func1.c @@ -0,0 +1,5 @@ +#define func1 + +int func2(int x) { + return x + 10; +} diff --git a/01_ENV/func1.h b/01_ENV/func1.h new file mode 100644 index 0000000..ddc106b --- /dev/null +++ b/01_ENV/func1.h @@ -0,0 +1 @@ +int func2(int x); diff --git a/01_ENV/func1.o b/01_ENV/func1.o new file mode 100644 index 0000000..006a2b9 Binary files /dev/null and b/01_ENV/func1.o differ diff --git a/01_ENV/main.c b/01_ENV/main.c index 285a15f..64a68a7 100644 --- a/01_ENV/main.c +++ b/01_ENV/main.c @@ -1,5 +1,7 @@ #include +#include "func1.h" + int global = 8150; @@ -16,6 +18,7 @@ int main(int argc, char **argv) { int local=4711; printf("Hello, world!\nglobal=%d local=%d\n", global, local); + printf("Hallo Welt %d\n" ,func2(2)); local = sum(global, local); return local; } diff --git a/01_ENV/main.o b/01_ENV/main.o new file mode 100644 index 0000000..f5185f2 Binary files /dev/null and b/01_ENV/main.o differ diff --git a/01_ENV/main.s b/01_ENV/main.s deleted file mode 100644 index f9a1224..0000000 --- a/01_ENV/main.s +++ /dev/null @@ -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" diff --git a/01_ENV/objdump-S_a.out.txt b/01_ENV/objdump-S_a.out.txt index f8aa422..68ae9a0 100644 --- a/01_ENV/objdump-S_a.out.txt +++ b/01_ENV/objdump-S_a.out.txt @@ -1,324 +1,250 @@ -a.out: file format elf32-i386 +a.out: Dateiformat elf64-x86-64 Disassembly of section .init: -08048278 <_init>: - 8048278: 53 push %ebx - 8048279: 83 ec 08 sub $0x8,%esp - 804827c: e8 8f 00 00 00 call 8048310 <__x86.get_pc_thunk.bx> - 8048281: 81 c3 7f 1d 00 00 add $0x1d7f,%ebx - 8048287: 8b 83 fc ff ff ff mov -0x4(%ebx),%eax - 804828d: 85 c0 test %eax,%eax - 804828f: 74 05 je 8048296 <_init+0x1e> - 8048291: e8 2a 00 00 00 call 80482c0 <__gmon_start__@plt> - 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 +0000000000400378 <_init>: + 400378: 48 83 ec 08 sub $0x8,%rsp + 40037c: 48 8b 05 75 0c 20 00 mov 0x200c75(%rip),%rax # 600ff8 <__gmon_start__> + 400383: 48 85 c0 test %rax,%rax + 400386: 74 02 je 40038a <_init+0x12> + 400388: ff d0 callq *%rax + 40038a: e8 61 00 00 00 callq 4003f0 <__do_global_ctors_aux> + 40038f: 48 83 c4 08 add $0x8,%rsp + 400393: c3 retq Disassembly of section .plt: -080482a0 : - 80482a0: ff 35 04 a0 04 08 pushl 0x804a004 - 80482a6: ff 25 08 a0 04 08 jmp *0x804a008 - 80482ac: 00 00 add %al,(%eax) - ... +00000000004003a0 <.plt>: + 4003a0: ff 35 62 0c 20 00 pushq 0x200c62(%rip) # 601008 <_GLOBAL_OFFSET_TABLE_+0x8> + 4003a6: ff 25 64 0c 20 00 jmpq *0x200c64(%rip) # 601010 <_GLOBAL_OFFSET_TABLE_+0x10> + 4003ac: 0f 1f 40 00 nopl 0x0(%rax) -080482b0 : - 80482b0: ff 25 0c a0 04 08 jmp *0x804a00c - 80482b6: 68 00 00 00 00 push $0x0 - 80482bb: e9 e0 ff ff ff jmp 80482a0 <_init+0x28> - -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> +00000000004003b0 : + 4003b0: ff 25 62 0c 20 00 jmpq *0x200c62(%rip) # 601018 + 4003b6: 68 00 00 00 00 pushq $0x0 + 4003bb: e9 e0 ff ff ff jmpq 4003a0 <.plt> Disassembly of section .text: -080482e0 <_start>: - 80482e0: 31 ed xor %ebp,%ebp - 80482e2: 5e pop %esi - 80482e3: 89 e1 mov %esp,%ecx - 80482e5: 83 e4 f0 and $0xfffffff0,%esp - 80482e8: 50 push %eax - 80482e9: 54 push %esp - 80482ea: 52 push %edx - 80482eb: 68 30 85 04 08 push $0x8048530 - 80482f0: 68 d0 84 04 08 push $0x80484d0 - 80482f5: 51 push %ecx - 80482f6: 56 push %esi - 80482f7: 68 8c 84 04 08 push $0x804848c - 80482fc: e8 cf ff ff ff call 80482d0 <__libc_start_main@plt> - 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 +00000000004003c0 <_start>: + 4003c0: 31 ed xor %ebp,%ebp + 4003c2: 49 89 d1 mov %rdx,%r9 + 4003c5: 5e pop %rsi + 4003c6: 48 89 e2 mov %rsp,%rdx + 4003c9: 48 83 e4 f0 and $0xfffffffffffffff0,%rsp + 4003cd: 50 push %rax + 4003ce: 54 push %rsp + 4003cf: 49 c7 c0 00 06 40 00 mov $0x400600,%r8 + 4003d6: 48 c7 c1 90 05 40 00 mov $0x400590,%rcx + 4003dd: 48 c7 c7 28 05 40 00 mov $0x400528,%rdi + 4003e4: ff 15 06 0c 20 00 callq *0x200c06(%rip) # 600ff0 <__libc_start_main@GLIBC_2.2.5> + 4003ea: f4 hlt + 4003eb: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1) -08048310 <__x86.get_pc_thunk.bx>: - 8048310: 8b 1c 24 mov (%esp),%ebx - 8048313: c3 ret - 8048314: 66 90 xchg %ax,%ax - 8048316: 66 90 xchg %ax,%ax - 8048318: 66 90 xchg %ax,%ax - 804831a: 66 90 xchg %ax,%ax - 804831c: 66 90 xchg %ax,%ax - 804831e: 66 90 xchg %ax,%ax +00000000004003f0 <__do_global_ctors_aux>: + 4003f0: 8b 05 36 0c 20 00 mov 0x200c36(%rip),%eax # 60102c + 4003f6: 85 c0 test %eax,%eax + 4003f8: 74 06 je 400400 <__do_global_ctors_aux+0x10> + 4003fa: f3 c3 repz retq + 4003fc: 0f 1f 40 00 nopl 0x0(%rax) + 400400: 55 push %rbp + 400401: 53 push %rbx + 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 + 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>: - 8048320: e8 34 01 00 00 call 8048459 <__x86.get_pc_thunk.ax> - 8048325: 05 db 1c 00 00 add $0x1cdb,%eax - 804832a: 56 push %esi - 804832b: 53 push %ebx - 804832c: 8d 64 24 fc lea -0x4(%esp),%esp - 8048330: 8d 88 24 ff ff ff lea -0xdc(%eax),%ecx - 8048336: 8b 11 mov (%ecx),%edx - 8048338: 83 fa ff cmp $0xffffffff,%edx - 804833b: 74 2b je 8048368 <__ctors+0x48> - 804833d: 8d 5a ff lea -0x1(%edx),%ebx - 8048340: 8d 34 91 lea (%ecx,%edx,4),%esi - 8048343: 8d 04 9d 00 00 00 00 lea 0x0(,%ebx,4),%eax - 804834a: 29 c6 sub %eax,%esi - 804834c: 85 d2 test %edx,%edx - 804834e: 74 0a je 804835a <__ctors+0x3a> - 8048350: ff 14 9e call *(%esi,%ebx,4) - 8048353: 85 db test %ebx,%ebx - 8048355: 8d 5b ff lea -0x1(%ebx),%ebx - 8048358: 75 f6 jne 8048350 <__ctors+0x30> - 804835a: 8d 64 24 04 lea 0x4(%esp),%esp - 804835e: 5b pop %ebx - 804835f: 5e pop %esi - 8048360: c3 ret - 8048361: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi - 8048368: 8b 71 04 mov 0x4(%ecx),%esi - 804836b: 85 f6 test %esi,%esi - 804836d: 74 eb je 804835a <__ctors+0x3a> - 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 +0000000000400480 <__do_global_dtors_aux>: + 400480: 8b 05 a2 0b 20 00 mov 0x200ba2(%rip),%eax # 601028 <_edata> + 400486: 85 c0 test %eax,%eax + 400488: 75 46 jne 4004d0 <__do_global_dtors_aux+0x50> + 40048a: 48 8b 05 c7 09 20 00 mov 0x2009c7(%rip),%rax # 600e58 <__DTOR_LIST__+0x8> + 400491: 48 85 c0 test %rax,%rax + 400494: 74 2a je 4004c0 <__do_global_dtors_aux+0x40> + 400496: 53 push %rbx + 400497: 48 8d 1d ba 09 20 00 lea 0x2009ba(%rip),%rbx # 600e58 <__DTOR_LIST__+0x8> + 40049e: 66 90 xchg %ax,%ax + 4004a0: 48 83 c3 08 add $0x8,%rbx + 4004a4: ff d0 callq *%rax + 4004a6: 48 8b 03 mov (%rbx),%rax + 4004a9: 48 85 c0 test %rax,%rax + 4004ac: 75 f2 jne 4004a0 <__do_global_dtors_aux+0x20> + 4004ae: c7 05 70 0b 20 00 01 movl $0x1,0x200b70(%rip) # 601028 <_edata> + 4004b5: 00 00 00 + 4004b8: 5b pop %rbx + 4004b9: c3 retq + 4004ba: 66 0f 1f 44 00 00 nopw 0x0(%rax,%rax,1) + 4004c0: c7 05 5e 0b 20 00 01 movl $0x1,0x200b5e(%rip) # 601028 <_edata> + 4004c7: 00 00 00 + 4004ca: c3 retq + 4004cb: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1) + 4004d0: f3 c3 repz retq + 4004d2: 0f 1f 40 00 nopl 0x0(%rax) + 4004d6: 66 2e 0f 1f 84 00 00 nopw %cs:0x0(%rax,%rax,1) + 4004dd: 00 00 00 -08048390 <__dtors>: - 8048390: e8 c4 00 00 00 call 8048459 <__x86.get_pc_thunk.ax> - 8048395: 05 6b 1c 00 00 add $0x1c6b,%eax - 804839a: 53 push %ebx - 804839b: 8d 64 24 f8 lea -0x8(%esp),%esp - 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 +00000000004004e0 <__call___do_global_ctors_aux>: + 4004e0: 48 83 ec 08 sub $0x8,%rsp + 4004e4: 48 83 c4 08 add $0x8,%rsp + 4004e8: c3 retq + 4004e9: 0f 1f 80 00 00 00 00 nopl 0x0(%rax) -080483e0 <__do_global_ctors_aux>: - 80483e0: e8 74 00 00 00 call 8048459 <__x86.get_pc_thunk.ax> - 80483e5: 05 1b 1c 00 00 add $0x1c1b,%eax - 80483ea: 8b 90 24 00 00 00 mov 0x24(%eax),%edx - 80483f0: 85 d2 test %edx,%edx - 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 +00000000004004f0 <__call___do_global_dtors_aux>: + 4004f0: 48 83 ec 08 sub $0x8,%rsp + 4004f4: 48 83 c4 08 add $0x8,%rsp + 4004f8: c3 retq + 4004f9: 0f 1f 00 nopl (%rax) -08048410 <__do_global_dtors_aux>: - 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 +00000000004004fc : -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 : int global = 8150; 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){ - 8048468: c8 08 00 00 enter $0x8,$0x0 + 40050a: c7 45 fc c3 01 00 00 movl $0x1c3,-0x4(%rbp) 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; - 8048473: 8b 45 08 mov 0x8(%ebp),%eax - 8048476: 03 45 0c add 0xc(%ebp),%eax - 8048479: 89 45 fc mov %eax,-0x4(%ebp) + 40051a: 8b 45 fc mov -0x4(%rbp),%eax + 40051d: 89 45 f0 mov %eax,-0x10(%rbp) + 400520: eb 00 jmp 400522 return result; - 804847c: 8b 45 fc mov -0x4(%ebp),%eax - 804847f: 89 45 f8 mov %eax,-0x8(%ebp) - 8048482: eb 00 jmp 8048484 -} - 8048484: 8b 45 f8 mov -0x8(%ebp),%eax - 8048487: c9 leave - 8048488: c3 ret - 8048489: 8d 76 00 lea 0x0(%esi),%esi + 400522: 8b 45 f0 mov -0x10(%rbp),%eax + 400525: c9 leaveq + 400526: c3 retq + 400527: 90 nop -0804848c
: +0000000000400528
: +} 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; - 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 + 40055b: 48 8b 7d e8 mov -0x18(%rbp),%rdi + 40055f: 31 c0 xor %eax,%eax + 400561: e8 4a fe ff ff callq 4003b0 printf("Hello, world!\nglobal=%d local=%d\n", global, local); - 8048497: ff 75 fc pushl -0x4(%ebp) - 804849a: ff 35 1c a0 04 08 pushl 0x804a01c - 80484a0: 68 58 85 04 08 push $0x8048558 - 80484a5: e8 06 fe ff ff call 80482b0 - 80484aa: 83 c4 0c add $0xc,%esp + 400566: 8b 45 fc mov -0x4(%rbp),%eax + 400569: 89 45 e0 mov %eax,-0x20(%rbp) + 40056c: 8b 75 e0 mov -0x20(%rbp),%esi + 40056f: 8b 3d af 0a 20 00 mov 0x200aaf(%rip),%edi # 601024 + 400575: e8 82 ff ff ff callq 4004fc + 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 local = sum(global, local); - 80484ad: ff 75 fc pushl -0x4(%ebp) - 80484b0: ff 35 1c a0 04 08 pushl 0x804a01c - 80484b6: e8 ad ff ff ff call 8048468 - 80484bb: 83 c4 08 add $0x8,%esp - 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 -} - 80484c9: 8b 45 f8 mov -0x8(%ebp),%eax - 80484cc: c9 leave - 80484cd: c3 ret - 80484ce: 66 90 xchg %ax,%ax + 400585: 8b 45 dc mov -0x24(%rbp),%eax + 400588: c9 leaveq + 400589: c3 retq + 40058a: 66 0f 1f 44 00 00 nopw 0x0(%rax,%rax,1) -080484d0 <__libc_csu_init>: - 80484d0: 55 push %ebp - 80484d1: 57 push %edi - 80484d2: 56 push %esi - 80484d3: 53 push %ebx - 80484d4: e8 37 fe ff ff call 8048310 <__x86.get_pc_thunk.bx> - 80484d9: 81 c3 27 1b 00 00 add $0x1b27,%ebx - 80484df: 83 ec 0c sub $0xc,%esp - 80484e2: 8b 6c 24 20 mov 0x20(%esp),%ebp - 80484e6: 8d b3 24 ff ff ff lea -0xdc(%ebx),%esi - 80484ec: e8 87 fd ff ff call 8048278 <_init> - 80484f1: 8d 83 24 ff ff ff lea -0xdc(%ebx),%eax - 80484f7: 29 c6 sub %eax,%esi - 80484f9: c1 fe 02 sar $0x2,%esi - 80484fc: 85 f6 test %esi,%esi - 80484fe: 74 25 je 8048525 <__libc_csu_init+0x55> - 8048500: 31 ff xor %edi,%edi - 8048502: 8d b6 00 00 00 00 lea 0x0(%esi),%esi - 8048508: 83 ec 04 sub $0x4,%esp - 804850b: ff 74 24 2c pushl 0x2c(%esp) - 804850f: ff 74 24 2c pushl 0x2c(%esp) - 8048513: 55 push %ebp - 8048514: ff 94 bb 24 ff ff ff call *-0xdc(%ebx,%edi,4) - 804851b: 83 c7 01 add $0x1,%edi - 804851e: 83 c4 10 add $0x10,%esp - 8048521: 39 f7 cmp %esi,%edi - 8048523: 75 e3 jne 8048508 <__libc_csu_init+0x38> - 8048525: 83 c4 0c add $0xc,%esp - 8048528: 5b pop %ebx - 8048529: 5e pop %esi - 804852a: 5f pop %edi - 804852b: 5d pop %ebp - 804852c: c3 ret - 804852d: 8d 76 00 lea 0x0(%esi),%esi +0000000000400590 <__libc_csu_init>: + 400590: 41 57 push %r15 + 400592: 41 56 push %r14 + 400594: 41 89 ff mov %edi,%r15d + 400597: 41 55 push %r13 + 400599: 41 54 push %r12 + 40059b: 4c 8d 25 9e 08 20 00 lea 0x20089e(%rip),%r12 # 600e40 <__CTOR_LIST__> + 4005a2: 55 push %rbp + 4005a3: 48 8d 2d 96 08 20 00 lea 0x200896(%rip),%rbp # 600e40 <__CTOR_LIST__> + 4005aa: 53 push %rbx + 4005ab: 49 89 f6 mov %rsi,%r14 + 4005ae: 49 89 d5 mov %rdx,%r13 + 4005b1: 4c 29 e5 sub %r12,%rbp + 4005b4: 48 83 ec 08 sub $0x8,%rsp + 4005b8: 48 c1 fd 03 sar $0x3,%rbp + 4005bc: e8 b7 fd ff ff callq 400378 <_init> + 4005c1: 48 85 ed test %rbp,%rbp + 4005c4: 74 20 je 4005e6 <__libc_csu_init+0x56> + 4005c6: 31 db xor %ebx,%ebx + 4005c8: 0f 1f 84 00 00 00 00 nopl 0x0(%rax,%rax,1) + 4005cf: 00 + 4005d0: 4c 89 ea mov %r13,%rdx + 4005d3: 4c 89 f6 mov %r14,%rsi + 4005d6: 44 89 ff mov %r15d,%edi + 4005d9: 41 ff 14 dc callq *(%r12,%rbx,8) + 4005dd: 48 83 c3 01 add $0x1,%rbx + 4005e1: 48 39 dd cmp %rbx,%rbp + 4005e4: 75 ea jne 4005d0 <__libc_csu_init+0x40> + 4005e6: 48 83 c4 08 add $0x8,%rsp + 4005ea: 5b pop %rbx + 4005eb: 5d pop %rbp + 4005ec: 41 5c pop %r12 + 4005ee: 41 5d pop %r13 + 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>: - 8048530: f3 c3 repz ret +0000000000400600 <__libc_csu_fini>: + 400600: f3 c3 repz retq Disassembly of section .fini: -08048534 <_fini>: - 8048534: 53 push %ebx - 8048535: 83 ec 08 sub $0x8,%esp - 8048538: e8 d3 fd ff ff call 8048310 <__x86.get_pc_thunk.bx> - 804853d: 81 c3 c3 1a 00 00 add $0x1ac3,%ebx - 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 +0000000000400604 <_fini>: + 400604: 48 83 ec 08 sub $0x8,%rsp + 400608: e8 73 fe ff ff callq 400480 <__do_global_dtors_aux> + 40060d: 48 83 c4 08 add $0x8,%rsp + 400611: c3 retq diff --git a/01_ENV/test.out b/01_ENV/test.out new file mode 100755 index 0000000..da4d0d1 Binary files /dev/null and b/01_ENV/test.out differ