Skip to content

Instantly share code, notes, and snippets.

@ssvb
Created December 7, 2012 12:55
Show Gist options
  • Save ssvb/4233089 to your computer and use it in GitHub Desktop.
Save ssvb/4233089 to your computer and use it in GitHub Desktop.
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc-4.7.2
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/4.7.2/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /var/tmp/portage/sys-devel/gcc-4.7.2/work/gcc-4.7.2/configure --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.7.2 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.2/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.7.2 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.7.2/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.7.2/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.2/include/g++-v4 --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec --disable-fixed-point --without-ppl --without-cloog --enable-lto --enable-nls --without-included-gettext --with-system-zlib --enable-obsolete --disable-werror --enable-secureplt --enable-multilib --with-multilib-list=m32,m64 --enable-libmudflap --disable-libssp --enable-libgomp --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/4.7.2/python --enable-checking=release --disable-libgcj --enable-languages=c,c++,objc,fortran --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-targets=all --with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo 4.7.2 p1.1, pie-0.5.5'
Thread model: posix
gcc version 4.7.2 (Gentoo 4.7.2 p1.1, pie-0.5.5)
$ gcc -O2 -c reprod.c
$ objdump -d reprod.o
reprod.o: file format elf64-x86-64
Disassembly of section .text:
0000000000000000 <memset_internal>:
0: 55 push %rbp
1: 48 89 fd mov %rdi,%rbp
4: 53 push %rbx
5: 48 89 f3 mov %rsi,%rbx
8: 48 83 ec 18 sub $0x18,%rsp
c: e8 00 00 00 00 callq 11 <memset_internal+0x11>
11: 66 0f 6e c0 movd %eax,%xmm0
15: 48 83 fb 0f cmp $0xf,%rbx
19: 66 0f 70 c0 51 pshufd $0x51,%xmm0,%xmm0
1e: 66 0f 7f 04 24 movdqa %xmm0,(%rsp)
23: 76 2b jbe 50 <memset_internal+0x50>
25: 48 8d 73 f0 lea -0x10(%rbx),%rsi
29: 48 8b 14 24 mov (%rsp),%rdx
2d: 48 8b 44 24 08 mov 0x8(%rsp),%rax
32: 48 89 ef mov %rbp,%rdi
35: 48 83 e6 f0 and $0xfffffffffffffff0,%rsi
39: 48 8d 4c 35 10 lea 0x10(%rbp,%rsi,1),%rcx
3e: 66 90 xchg %ax,%ax
40: 48 89 17 mov %rdx,(%rdi)
43: 48 89 47 08 mov %rax,0x8(%rdi)
47: 48 83 c7 10 add $0x10,%rdi
4b: 48 39 cf cmp %rcx,%rdi
4e: 75 f0 jne 40 <memset_internal+0x40>
50: 48 83 c4 18 add $0x18,%rsp
54: 5b pop %rbx
55: 5d pop %rbp
56: c3 retq
Disassembly of section .text.startup:
0000000000000000 <main>:
0: 48 83 ec 28 sub $0x28,%rsp
4: be 10 00 00 00 mov $0x10,%esi
9: 48 8d 7c 24 01 lea 0x1(%rsp),%rdi
e: e8 00 00 00 00 callq 13 <main+0x13>
13: 0f b6 54 24 10 movzbl 0x10(%rsp),%edx
18: be 00 00 00 00 mov $0x0,%esi
1d: bf 01 00 00 00 mov $0x1,%edi
22: 31 c0 xor %eax,%eax
24: e8 00 00 00 00 callq 29 <main+0x29>
29: 31 c0 xor %eax,%eax
2b: 48 83 c4 28 add $0x28,%rsp
2f: c3 retq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment