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