support no_std on Windows

This commit is contained in:
Ralf Jung 2022-11-26 15:58:44 +01:00
parent 245857beb7
commit 3158a8d476
3 changed files with 5 additions and 5 deletions

View File

@ -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
}

View File

@ -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()?;

View File

@ -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: