'rustdoc' binary is not reproducible

Hello,

We've observed that 'rustdoc' is not reproducible in our Yocto build environment.

The below differences are observed between multiple builds (The rust sources are not changed between builds). The diff in shown in ".strtab" & ".shstrtab" sections of the binary.

What is the number XXXXXX highlighted in above image at llvm.XXXXXX is indicate? and what will cause this number to change?

And, This issue is not happening with rust sources under normal build in host machine.

@bjorn3 Do you have any inputs on this?

.llvm.<hash> suffixes are added by LLVM's thinLTO to prevent symbol collisions when making a symbol marked as internal external to enable inlining across the LLVM modules that participate in thinLTO. As for why it would differ, I have no clue. (You are not using PGO, right? PGO profile generation is not deterministic due to among other things threading.)

PGO for something like rustdoc seems like overkill, no? :slight_smile:

PGO profiler = true in our rust build environment. Setting profiler = false alone not fixed the issue, there is dependent option tools = ["rust-demangler",], when these both are set the issue is fixed.

Any reason why this is affecting rustdoc binary alone?

No clue at all unfortunately.