Skip to content

Rust compilations are not reproducible #30330

Closed
@glandium

Description

@glandium

It is desirable for repeated builds of the same source with the same compiler produces the same object files. That is something that C/C++ compilers usually do (modulo some randomization that can be overcome with e.g. the -frandom-seed flag), and that allows for reproducible builds.

While the machine code that rustc emits is apparently consistent, the symbols it creates aren't. For instance, when building Firefox with the rust bits enabled on Mozilla's try server twice in a row, I get many differences in the symbol list like the following:

< 0000000002693700 l     F .text    0000000000000008              _ZN3fmt23_$RF$$u27$a$u20$T.Debug3fmt20h1447159415212165900E

---
> 0000000002693700 l     F .text    0000000000000008              _ZN3fmt23_$RF$$u27$a$u20$T.Debug3fmt20h7964148332310452618E

rustc should either emit the same symbol names or allow to seed the RNG it uses like gcc allows. (The former would be more appreciated)

Cc @froydnj

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions