I have this assembly code:
jit_out.s
movq $0x1, %rax
jmp f1
movq $0xf000000101db3fb1, %rsi
push %rsi
movq $0x101db3ed8, %rax
addq $8, %rsp
ret
f1:
movq $0x101db3fb0, %rax
movq $0x1, %rax
ret
Running as -v < /dev/null
gives:
Apple Inc version cctools-862, GNU assembler version 1.38
Running as jit_out.s -o jit_out.o
and objdump -D jit_out.o
returns:
jit_out.o: file format mach-o-x86-64
Disassembly of section .text:
0000000000000000 <f1-0x26>:
0: 48 c7 c0 01 00 00 00 mov $0x1,%rax
7: e9 00 00 00 00 jmpq c <f1-0x1a>
c: 48 be b1 3f db 01 01 movabs $0xf000000101db3fb1,%rsi
13: 00 00 f0
16: 56 push %rsi
17: 48 b8 d8 3e db 01 01 movabs $0x101db3ed8,%rax
1e: 00 00 00
21: 48 83 c4 08 add $0x8,%rsp
25: c3 retq
0000000000000026 <f1>:
26: 48 b8 b0 3f db 01 01 movabs $0x101db3fb0,%rax
2d: 00 00 00
30: 48 c7 c0 01 00 00 00 mov $0x1,%rax
37: c3 retq
The bit that is confusing me is this line:
7: e9 00 00 00 00 jmpq c <f1-0x1a>
Why does it jump to location c (the next instruction?) rather than 26, have I read that correctly?
Turns out using as -L
on OSX fixes up the relocation!