Skip to content

Commit

Permalink
Remove _tls_used trickery unless needed
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisDenton committed Feb 25, 2024
1 parent cb44130 commit 686d1cb
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions library/std/src/sys/pal/windows/thread_local_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,16 +295,13 @@ unsafe extern "system" fn on_tls_callback(_h: c::LPVOID, dwReason: c::DWORD, _pv

// See comments above for what this is doing. Note that we don't need this
// trickery on GNU windows, just on MSVC.
reference_tls_used();
#[cfg(target_env = "msvc")]
unsafe fn reference_tls_used() {
#[cfg(all(target_env = "msvc", not(target_thread_local)))]
{
extern "C" {
static _tls_used: u8;
}
crate::intrinsics::volatile_load(&_tls_used);
}
#[cfg(not(target_env = "msvc"))]
unsafe fn reference_tls_used() {}
}

#[cfg(not(target_thread_local))]
Expand Down

0 comments on commit 686d1cb

Please sign in to comment.