rust-lang / rust-lang/rust

new non-determinism in linker maps introduced recently

Open
#142,989 15 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-reproducibility C-bug P-medium regression-untriaged T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

PR 141769 looks like it introduced non-determinism in the generation of dylibs -- it is looking like the tmpdir is being introduced into the linker map file -- perhaps when creating the .rustc section here: https://github.com/rust-lang/rust/blob/3129d37ef7075ee3cbaa3d6cbe1b5794f67192b0/compiler/rustc_codegen_ssa/src/back/metadata.rs#L571

We are seeing it in determinism-validation builds in Fuchsia.

Note: the original description claimed that the .so files had also changed, hence some of the discussion below.
Although the .so files are identical, we are seeing .so.map files differing, with distinct tmp paths, e.g.:

            f91ef            f91ef      431     1         .../rust/linux-x64/lib/rustlib/x86_64-unknown-fuchsia/lib/libcompiler_builtins-84c11efc675a4b65.rlib(compiler_builtins-84c11efc675a4b65.compiler_builtins.ac0a882909fb5ff0-cgu.018.rcgu.o):(.debug_line)
            f9620            f9620      30d     1         obj/zircon/system/ulib/sync/libsync.a(libsync.mutex.c.o):(.debug_line)
                0                0   1cf28a     1 .rustc
-               0                0   1cf28a     1         /tmp/rustcli35e4/rmeta.o:(.rustc)
+               0                0   1cf28a     1         /tmp/rustcvBrdn3/rmeta.o:(.rustc)
                0                0   1cf28a     1                 rust_metadata_vfs_3772e3b421ca7a16
                0                0      187     1 .debug_loclists
                0                0      22b     1         obj/zircon/system/ulib/sync/libsync.a

Suggested label: A-reproducibility

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with compiler/rustc_codegen_ssa/src/back/metadata.rs around line 571 and compare the changes from PR 141769. Reproduce the determinism-validation linker-map difference and trace how the .rustc section receives the temporary path. Done means identical .so.map outputs across builds without tmpdir-dependent entries.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system, compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.