Skip to content

Support TLS access into dylibs on Windows#108089

Merged
bors merged 4 commits intorust-lang:masterfrom
Zoxc:windows-tls
Mar 29, 2023
Merged

Support TLS access into dylibs on Windows#108089
bors merged 4 commits intorust-lang:masterfrom
Zoxc:windows-tls

Conversation

@Zoxc
Copy link
Contributor

@Zoxc Zoxc commented Feb 15, 2023

This allows access to #[thread_local] in upstream dylibs on Windows by introducing a MIR shim to return the address of the thread local. Accesses that go into an upstream dylib will call the MIR shim to get the address of it.

convert_tls_rvalues is introduced in rustc_codegen_ssa which rewrites MIR TLS accesses to dummy calls which are replaced with calls to the MIR shims when the dummy calls are lowered to backend calls.

A new dll_tls_export target option enables this behavior with a false value which is set for Windows platforms.

This fixes #84933.

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

Labels

merged-by-bors This PR was explicitly merged by bors. 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. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support inlining cross-crate TLS access on MSVC

9 participants