铿锵声汇编代码中看似毫无意义的指令

时间:2018-04-14 11:27:46

标签: macos gcc assembly clang x86-64

clang -S编译以下来源:

int main {
  return 0;
} // literally nothing but this main function

到此:

pushq   %rbp
movq    %rsp, %rbp
xorl    %eax, %eax
movl    $0, -4(%rbp)  # what is this?
popq    %rbp
retq
# extracted out directives...

我无法理解为什么movl $0, -4(%rbp)存在。根本没有局部变量。

我的铿锵声版:Apple LLVM version 9.0.0 (clang-900.0.39.2)

0 个答案:

没有答案