Guest User

Untitled

a guest
Apr 20th, 2016
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. cat test.cc
  2. ---------
  3. extern int meh(void*);
  4.  
  5. int foo() {
  6. int buf[4] = {0x42, 0x43, 0x44, 0x45};
  7. int x = meh(__builtin_frame_address(0));
  8. int y = meh(buf);
  9. return x + y;
  10. }
  11. ---------
  12.  
  13.  
  14. g++ -c -fPIC -O2 -o test.o test.cc -fomit-frame-pointer
  15. Disassembly of section .text:
  16.  
  17. 0000000000000000 <_Z3foov>:
  18. 0: 55 push %rbp
  19. 1: 48 89 e5 mov %rsp,%rbp
  20. 4: 53 push %rbx
  21. 5: 48 83 ec 18 sub $0x18,%rsp
  22. 9: 0f 28 05 00 00 00 00 movaps 0x0(%rip),%xmm0 # 10 <_Z3foov+0x10>
  23. 10: 0f 29 45 e0 movaps %xmm0,-0x20(%rbp)
  24. 14: 48 89 ef mov %rbp,%rdi
  25. 17: e8 00 00 00 00 callq 1c <_Z3foov+0x1c>
  26. 1c: 89 c3 mov %eax,%ebx
  27. 1e: 48 8d 7d e0 lea -0x20(%rbp),%rdi
  28. 22: e8 00 00 00 00 callq 27 <_Z3foov+0x27>
  29. 27: 01 d8 add %ebx,%eax
  30. 29: 48 83 c4 18 add $0x18,%rsp
  31. 2d: 5b pop %rbx
  32. 2e: 5d pop %rbp
  33. 2f: c3 retq
Advertisement
Add Comment
Please, Sign In to add comment