[PATCH] D147544: [BOLT] Move from RuntimeDyld to JITLink

Rafael Auler via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 20 15:01:53 PDT 2023


rafauler added a comment.

We can't have non-determinism in BOLT

BOLT, and compilers in general, need to be deterministic. I understand how that might be overlooked in a JIT, but for a static tool, we can't generate a different binary given the input hasn't changed. There are build tools that rely on this. For example, you might want to compute the hash on the output binary, but if your build system is non-deterministic and generate a different binary in a new run, then there's no point in hashing the binaries. I would argue that even for a JIT, having the layout being non-deterministic is undesirable. Suppose you're debugging something and want to restart the run, it is bad if the layout changes and your bug goes away or manifests differently, in case of a memory bug.

I saw that you provided a patch to make the section order deterministic. I used that, and also used a change to insert the null terminator. And then I got the binaries to match perfectly for some tests. But what's weird is that that happened only for some runs. Other runs would generate un-matching binaries, which is something that we can't have in BOLT. I didn't investigate why is that happening, but it is because of my change to add the prepass to add the null terminator. But assuming we don't have this change, if the section orders aren't deterministic, we also can't have that, even if the code is correct.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147544/new/

https://reviews.llvm.org/D147544



More information about the llvm-commits mailing list