Skip to content

Commit

Permalink
support no_std on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Nov 26, 2022
1 parent f50f7d2 commit 425ddc1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
1 change: 0 additions & 1 deletion ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ function run_tests_minimal {
./miri test -- "$@"

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

Expand Down
5 changes: 5 additions & 0 deletions src/shims/tls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,11 @@ trait EvalContextPrivExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
// (that would be basically https://github.com/rust-lang/miri/issues/450),
// we specifically look up the static in libstd that we know is placed
// in that section.
if !this.have_module(&["std"]) {
// Looks like we are running in a `no_std` crate.
// That also means no TLS dtors callback to call.
return Ok(());
}
let thread_callback =
this.eval_windows("thread_local_key", "p_thread_callback")?.to_pointer(this)?;
let thread_callback = this.get_ptr_fn(thread_callback)?.as_instance()?;
Expand Down
4 changes: 0 additions & 4 deletions tests/pass/no_std.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#![feature(lang_items, start)]
#![no_std]
// windows tls dtors go through libstd right now, thus this test
// cannot pass. When windows tls dtors go through the special magic
// windows linker section, we can run this test on windows again.
//@ignore-target-windows: no-std not supported on Windows

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

Expand Down

0 comments on commit 425ddc1

Please sign in to comment.