Skip to content

remove allows_weak_linkage target spec flag#156372

Open
RalfJung wants to merge 1 commit intorust-lang:mainfrom
RalfJung:allows_weak_linkage
Open

remove allows_weak_linkage target spec flag#156372
RalfJung wants to merge 1 commit intorust-lang:mainfrom
RalfJung:allows_weak_linkage

Conversation

@RalfJung
Copy link
Copy Markdown
Member

@RalfJung RalfJung commented May 9, 2026

The flag doesn't actually do anything. I have no idea what it's original purpose was.

It got introduced in 59cfe90, but already a few months later in 5795098 both of its uses were removed when the entire file src/librustc_trans/closure.rs got deleted.

It seems like back in the day we used weak linkage for closures by default and MinGW wasn't happy about that? But not much later the way we compile closures got changed, making the work-around unnecessary. The flag has then persisted unused for 10 years. A couple of Windows/UEFI targets are setting allows_weak_linkage: false but I assume that was just cargo-culted.

But to be sure, let's ping the folks listed for the affected targets and other Windows folks:
@dvdhrm @nicholasbishop @Berrysoft @mati865 @thomcc @tbu- @ChrisDenton

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 9, 2026

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

@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 May 9, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 9, 2026

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: compiler
  • compiler expanded to 73 candidates
  • Random selection from 18 candidates

@mati865
Copy link
Copy Markdown
Member

mati865 commented May 9, 2026

I wasn't contributing to Rust back when it was added and I have no idea what issue the comment is talking about (I don't deny existence of such bug though).

IIRC, Rust for quite some time now avoids using weak symbols on non-Unix targets.

I'm in favour of removal.

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