Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ cat test.cc
- extern char* malloc(int);
- char* foo() {
- char* x = (char*) malloc(1024);
- return x + 10;
- }
- -----------------------------------------
- -----------------------------------------
- $ g++ -c -fPIC -O2 -o test.o test.cc
- $ objdump -d test.o
- test.o: file format elf64-x86-64
- Disassembly of section .text:
- 0000000000000000 <_Z3foov>:
- 0: 48 83 ec 08 sub $0x8,%rsp
- 4: bf 00 04 00 00 mov $0x400,%edi
- 9: e8 00 00 00 00 callq e <_Z3foov+0xe>
- e: 48 83 c4 08 add $0x8,%rsp
- 12: 48 83 c0 0a add $0xa,%rax
- 16: c3 retq
- -----------------------------------------
- -----------------------------------------
- $ g++ -c -fPIC -O2 -o test.o test.cc -fno-omit-frame-pointer
- $ objdump -d test.o
- test.o: file format elf64-x86-64
- Disassembly of section .text:
- 0000000000000000 <_Z3foov>:
- 0: 55 push %rbp
- 1: bf 00 04 00 00 mov $0x400,%edi
- 6: 48 89 e5 mov %rsp,%rbp
- 9: e8 00 00 00 00 callq e <_Z3foov+0xe>
- e: 5d pop %rbp
- f: 48
- ---------------------------------------
- -----------------------------------------
- $ aarch64-linux-android-g++ -c -fPIC -O2 -o test.o test.cc
- $ aarch64-linux-android-objdump -d test.o
- test.o: file format elf64-littleaarch64
- Disassembly of section .text:
- 0000000000000000 <_Z3foov>:
- 0: a9bf7bfd stp x29, x30, [sp,#-16]!
- 4: 52808000 mov w0, #0x400 // #1024
- 8: 910003fd mov x29, sp
- c: 94000000 bl 0 <_Z6malloci>
- 10: 91002800 add x0, x0, #0xa
- 14: a8c17bfd ldp x29, x30, [sp],#16
- 18: d65f03c0 ret
- -----------------------------------------
- -----------------------------------------
- $ aarch64-linux-android-g++ -c -fPIC -O2 -o test.o test.cc -fomit-frame-pointer
- $ aarch64-linux-android-objdump -d test.o
- test.o: file format elf64-littleaarch64
- Disassembly of section .text:
- 0000000000000000 <_Z3foov>:
- 0: d10043ff sub sp, sp, #0x10
- 4: 52808000 mov w0, #0x400 // #1024
- 8: f90003fe str x30, [sp]
- c: 94000000 bl 0 <_Z6malloci>
- 10: f94003fe ldr x30, [sp]
- 14: 91002800 add x0, x0, #0xa
- 18: 910043ff add sp, sp, #0x10
- 1c: d65f03c0 ret
Advertisement
Add Comment
Please, Sign In to add comment