Skip to content

Stop using dlltool for generating import libraries on MinGW - #157712

Open
bjorn3 wants to merge 2 commits into
rust-lang:mainfrom
bjorn3:remove_dlltool_usage
Open

Stop using dlltool for generating import libraries on MinGW#157712
bjorn3 wants to merge 2 commits into
rust-lang:mainfrom
bjorn3:remove_dlltool_usage

Conversation

@bjorn3

@bjorn3 bjorn3 commented Jun 10, 2026

Copy link
Copy Markdown
Member

View all comments

Older versions of ld.bfd didn't support short import libraries like the builtin implementation of rustc generates. So we worked around this by using binutils dlltool, which produces the old import library format. We have now bumped the minimum supported ld.bfd version to one which does support them, so we can drop the dlltool usage. This makes cross-compilation a bit easier and removes a bunch of code in rustc.

Implements rust-lang/compiler-team#1029

@rustbot rustbot added A-compiletest Area: The compiletest test runner A-run-make Area: port run-make Makefiles to rmake.rs A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 10, 2026
@bjorn3
bjorn3 force-pushed the remove_dlltool_usage branch from 064b8e5 to b5d891b Compare June 10, 2026 15:35
@rustbot rustbot added the T-rust-analyzer Relevant to the rust-analyzer team, which will review and decide on the PR/issue. label Jun 10, 2026
@bjorn3
bjorn3 force-pushed the remove_dlltool_usage branch from b5d891b to a17a3d2 Compare June 10, 2026 15:36
@rust-log-analyzer

This comment has been minimized.

@bjorn3
bjorn3 force-pushed the remove_dlltool_usage branch from a17a3d2 to 3cbb918 Compare June 10, 2026 18:43
@rust-log-analyzer

This comment has been minimized.

@bjorn3
bjorn3 force-pushed the remove_dlltool_usage branch from 3cbb918 to adca83a Compare June 10, 2026 19:00
@rust-bors

This comment has been minimized.

@bjorn3
bjorn3 force-pushed the remove_dlltool_usage branch from adca83a to 4fa01bb Compare June 11, 2026 13:15
@rust-bors

This comment has been minimized.

@bjorn3
bjorn3 force-pushed the remove_dlltool_usage branch from 4fa01bb to 238a0fd Compare June 24, 2026 13:15
@bjorn3
bjorn3 marked this pull request as ready for review June 25, 2026 10:05
@rustbot

rustbot commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

These commits modify compiler targets.
(See the Target Tier Policy.)

Some changes occurred in src/tools/compiletest

cc @jieyouxu

compiletest directives have been modified. Please add or update docs for the
new or modified directive in src/doc/rustc-dev-guide/.

@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 Jun 25, 2026
@bjorn3

bjorn3 commented Jun 25, 2026

Copy link
Copy Markdown
Member Author

With #158020 merged, I believe this can now be done.

@rustbot ready

@rustbot

rustbot commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

r? @TaKO8Ki

rustbot has assigned @TaKO8Ki.
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:

  • Owners of files modified in this PR: codegen, compiler
  • codegen, compiler expanded to 73 candidates
  • Random selection from 19 candidates

@bjorn3

bjorn3 commented Jun 25, 2026

Copy link
Copy Markdown
Member Author

cc @mati865

@mati865

mati865 commented Jun 25, 2026

Copy link
Copy Markdown
Member

I think the consensus on Zulip was that we want to hold back the breaking changes until next release after the bump. To give the time for updating.
So this would need to wait for branching, which is 2 weeks away.

@mati865

mati865 commented Jun 25, 2026

Copy link
Copy Markdown
Member

Older versions of ld.bfd didn't support short import libraries like the builtin implementation of rustc generates.

Well, they did but with caveats. Like, it broke when import libs were put inside archive like staticlib/rlib.

@bjorn3

bjorn3 commented Jun 25, 2026

Copy link
Copy Markdown
Member Author

My bad. Let's wait for beta to branch then.

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 25, 2026
@rust-bors

This comment has been minimized.

@bjorn3
bjorn3 force-pushed the remove_dlltool_usage branch from 238a0fd to d4baa00 Compare July 17, 2026 20:00
@rustbot

This comment has been minimized.

@mati865

mati865 commented Aug 7, 2026

Copy link
Copy Markdown
Member

It's been almost 4 weeks.
ping @TaKO8Ki as the reviewer

@TaKO8Ki

TaKO8Ki commented Aug 8, 2026

Copy link
Copy Markdown
Member

@bors r+

@rust-bors

rust-bors Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

📌 Commit d4baa00 has been approved by TaKO8Ki

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 8, 2026
TaKO8Ki
TaKO8Ki previously approved these changes Aug 8, 2026
@mati865

mati865 commented Aug 8, 2026

Copy link
Copy Markdown
Member

Asked on Zulip whether this requires a MCP due to stable flag removal. Previously we did that via MCP: #152973

Pulling off the merge queue until answered, if MCP is not required then I apologize for the noise.
@bors r-

EDIT: also sorry for the late notice, I' been meaning to review it but couldn't remember to do that when I had time.

@rust-bors rust-bors Bot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Aug 8, 2026
@rust-bors

rust-bors Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

This pull request was unapproved.

View changes since this unapproval

@rust-bors

This comment has been minimized.

Older versions of ld.bfd didn't support short import libraries like the
builtin implementation of rustc generates. So we worked around this by
using binutils dlltool, which produces the old import library format. We
have now bumped the minimum supported ld.bfd version to one which does
support them, so we can drop the dlltool usage. This makes
cross-compilation a bit easier and removes a bunch of code in rustc.
@bjorn3
bjorn3 force-pushed the remove_dlltool_usage branch from d4baa00 to 687fd1c Compare September 9, 2026 10:55
@rustbot

rustbot commented Sep 9, 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.

@bjorn3

bjorn3 commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

@rustbot ready

Turns out we will have to this rather than the more gradual migration path in #161050 after all due to a standard library being compiled without usage of dlltool being ABI incompatible with user code compiled with usage of dlltool and vice versa: #161050 (comment)

@rustbot fcp compiler

This will stop us from respecting -Cdlltool on the *-pc-windows-gnu targets and instead unconditionally use ar_archive_writer to match all other Windows targets.

@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 Sep 9, 2026
@bjorn3

bjorn3 commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

@rfcbot fcp compiler

@bjorn3

bjorn3 commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

@rfcbot merge compiler

This will stop us from respecting -Cdlltool on the *-pc-windows-gnu targets and instead unconditionally use ar_archive_writer to match all other Windows targets.

@rust-rfcbot

rust-rfcbot commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

@bjorn3 has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@rust-rfcbot rust-rfcbot added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. labels Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-compiletest Area: The compiletest test runner A-run-make Area: port run-make Makefiles to rmake.rs A-testsuite Area: The testsuite used to check the correctness of rustc disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rust-analyzer Relevant to the rust-analyzer team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants