about summary refs log tree commit diff
path: root/compiler/rustc_target/src/spec/windows_gnullvm_base.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-03-29 16:20:37 +0000
committerbors <bors@rust-lang.org>2023-03-29 16:20:37 +0000
commitf98598c6cd34947efa9e3977338e9bce62d1997c (patch)
treedbcaccc8c251182adeb2beccb32b687f598e0623 /compiler/rustc_target/src/spec/windows_gnullvm_base.rs
parent86792086646b61342c9417b78b8a535392f1045f (diff)
parentd499bbb99d72c991f1d1691f83ffe96bcfafc80a (diff)
downloadrust-f98598c6cd34947efa9e3977338e9bce62d1997c.tar.gz
rust-f98598c6cd34947efa9e3977338e9bce62d1997c.zip
Auto merge of #108089 - Zoxc:windows-tls, r=bjorn3
Support TLS access into dylibs on Windows

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 https://github.com/rust-lang/rust/issues/84933.
Diffstat (limited to 'compiler/rustc_target/src/spec/windows_gnullvm_base.rs')
-rw-r--r--compiler/rustc_target/src/spec/windows_gnullvm_base.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/compiler/rustc_target/src/spec/windows_gnullvm_base.rs b/compiler/rustc_target/src/spec/windows_gnullvm_base.rs
index cada28652f9..b1d8e2be5a6 100644
--- a/compiler/rustc_target/src/spec/windows_gnullvm_base.rs
+++ b/compiler/rustc_target/src/spec/windows_gnullvm_base.rs
@@ -23,6 +23,7 @@ pub fn opts() -> TargetOptions {
         abi: "llvm".into(),
         linker: Some("clang".into()),
         dynamic_linking: true,
+        dll_tls_export: false,
         dll_prefix: "".into(),
         dll_suffix: ".dll".into(),
         exe_suffix: ".exe".into(),