Skip to content

Use .drectve for MSVC DLL exports#158294

Open
AsakuraMizu wants to merge 5 commits into
rust-lang:mainfrom
AsakuraMizu:windows-drectve-export
Open

Use .drectve for MSVC DLL exports#158294
AsakuraMizu wants to merge 5 commits into
rust-lang:mainfrom
AsakuraMizu:windows-drectve-export

Conversation

@AsakuraMizu

@AsakuraMizu AsakuraMizu commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

View all comments

This is a continuation of #142568.

This fixes the i686 MSVC issue mentioned there: .def files accept undecorated names, but .drectve /EXPORT needs decorated symbol names. The public export name is preserved with EXPORTAS.

It's worth noting that EII with defaults now also works on MSVC.

@rustbot rustbot added 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. labels Jun 23, 2026
@rustbot

rustbot commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

r? @oli-obk

rustbot has assigned @oli-obk.
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 21 candidates

@rust-log-analyzer

This comment has been minimized.

Comment thread compiler/rustc_codegen_ssa/src/back/link.rs Outdated
Comment thread compiler/rustc_codegen_ssa/src/back/linker.rs
@oli-obk oli-obk 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 23, 2026
@AsakuraMizu AsakuraMizu force-pushed the windows-drectve-export branch from b0075d5 to 4051560 Compare June 24, 2026 05:22
@AsakuraMizu

Copy link
Copy Markdown
Contributor Author

Updated :)

@rustbot ready

@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 24, 2026

@oli-obk oli-obk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@rust-bors

rust-bors Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 4051560 has been approved by oli-obk

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

bjorn3 commented Jun 24, 2026

Copy link
Copy Markdown
Member

Maybe rollup=iffy? Linkage related things tend to be tricky.

@oli-obk

oli-obk commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

@bors rollup=iffy reason=windows linker shenanigans

JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jun 25, 2026
…, r=oli-obk

Use .drectve for MSVC DLL exports

This is a continuation of rust-lang#142568.

This fixes the i686 MSVC issue mentioned there: `.def` files accept undecorated names, but `.drectve` `/EXPORT` needs decorated symbol names. The public export name is preserved with `EXPORTAS`.

It's worth noting that EII with defaults now also works on MSVC.
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jun 25, 2026
…, r=oli-obk

Use .drectve for MSVC DLL exports

This is a continuation of rust-lang#142568.

This fixes the i686 MSVC issue mentioned there: `.def` files accept undecorated names, but `.drectve` `/EXPORT` needs decorated symbol names. The public export name is preserved with `EXPORTAS`.

It's worth noting that EII with defaults now also works on MSVC.
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jun 25, 2026
…, r=oli-obk

Use .drectve for MSVC DLL exports

This is a continuation of rust-lang#142568.

This fixes the i686 MSVC issue mentioned there: `.def` files accept undecorated names, but `.drectve` `/EXPORT` needs decorated symbol names. The public export name is preserved with `EXPORTAS`.

It's worth noting that EII with defaults now also works on MSVC.
rust-bors Bot pushed a commit that referenced this pull request Jun 25, 2026
…uwer

Rollup of 17 pull requests

Successful merges:

 - #153697 (Add arg splat experiment initial tuple impl)
 - #158294 (Use .drectve for MSVC DLL exports)
 - #158253 (codegen_ssa: multiply scalable vec size by `vscale`)
 - #158308 (Fix bug when rustdoc "go to only result" setting is not working as expected")
 - #158345 (Use `transmute_neo` in `assume_init`)
 - #158369 (std: abort when `resume_unwind` is called inside the panic hook)
 - #158374 (disallow tail calling extern "rust-call" functions)
 - #158380 (Revert "rebuild LLVM when `bootstrap.toml` config changes")
 - #154398 (Add test for async Send with PhantomData<*mut ()> + unsafe impl Send + dyn Trait)
 - #157181 (autodiff: stop always needing an alloca)
 - #158278 (autodiff - typtree cleanups)
 - #158311 (doc(unstable-book): fix typo "earier" -> "earlier" in default-visibility flag)
 - #158318 (Make normalization in a test case resilient to dist compilation)
 - #158338 (Reorganize `tests/ui/issues` [14/N])
 - #158343 (Include `Item::const_stability` info in rustdoc JSON.)
 - #158355 (Fixup the refactoring errors in #156246)
 - #158390 (Fix: auto trait, const trait bound)

Failed merges:

 - #155535 (export symbols: support macos/windows(32/64))
@JonathanBrouwer

Copy link
Copy Markdown
Contributor

💔 I suspect this PR failed tests as part of a rollup
@bors r-

After fixing the problem, consider running a try job for the failed job before re-approving.

Link to failure: #158391 (comment)

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

rust-bors Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

This pull request was unapproved.

This PR was contained in a rollup (#158391), which was unapproved.

View changes since this unapproval

@rust-log-analyzer

This comment has been minimized.

@rust-bors rust-bors Bot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 29, 2026
@rust-bors

rust-bors Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

💔 Test for 2523831 failed: CI. Failed job:

@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-review Status: Awaiting review from the assignee but also interested parties. labels Jun 30, 2026
@rust-log-analyzer

This comment has been minimized.

@AsakuraMizu AsakuraMizu force-pushed the windows-drectve-export branch from c359042 to 2f749bd Compare June 30, 2026 05:10
@oli-obk

oli-obk commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

@bors try jobs=x86_64-msvc-ext1

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jun 30, 2026
Use .drectve for MSVC DLL exports


try-job: x86_64-msvc-ext1
@rust-bors

rust-bors Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: a558f27 (a558f2706edcfaa8ced9843b1d3addc791a7c012)
Base parent: 0966944 (096694416a41840709140eb0fd0ca193d1a3e6ba)

@AsakuraMizu

Copy link
Copy Markdown
Contributor Author

It seems that if we don't pass a /DEF:lib.def, link.exe won't generate a .lib file for an empty cdylib. lld, on the other hand, doesn't have this problem.

@rustbot ready

@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 30, 2026
Comment thread tests/ui/linking/dll-weak-definition.rs Outdated
Comment thread compiler/rustc_codegen_ssa/src/back/linker.rs
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 30, 2026
@rustbot

rustbot commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. A-run-make Area: port run-make Makefiles to rmake.rs labels Jun 30, 2026
@rust-log-analyzer

This comment has been minimized.

1 similar comment
@rust-log-analyzer

This comment has been minimized.

@AsakuraMizu AsakuraMizu force-pushed the windows-drectve-export branch from d16908e to 296ba6a Compare July 1, 2026 03:59
@AsakuraMizu

Copy link
Copy Markdown
Contributor Author

@rustbot ready

@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 Jul 1, 2026
@bjorn3

bjorn3 commented Jul 1, 2026

Copy link
Copy Markdown
Member

I think this PR allows replacing the //@ ignore-windows in all EII tests with //@ ignore-windows-gnu. Can be done in a follow up PR.

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

Labels

A-run-make Area: port run-make Makefiles to rmake.rs 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.

6 participants