Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make -Cmetadata consistent across platforms #14107

Merged
merged 1 commit into from
Jun 20, 2024

Commits on Jun 19, 2024

  1. Make -Cmetadata consistent across platforms

    This commit updates how `-Cmetadata` is calculated for each unit to
    optionally exclude the `host: ...` line that rustc prints for
    cross-compiled builds. Previously the full `verbose_version` was hashed
    for stable builds and the `host` was explicitly hashed for non-stable
    builds. For a build using `--target`, however, that means that the
    `-Cmetadata` will be different when producing the same target on
    different hosts (e.g. producing the binary once on Linux and once on
    macOS).
    
    This can hinder reproduction of a binary across different platforms even
    when the `--target` flag is used. For example in rust-lang/rust#117597
    it was seen that a WebAssembly binary produced on different platforms
    was slightly different and this appears due to the differing
    `-Cmetadata` flags. After this commit the `-Cmetadata` flag is the same
    for two different platforms meaning that different platforms produce the
    same binary.
    
    I've tested locally and a simple project produces a different binary
    before this change but produces the same binary on two platforms after
    this change. Unfortunately automated testing of this change will be
    difficult since it requires two different host compilers, though.
    alexcrichton committed Jun 19, 2024
    Configuration menu
    Copy the full SHA
    2db0bab View commit details
    Browse the repository at this point in the history