Skip to content

compiler-builtins: pass -fdebug-compilation-dir=. to fix S_OBJNAME reproducibility on Windows#157914

Open
paradoxicalguy wants to merge 2 commits into
rust-lang:mainfrom
paradoxicalguy:compiler-builtins-objname-reproducibility
Open

compiler-builtins: pass -fdebug-compilation-dir=. to fix S_OBJNAME reproducibility on Windows#157914
paradoxicalguy wants to merge 2 commits into
rust-lang:mainfrom
paradoxicalguy:compiler-builtins-objname-reproducibility

Conversation

@paradoxicalguy

@paradoxicalguy paradoxicalguy commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

compiler_builtins.rlib differs between builds because clang-cl embeds the absolute object output path into the S_OBJNAME codeview record.
the path comes from cc-rs passing an absolute /Fo argument (derived from cargo's OUT_DIR) to addDebugObjectName(), which llvm then writes verbatim into .debug$S.
minimal repro:

clang-cl /c /Z7 t.c /Fo:a\t.obj  →  ObjectName: C:\...\a\t.obj
clang-cl /c /Z7 t.c /Fo:b\t.obj  →  ObjectName: C:\...\b\t.obj

-fdebug-compilation-dir=. makes S_OBJNAME emit a relative path instead.
needs CI verification on a windows dist job since local builds use cl.exe rather than the bundled clang-cl. this pr is only for testing

@rustbot

rustbot commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

compiler-builtins is developed in its own repository. If possible, consider making this change to rust-lang/compiler-builtins instead.

cc @tgross35

@rustbot rustbot added A-compiler-builtins Area: compiler-builtins (https://github.com/rust-lang/compiler-builtins) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jun 15, 2026
@rustbot

rustbot commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

r? @jieyouxu

rustbot has assigned @jieyouxu.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Fallback group: @Mark-Simulacrum, @jieyouxu
  • @Mark-Simulacrum, @jieyouxu expanded to Mark-Simulacrum, jieyouxu
  • Random selection from Mark-Simulacrum, jieyouxu

@rustbot

This comment has been minimized.

@rustbot

rustbot commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@rustbot

rustbot commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

⚠️ Warning ⚠️

  • The following commits have merge commits (commits with multiple parents) in your changes. We have a no merge policy so these commits will need to be removed for this pull request to be merged.

    You can start a rebase with the following commands:

    $ # rebase
    $ git pull --rebase https://github.com/rust-lang/rust.git main
    $ git push --force-with-lease
    

@rustbot rustbot added has-merge-commits PR has merge commits, merge with caution. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 15, 2026
@paradoxicalguy

Copy link
Copy Markdown
Contributor Author

cc @bjorn3 @Urgau

build.compile("libcompiler-rt.a");
// TEMP: print OUT_DIR so we can grab the .a before cleanup
let out = env::var("OUT_DIR").unwrap();
eprintln!("COMPILER_RT_OUT_DIR={}", out);

@bjorn3 bjorn3 Jun 15, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reminder to remove this before merging.

View changes since the review

@paradoxicalguy paradoxicalguy Jun 15, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, can we try a windows run on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-compiler-builtins Area: compiler-builtins (https://github.com/rust-lang/compiler-builtins) has-merge-commits PR has merge commits, merge with caution. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants