GAS:JMP指令不正确?

时间:2015-09-16 22:33:08

标签: macos assembly gas

我有这个汇编代码:

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

正在运行as -v < /dev/null

Apple Inc version cctools-862, GNU assembler version 1.38

正在运行as jit_out.s -o jit_out.oobjdump -D jit_out.o

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   

令我困惑的是这一行:

  7:    e9 00 00 00 00          jmpq   c <f1-0x1a>

为什么它会跳转到位置c(下一条指令?)而不是26,我能正确读取吗?

1 个答案:

答案 0 :(得分:0)

在OSX上使用as -L修复重定位!