Skip to content

Instantly share code, notes, and snippets.

@Estefycp
Created February 3, 2019 18:29
Show Gist options
  • Save Estefycp/476780d1b540cb8de730faa49ca965d4 to your computer and use it in GitHub Desktop.
Save Estefycp/476780d1b540cb8de730faa49ca965d4 to your computer and use it in GitHub Desktop.
Loga00344189lab1
estefycp@DESKTOP-6Q3FMOM:/mnt/c/Users/Estefycp/Documents/Compiladores/compilers-lecture/labs/01$ objdump -d ./simple_foo
./simple_foo: file format elf64-x86-64
Disassembly of section .init:
0000000000000528 <_init>:
528: 48 83 ec 08 sub $0x8,%rsp
52c: 48 8b 05 b5 0a 20 00 mov 0x200ab5(%rip),%rax # 200fe8 <__gmon_start__>
533: 48 85 c0 test %rax,%rax
536: 74 02 je 53a <_init+0x12>
538: ff d0 callq *%rax
53a: 48 83 c4 08 add $0x8,%rsp
53e: c3 retq
Disassembly of section .plt:
0000000000000540 <.plt>:
540: ff 35 72 0a 20 00 pushq 0x200a72(%rip) # 200fb8 <_GLOBAL_OFFSET_TABLE_+0x8>
546: ff 25 74 0a 20 00 jmpq *0x200a74(%rip) # 200fc0 <_GLOBAL_OFFSET_TABLE_+0x10>
54c: 0f 1f 40 00 nopl 0x0(%rax)
0000000000000550 <puts@plt>:
550: ff 25 72 0a 20 00 jmpq *0x200a72(%rip) # 200fc8 <puts@GLIBC_2.2.5>
556: 68 00 00 00 00 pushq $0x0
55b: e9 e0 ff ff ff jmpq 540 <.plt>
0000000000000560 <printf@plt>:
560: ff 25 6a 0a 20 00 jmpq *0x200a6a(%rip) # 200fd0 <printf@GLIBC_2.2.5>
566: 68 01 00 00 00 pushq $0x1
56b: e9 d0 ff ff ff jmpq 540 <.plt>
Disassembly of section .plt.got:
0000000000000570 <__cxa_finalize@plt>:
570: ff 25 82 0a 20 00 jmpq *0x200a82(%rip) # 200ff8 <__cxa_finalize@GLIBC_2.2.5>
576: 66 90 xchg %ax,%ax
Disassembly of section .text:
0000000000000580 <_start>:
580: 31 ed xor %ebp,%ebp
582: 49 89 d1 mov %rdx,%r9
585: 5e pop %rsi
586: 48 89 e2 mov %rsp,%rdx
589: 48 83 e4 f0 and $0xfffffffffffffff0,%rsp
58d: 50 push %rax
58e: 54 push %rsp
58f: 4c 8d 05 ea 01 00 00 lea 0x1ea(%rip),%r8 # 780 <__libc_csu_fini>
596: 48 8d 0d 73 01 00 00 lea 0x173(%rip),%rcx # 710 <__libc_csu_init>
59d: 48 8d 3d 2a 01 00 00 lea 0x12a(%rip),%rdi # 6ce <main>
5a4: ff 15 36 0a 20 00 callq *0x200a36(%rip) # 200fe0 <__libc_start_main@GLIBC_2.2.5>
5aa: f4 hlt
5ab: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1)
00000000000005b0 <deregister_tm_clones>:
5b0: 48 8d 3d 59 0a 20 00 lea 0x200a59(%rip),%rdi # 201010 <__TMC_END__>
5b7: 55 push %rbp
5b8: 48 8d 05 51 0a 20 00 lea 0x200a51(%rip),%rax # 201010 <__TMC_END__>
5bf: 48 39 f8 cmp %rdi,%rax
5c2: 48 89 e5 mov %rsp,%rbp
5c5: 74 19 je 5e0 <deregister_tm_clones+0x30>
5c7: 48 8b 05 0a 0a 20 00 mov 0x200a0a(%rip),%rax # 200fd8 <_ITM_deregisterTMCloneTable>
5ce: 48 85 c0 test %rax,%rax
5d1: 74 0d je 5e0 <deregister_tm_clones+0x30>
5d3: 5d pop %rbp
5d4: ff e0 jmpq *%rax
5d6: 66 2e 0f 1f 84 00 00 nopw %cs:0x0(%rax,%rax,1)
5dd: 00 00 00
5e0: 5d pop %rbp
5e1: c3 retq
5e2: 0f 1f 40 00 nopl 0x0(%rax)
5e6: 66 2e 0f 1f 84 00 00 nopw %cs:0x0(%rax,%rax,1)
5ed: 00 00 00
00000000000005f0 <register_tm_clones>:
5f0: 48 8d 3d 19 0a 20 00 lea 0x200a19(%rip),%rdi # 201010 <__TMC_END__>
5f7: 48 8d 35 12 0a 20 00 lea 0x200a12(%rip),%rsi # 201010 <__TMC_END__>
5fe: 55 push %rbp
5ff: 48 29 fe sub %rdi,%rsi
602: 48 89 e5 mov %rsp,%rbp
605: 48 c1 fe 03 sar $0x3,%rsi
609: 48 89 f0 mov %rsi,%rax
60c: 48 c1 e8 3f shr $0x3f,%rax
610: 48 01 c6 add %rax,%rsi
613: 48 d1 fe sar %rsi
616: 74 18 je 630 <register_tm_clones+0x40>
618: 48 8b 05 d1 09 20 00 mov 0x2009d1(%rip),%rax # 200ff0 <_ITM_registerTMCloneTable>
61f: 48 85 c0 test %rax,%rax
622: 74 0c je 630 <register_tm_clones+0x40>
624: 5d pop %rbp
625: ff e0 jmpq *%rax
627: 66 0f 1f 84 00 00 00 nopw 0x0(%rax,%rax,1)
62e: 00 00
630: 5d pop %rbp
631: c3 retq
632: 0f 1f 40 00 nopl 0x0(%rax)
636: 66 2e 0f 1f 84 00 00 nopw %cs:0x0(%rax,%rax,1)
63d: 00 00 00
0000000000000640 <__do_global_dtors_aux>:
640: 80 3d c9 09 20 00 00 cmpb $0x0,0x2009c9(%rip) # 201010 <__TMC_END__>
647: 75 2f jne 678 <__do_global_dtors_aux+0x38>
649: 48 83 3d a7 09 20 00 cmpq $0x0,0x2009a7(%rip) # 200ff8 <__cxa_finalize@GLIBC_2.2.5>
650: 00
651: 55 push %rbp
652: 48 89 e5 mov %rsp,%rbp
655: 74 0c je 663 <__do_global_dtors_aux+0x23>
657: 48 8b 3d aa 09 20 00 mov 0x2009aa(%rip),%rdi # 201008 <__dso_handle>
65e: e8 0d ff ff ff callq 570 <__cxa_finalize@plt>
663: e8 48 ff ff ff callq 5b0 <deregister_tm_clones>
668: c6 05 a1 09 20 00 01 movb $0x1,0x2009a1(%rip) # 201010 <__TMC_END__>
66f: 5d pop %rbp
670: c3 retq
671: 0f 1f 80 00 00 00 00 nopl 0x0(%rax)
678: f3 c3 repz retq
67a: 66 0f 1f 44 00 00 nopw 0x0(%rax,%rax,1)
0000000000000680 <frame_dummy>:
680: 55 push %rbp
681: 48 89 e5 mov %rsp,%rbp
684: 5d pop %rbp
685: e9 66 ff ff ff jmpq 5f0 <register_tm_clones>
000000000000068a <foo>:
68a: 55 push %rbp
68b: 48 89 e5 mov %rsp,%rbp
68e: f3 0f 10 05 0e 01 00 movss 0x10e(%rip),%xmm0 # 7a4 <_IO_stdin_used+0x14>
695: 00
696: f3 0f 11 45 f4 movss %xmm0,-0xc(%rbp)
69b: f3 0f 10 05 01 01 00 movss 0x101(%rip),%xmm0 # 7a4 <_IO_stdin_used+0x14>
6a2: 00
6a3: f3 0f 11 45 f8 movss %xmm0,-0x8(%rbp)
6a8: f3 0f 10 4d f4 movss -0xc(%rbp),%xmm1
6ad: f3 0f 10 05 f3 00 00 movss 0xf3(%rip),%xmm0 # 7a8 <_IO_stdin_used+0x18>
6b4: 00
6b5: f3 0f 59 c1 mulss %xmm1,%xmm0
6b9: f3 0f 10 4d f8 movss -0x8(%rbp),%xmm1
6be: f3 0f 58 c1 addss %xmm1,%xmm0
6c2: f3 0f 11 45 fc movss %xmm0,-0x4(%rbp)
6c7: f3 0f 10 45 fc movss -0x4(%rbp),%xmm0
6cc: 5d pop %rbp
6cd: c3 retq
00000000000006ce <main>:
6ce: 55 push %rbp
6cf: 48 89 e5 mov %rsp,%rbp
6d2: 48 83 ec 10 sub $0x10,%rsp
6d6: 48 8d 3d b7 00 00 00 lea 0xb7(%rip),%rdi # 794 <_IO_stdin_used+0x4>
6dd: e8 6e fe ff ff callq 550 <puts@plt>
6e2: b8 00 00 00 00 mov $0x0,%eax
6e7: e8 9e ff ff ff callq 68a <foo>
6ec: 66 0f 7e c0 movd %xmm0,%eax
6f0: 89 45 fc mov %eax,-0x4(%rbp)
6f3: f3 0f 5a 45 fc cvtss2sd -0x4(%rbp),%xmm0
6f8: 48 8d 3d a1 00 00 00 lea 0xa1(%rip),%rdi # 7a0 <_IO_stdin_used+0x10>
6ff: b8 01 00 00 00 mov $0x1,%eax
704: e8 57 fe ff ff callq 560 <printf@plt>
709: b8 00 00 00 00 mov $0x0,%eax
70e: c9 leaveq
70f: c3 retq
0000000000000710 <__libc_csu_init>:
710: 41 57 push %r15
712: 41 56 push %r14
714: 49 89 d7 mov %rdx,%r15
717: 41 55 push %r13
719: 41 54 push %r12
71b: 4c 8d 25 8e 06 20 00 lea 0x20068e(%rip),%r12 # 200db0 <__frame_dummy_init_array_entry>
722: 55 push %rbp
723: 48 8d 2d 8e 06 20 00 lea 0x20068e(%rip),%rbp # 200db8 <__init_array_end>
72a: 53 push %rbx
72b: 41 89 fd mov %edi,%r13d
72e: 49 89 f6 mov %rsi,%r14
731: 4c 29 e5 sub %r12,%rbp
734: 48 83 ec 08 sub $0x8,%rsp
738: 48 c1 fd 03 sar $0x3,%rbp
73c: e8 e7 fd ff ff callq 528 <_init>
741: 48 85 ed test %rbp,%rbp
744: 74 20 je 766 <__libc_csu_init+0x56>
746: 31 db xor %ebx,%ebx
748: 0f 1f 84 00 00 00 00 nopl 0x0(%rax,%rax,1)
74f: 00
750: 4c 89 fa mov %r15,%rdx
753: 4c 89 f6 mov %r14,%rsi
756: 44 89 ef mov %r13d,%edi
759: 41 ff 14 dc callq *(%r12,%rbx,8)
75d: 48 83 c3 01 add $0x1,%rbx
761: 48 39 dd cmp %rbx,%rbp
764: 75 ea jne 750 <__libc_csu_init+0x40>
766: 48 83 c4 08 add $0x8,%rsp
76a: 5b pop %rbx
76b: 5d pop %rbp
76c: 41 5c pop %r12
76e: 41 5d pop %r13
770: 41 5e pop %r14
772: 41 5f pop %r15
774: c3 retq
775: 90 nop
776: 66 2e 0f 1f 84 00 00 nopw %cs:0x0(%rax,%rax,1)
77d: 00 00 00
0000000000000780 <__libc_csu_fini>:
780: f3 c3 repz retq
Disassembly of section .fini:
0000000000000784 <_fini>:
784: 48 83 ec 08 sub $0x8,%rsp
788: 48 83 c4 08 add $0x8,%rsp
78c: c3 retq
estefycp@DESKTOP-6Q3FMOM:/mnt/c/Users/Estefycp/Documents/Compiladores/compilers-lecture/labs/01$ bash asm-analytics.sh
Hi, this is the output of the analyisis:
You have 32 kind of instructions in this object file:
You have executed 23 mov instructions
You have executed 14 push instructions
You have executed 14 pop instructions
You have executed 11 lea instructions
You have executed 9 movss instructions
You have executed 9 jmpq instructions
You have executed 9 callq instructions
You have executed 8 retq instructions
You have executed 7 je instructions
You have executed 6 sub instructions
You have executed 6 nopw instructions
You have executed 6 nopl instructions
You have executed 5 add instructions
You have executed 4 test instructions
You have executed 3 sar instructions
You have executed 3 pushq instructions
You have executed 2 xor instructions
You have executed 2 repz instructions
You have executed 2 jne instructions
You have executed 2 cmp instructions
You have executed 1 xchg instructions
You have executed 1 shr instructions
You have executed 1 mulss instructions
You have executed 1 movd instructions
You have executed 1 movb instructions
You have executed 1 leaveq instructions
You have executed 1 hlt instructions
You have executed 1 cvtss2sd instructions
You have executed 1 cmpq instructions
You have executed 1 cmpb instructions
You have executed 1 and instructions
You have executed 1 addss instructions
You have 2 functions:
foo Located at 000000000000068a
main Located at 00000000000006ce
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment