-
Notifications
You must be signed in to change notification settings - Fork 353
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #3723 - RalfJung:win-tls-callback, r=RalfJung
iter_exported_symbols: also walk used statics in local crate Since rust-lang/rust#126938 got reverted, we need a different approach. Fixes #3722
- Loading branch information
Showing
3 changed files
with
43 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
//! Ensure that we call Windows TLS callbacks in the local crate. | ||
//@only-target-windows | ||
// Calling eprintln in the callback seems to (re-)initialize some thread-local storage | ||
// and then leak the memory allocated for that. Let's just ignore these leaks, | ||
// that's not what this test is about. | ||
//@compile-flags: -Zmiri-ignore-leaks | ||
|
||
#[link_section = ".CRT$XLB"] | ||
#[used] // Miri only considers explicitly `#[used]` statics for `lookup_link_section` | ||
pub static CALLBACK: unsafe extern "system" fn(*const (), u32, *const ()) = tls_callback; | ||
|
||
unsafe extern "system" fn tls_callback(_h: *const (), _dw_reason: u32, _pv: *const ()) { | ||
eprintln!("in tls_callback"); | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
in tls_callback |