Guest User

Untitled

a guest
Jan 19th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. // tmp.c
  2.  
  3. static inline int foo() {
  4. asm goto ("jmp %l0" : : : : lab);
  5. return 1;
  6. lab:
  7. return 0;
  8. }
  9.  
  10. int bar() {
  11. return foo();
  12. }
  13.  
  14. //
  15. $ gcc -O2 -c tmp.c
  16. $ objdump -d tmp.o
  17.  
  18. tmp.o: file format elf64-x86-64
  19.  
  20.  
  21. Disassembly of section .text:
  22.  
  23. 0000000000000000 <bar>:
  24. 0: eb 0e jmp 10 <bar+0x10>
  25. 2: b8 01 00 00 00 mov $0x1,%eax
  26. 7: c3 retq
  27. 8: 0f 1f 84 00 00 00 00 nopl 0x0(%rax,%rax,1)
  28. f: 00
  29. 10: 31 c0 xor %eax,%eax
  30. 12: c3 retq
  31.  
  32. $ clang -O2 -c -no-integrated-as tmp.c
  33. $ objdump -d tmp.o
  34.  
  35. tmp.o: file format elf64-x86-64
  36.  
  37.  
  38. Disassembly of section .text:
  39.  
  40. 0000000000000000 <bar>:
  41. 0: eb 0e jmp 10 <foo>
  42. 2: 0f 1f 40 00 nopl 0x0(%rax)
  43. 6: 66 2e 0f 1f 84 00 00 nopw %cs:0x0(%rax,%rax,1)
  44. d: 00 00 00
  45.  
  46. 0000000000000010 <foo>:
  47. 10: b8 01 00 00 00 mov $0x1,%eax
  48. 15: eb 02 jmp 19 <foo+0x9>
  49. 17: eb 02 jmp 1b <foo+0xb>
  50. 19: 31 c0 xor %eax,%eax
  51. 1b: c3 retq
Add Comment
Please, Sign In to add comment