Skip to content

Conversation

@mati865
Copy link
Member

@mati865 mati865 commented Nov 21, 2025

Split out from #147536 (comment)

This change decouples detect_self_contained_mingw() from the linker determined by linker_and_flavor(), allowing for better control over the process.

There should only one user observable change from this PR. Passing -Clinker=<linker> when is absent from PATH, will result in an error regarding inability to find <linker>, unless -Clink-self-contained is also provided.
Previously, -Clinker=<linker> allowed to call any executable shipped with Rust, including rust-objcopy, wasm-component-ld.

r? @petrochenkov

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 21, 2025
@mati865
Copy link
Member Author

mati865 commented Nov 21, 2025

@bors try jobs=dist-x86_64-windows-gnu

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Nov 21, 2025
refactor mingw-w64 self-contained detection

try-job: dist-x86_64-windows-gnu
@rust-bors
Copy link

rust-bors bot commented Nov 21, 2025

💔 Test for 430b82e failed: CI. Failed job:

@rust-log-analyzer
Copy link
Collaborator

A job failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
   Compiling ureq v3.0.8
   Compiling citool v0.1.0 (/home/runner/work/rust/rust/src/ci/citool)
    Finished `dev` profile [unoptimized] target(s) in 21.03s
     Running `target/debug/citool calculate-job-matrix`
Run type: TryJob { job_patterns: Some(["dist-x86_64-windows-gnu"]) }
Error: Failed to calculate job matrix

Caused by:
    Patterns `dist-x86_64-windows-gnu` did not match any auto jobs
##[error]Process completed with exit code 1.

@mati865
Copy link
Member Author

mati865 commented Nov 21, 2025

@bors try jobs=dist-x86_64-mingw

rust-bors bot added a commit that referenced this pull request Nov 21, 2025
refactor mingw-w64 self-contained detection

try-job: dist-x86_64-mingw
@rust-bors

This comment has been minimized.

@rust-bors
Copy link

rust-bors bot commented Nov 21, 2025

☀️ Try build successful (CI)
Build commit: 104fcc2 (104fcc2a417e55791a997db8b9c3fc0b8885d4d9, parent: e22dab387f6b4f6a87dfc54ac2f6013dddb41e68)

@mati865
Copy link
Member Author

mati865 commented Nov 22, 2025

There should only one user observable change from this PR. Passing -Clinker=<linker> when is absent from PATH, will result in an error regarding inability to find <linker>, unless -Clink-self-contained is also provided.
Previously, -Clinker=<linker> allowed to call any executable shipped with Rust, including rust-objcopy, wasm-component-ld.

@petrochenkov
IMO, forbidding to call any Rust shipped binary is clearly a benefit here, but what should we do about -Clinker=x86_64-w64-mingw32-gcc and -Clinker=ld no longer using self-contained mode?
The first one could be handled by an additional sess.opts.cg.linker == sess.target.linker condition (not like that because of different types, but you get the idea). Retaining -Clinker=ld as self-contained without -Clink-self-contained, would unfortunately require hardcoding the name.

@mati865 mati865 marked this pull request as ready for review November 22, 2025 13:10
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler 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