diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2017-11-24 09:18:22 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2017-11-24 14:28:12 -0800 |
| commit | 95e9609b9dade04590b7f3b9f6c3f7b02d116b3f (patch) | |
| tree | db9f1c8b5d7206af995858eb4f39fac066317cc1 /src/libstd/sys | |
| parent | 47498dea0934f481dcca00c9b19a9bd9b099a408 (diff) | |
| download | rust-95e9609b9dade04590b7f3b9f6c3f7b02d116b3f.tar.gz rust-95e9609b9dade04590b7f3b9f6c3f7b02d116b3f.zip | |
std: Flag Windows TLS dtor symbol as #[used]
Turns out ThinLTO was internalizing this symbol and eliminating it. Worse yet if you compiled with LTO turns out no TLS destructors would run on Windows! The `#[used]` annotation should be a more bulletproof implementation (in the face of LTO) of preserving this symbol all the way through in LLVM and ensuring it makes it all the way to the linker which will take care of it.
Diffstat (limited to 'src/libstd/sys')
| -rw-r--r-- | src/libstd/sys/windows/thread_local.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libstd/sys/windows/thread_local.rs b/src/libstd/sys/windows/thread_local.rs index 7ae9ed917bd..cdad320e122 100644 --- a/src/libstd/sys/windows/thread_local.rs +++ b/src/libstd/sys/windows/thread_local.rs @@ -200,8 +200,9 @@ unsafe fn register_dtor(key: Key, dtor: Dtor) { // the address of the symbol to ensure it sticks around. #[link_section = ".CRT$XLB"] -#[linkage = "external"] #[allow(dead_code, unused_variables)] +#[used] // we don't want LLVM eliminating this symbol for any reason, and + // when the symbol makes it to the linker the linker will take over pub static p_thread_callback: unsafe extern "system" fn(c::LPVOID, c::DWORD, c::LPVOID) = on_tls_callback; |
