Created
January 18, 2019 21:29
-
-
Save nickdesaulniers/a69b44159f4d42a34fc1b5d18cb7b608 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// tmp.c | |
static inline int foo() { | |
asm goto ("jmp %l0" : : : : lab); | |
return 1; | |
lab: | |
return 0; | |
} | |
int bar() { | |
return foo(); | |
} | |
// | |
$ gcc -O2 -c tmp.c | |
$ objdump -d tmp.o | |
tmp.o: file format elf64-x86-64 | |
Disassembly of section .text: | |
0000000000000000 <bar>: | |
0: eb 0e jmp 10 <bar+0x10> | |
2: b8 01 00 00 00 mov $0x1,%eax | |
7: c3 retq | |
8: 0f 1f 84 00 00 00 00 nopl 0x0(%rax,%rax,1) | |
f: 00 | |
10: 31 c0 xor %eax,%eax | |
12: c3 retq | |
$ clang -O2 -c -no-integrated-as tmp.c | |
$ objdump -d tmp.o | |
tmp.o: file format elf64-x86-64 | |
Disassembly of section .text: | |
0000000000000000 <bar>: | |
0: eb 0e jmp 10 <foo> | |
2: 0f 1f 40 00 nopl 0x0(%rax) | |
6: 66 2e 0f 1f 84 00 00 nopw %cs:0x0(%rax,%rax,1) | |
d: 00 00 00 | |
0000000000000010 <foo>: | |
10: b8 01 00 00 00 mov $0x1,%eax | |
15: eb 02 jmp 19 <foo+0x9> | |
17: eb 02 jmp 1b <foo+0xb> | |
19: 31 c0 xor %eax,%eax | |
1b: c3 retq |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment