Skip to content

Commit 3158a8d

Browse files
committed
support no_std on Windows
1 parent 245857b commit 3158a8d

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/tools/miri/ci.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ function run_tests_minimal {
7575
./miri test -- "$@"
7676

7777
# Ensure that a small smoke test of cargo-miri works.
78-
# Note: This doesn't work on windows because of TLS.
7978
cargo miri run --manifest-path test-cargo-miri/no-std-smoke/Cargo.toml
8079
}
8180

src/tools/miri/src/shims/tls.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,11 @@ trait EvalContextPrivExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
261261
// (that would be basically https://github.com/rust-lang/miri/issues/450),
262262
// we specifically look up the static in libstd that we know is placed
263263
// in that section.
264+
if !this.have_module(&["std"]) {
265+
// Looks like we are running in a `no_std` crate.
266+
// That also means no TLS dtors callback to call.
267+
return Ok(());
268+
}
264269
let thread_callback =
265270
this.eval_windows("thread_local_key", "p_thread_callback")?.to_pointer(this)?;
266271
let thread_callback = this.get_ptr_fn(thread_callback)?.as_instance()?;

src/tools/miri/tests/pass/no_std.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
#![feature(lang_items, start)]
22
#![no_std]
3-
// windows tls dtors go through libstd right now, thus this test
4-
// cannot pass. When windows tls dtors go through the special magic
5-
// windows linker section, we can run this test on windows again.
6-
//@ignore-target-windows: no-std not supported on Windows
73

84
// Plumbing to let us use `writeln!` to host stdout:
95

0 commit comments

Comments
 (0)