diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-06-29 23:28:39 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-07-01 09:35:55 -0700 |
| commit | ae0eb675db97a57a63f941b29754d8e32040ecc9 (patch) | |
| tree | 247e31e2ced1bc9463014f95afee0dd05f383840 /src/libstd/sys | |
| parent | 91c22b63020e15908859b11bfe777d65bc55aa98 (diff) | |
| download | rust-ae0eb675db97a57a63f941b29754d8e32040ecc9.tar.gz rust-ae0eb675db97a57a63f941b29754d8e32040ecc9.zip | |
msvc: Fix TLS destructors
Just like the original article our Windows TLS support is based on predicted, this symbol must be linked in on MSVC to pull in the necessary support for TLS variables. This commit fixes a number of unit tests which require that TLS destructors are run.
Diffstat (limited to 'src/libstd/sys')
| -rw-r--r-- | src/libstd/sys/windows/thread_local.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/libstd/sys/windows/thread_local.rs b/src/libstd/sys/windows/thread_local.rs index 5002de55988..a2dbb0f8342 100644 --- a/src/libstd/sys/windows/thread_local.rs +++ b/src/libstd/sys/windows/thread_local.rs @@ -221,8 +221,8 @@ unsafe fn unregister_dtor(key: Key) -> bool { // // # The article mentions crazy stuff about "/INCLUDE"? // -// It sure does! This seems to work for now, so maybe we'll just run into -// that if we start linking with msvc? +// It sure does! We include it below for MSVC targets, but it look like for GNU +// targets we don't require it. #[link_section = ".CRT$XLB"] #[linkage = "external"] @@ -231,6 +231,10 @@ pub static p_thread_callback: unsafe extern "system" fn(LPVOID, DWORD, LPVOID) = on_tls_callback; +#[cfg(target_env = "msvc")] +#[link_args = "/INCLUDE:_tls_used"] +extern {} + #[allow(warnings)] unsafe extern "system" fn on_tls_callback(h: LPVOID, dwReason: DWORD, |
