Skip to content

Conversation

@nbdd0121
Copy link
Member

@nbdd0121 nbdd0121 commented Dec 29, 2025

Tracking issue of the feature: #127488

DSO local attributes are not correctly applied to extern statics with #[linkage = "foo"] as we generate an internal global for such statics, and the we evaluate (and apply) DSO attributes on the internal one instead.

Fix this by applying DSO local attributes on the actually extern ones, too.

This test currently doesn't fulfill its purpose, as `external dso_local`
can still match `external {{.*}}`. Fix this by using CHECK-NOT directives.

Also, this test is expanded to all platforms where it makes sense, instead
of restricting to loongarch.
The current code applies `dso_local` to the internal generated symbols
instead of the actually-externally one.
@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. 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 Dec 29, 2025
@rustbot
Copy link
Collaborator

rustbot commented Dec 29, 2025

r? @jdonszelmann

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

@nbdd0121 nbdd0121 changed the title Fix and expand direct-access-external-data test Fix dso_local for external statics with linkage Dec 29, 2025
@jdonszelmann
Copy link
Contributor

jdonszelmann commented Jan 8, 2026

I'm sorry, I'm not sure that I'm the right person for this PR. Though idk if rerolling works because we'd just get a hot potato situation for this kind of PR. Sometimes I assign @bjorn3 to PRs like this because I know it's sort of in his area of expertise, but for this one I'm not sure. However, maybe he can assign either himself or whoever he thinks is more knowledgeable in this area

@bjorn3
Copy link
Member

bjorn3 commented Jan 9, 2026

This PR makes sense to me.

@bors r+

@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 Jan 9, 2026
@rust-bors
Copy link
Contributor

rust-bors bot commented Jan 9, 2026

📌 Commit 5467a39 has been approved by bjorn3

It is now in the queue for this repository.

@jdonszelmann
Copy link
Contributor

thanks bjorn!

Zalathar added a commit to Zalathar/rust that referenced this pull request Jan 10, 2026
 Fix dso_local for external statics with linkage

Tracking issue of the feature: rust-lang#127488

DSO local attributes are not correctly applied to extern statics with `#[linkage = "foo"]` as we generate an internal global for such statics, and the we evaluate (and apply) DSO attributes on the internal one instead.

Fix this by applying DSO local attributes on the actually extern ones, too.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 10, 2026
 Fix dso_local for external statics with linkage

Tracking issue of the feature: rust-lang#127488

DSO local attributes are not correctly applied to extern statics with `#[linkage = "foo"]` as we generate an internal global for such statics, and the we evaluate (and apply) DSO attributes on the internal one instead.

Fix this by applying DSO local attributes on the actually extern ones, too.
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jan 10, 2026
 Fix dso_local for external statics with linkage

Tracking issue of the feature: rust-lang#127488

DSO local attributes are not correctly applied to extern statics with `#[linkage = "foo"]` as we generate an internal global for such statics, and the we evaluate (and apply) DSO attributes on the internal one instead.

Fix this by applying DSO local attributes on the actually extern ones, too.
rust-bors bot added a commit that referenced this pull request Jan 11, 2026
Rollup of 11 pull requests

Successful merges:

 - #148196 (Implement create_dir_all() to operate iteratively instead of recursively)
 - #150494 ( Fix dso_local for external statics with linkage)
 - #150788 (THIR patterns: Replace `AscribeUserType` and `ExpandedConstant` wrappers with per-node data)
 - #150799 (Fix ICE: can't type-check body of DefId  for issue #148729)
 - #150804 (Remove std_detect_file_io and std_detect_dlsym_getauxval features)
 - #150852 (std: sys: fs: uefi: Implement File::write)
 - #150871 (Use f64 NaN in documentation instead of sqrt(-1.0))
 - #150878 (Emit an error for linking staticlibs on BPF)
 - #150911 (Add missing documentation for globs feature)
 - #150913 (compiler: Forward attributes to eii-expanded macros)
 - #150916 (Once again, reorganize the EII tests a bit)

r? @ghost
rust-bors bot added a commit that referenced this pull request Jan 11, 2026
Rollup of 12 pull requests

Successful merges:

 - #150947 (alloctests: Don't run the longer partial-sort tests under Miri)
 - #148196 (Implement create_dir_all() to operate iteratively instead of recursively)
 - #150494 ( Fix dso_local for external statics with linkage)
 - #150788 (THIR patterns: Replace `AscribeUserType` and `ExpandedConstant` wrappers with per-node data)
 - #150799 (Fix ICE: can't type-check body of DefId  for issue #148729)
 - #150804 (Remove std_detect_file_io and std_detect_dlsym_getauxval features)
 - #150852 (std: sys: fs: uefi: Implement File::write)
 - #150871 (Use f64 NaN in documentation instead of sqrt(-1.0))
 - #150878 (Emit an error for linking staticlibs on BPF)
 - #150911 (Add missing documentation for globs feature)
 - #150913 (compiler: Forward attributes to eii-expanded macros)
 - #150916 (Once again, reorganize the EII tests a bit)

r? @ghost
@rust-bors rust-bors bot merged commit 30585eb into rust-lang:main Jan 11, 2026
11 checks passed
@rustbot rustbot added this to the 1.94.0 milestone Jan 11, 2026
rust-timer added a commit that referenced this pull request Jan 11, 2026
Rollup merge of #150494 - extern_linkage_dso_local, r=bjorn3

 Fix dso_local for external statics with linkage

Tracking issue of the feature: #127488

DSO local attributes are not correctly applied to extern statics with `#[linkage = "foo"]` as we generate an internal global for such statics, and the we evaluate (and apply) DSO attributes on the internal one instead.

Fix this by applying DSO local attributes on the actually extern ones, too.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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