为什么在空 C 程序中执行的指令总数会发生变化?

Why does the total number of instructions executed change in an empty C program?

我一直在计算空 C 程序使用 Intel 的 Pin 执行的指令。大多数情况下,我得到的总指令数为 118724,但有时计数会上升到 118770。这种变化的原因可能是什么?

代码运行: int main() {}

我觉得 @Neitsa 在他们对原 post 的评论中回答了我的问题。我会在这里引用它。

But be wary that PIN starts very early in the process life, so it starts instrumenting everything the system loader is doing (basically in the libc). The fact that you have two different instruction count is probably due to a if / else branch somewhere in the ELF loading code (depending of the system state at a 't' time). If this bothers you you can restrict the instrumentation code to your own binary if you wish.