Skip to content

Stop using dlltool for generating import libraries on MinGW#157712

Open
bjorn3 wants to merge 1 commit into
rust-lang:mainfrom
bjorn3:remove_dlltool_usage
Open

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

Conversation

@bjorn3

@bjorn3 bjorn3 commented Jun 10, 2026

Copy link
Copy Markdown
Member

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 (TODO) 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.

Blocked on updating the required binutils version.

@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.

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 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 removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 25, 2026
@rustbot rustbot added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jun 25, 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 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. 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.

5 participants